Skip to content

devmeireles/serverless-boilerplate

Repository files navigation

Serverless Boilerplate

A starter project for building AWS Lambda APIs with TypeScript, Serverless Framework, and DynamoDB.

What this project includes

  • Serverless Framework (AWS)
  • TypeScript
  • Webpack
  • Jest
  • ESLint + Prettier
  • Serverless Offline

Prerequisites

  • Node.js and npm
  • AWS account and IAM credentials
  • Serverless Framework CLI

Quick setup

  1. Install dependencies:
npm install
  1. Create local environment files:
cp /tmp/workspace/devmeireles/serverless-boilerplate/env.yml.example /tmp/workspace/devmeireles/serverless-boilerplate/env.yml
cp /tmp/workspace/devmeireles/serverless-boilerplate/.env.example /tmp/workspace/devmeireles/serverless-boilerplate/.env
  1. Configure AWS credentials for Serverless (example profile name used by this repo):
serverless config credentials \
  --provider aws \
  --key YOUR_AWS_ACCESS_KEY_ID \
  --secret YOUR_AWS_SECRET_ACCESS_KEY \
  --profile serverless-boilerplate

Never commit real credentials to .env, env.yml, or source code.

  1. Update env.yml values for each stage (default, dev, stage, prod) with your own configuration.

Database deployment

Before running locally or executing integration tests, deploy the DynamoDB table for the target stage.

npm run deploy:database:dev

Other stage commands:

  • npm run deploy:database:stage
  • npm run deploy:database:prod

Run locally

npm run start:dev

This starts serverless offline via nodemon and watches the src folder.

API routes

  • POST /interactions
  • GET /interactions
  • GET /interactions/{id}
  • PUT /interactions/{id}
  • DELETE /interactions/{id}

Testing

Run tests:

npm run test

Run tests with coverage:

npm run test:coverage

Helpful scripts

  • npm run lint:fix — lint and auto-fix TypeScript files
  • npm run format:fix — format TypeScript, JavaScript, JSON, and Markdown

Notes

  • Local/dev environment changes may affect real AWS resources depending on your configured table names.
  • Double-check MAIN_TABLE and stage-specific values before running deploy commands.
  • For AWS credentials setup details, see the Serverless documentation.

About

A starter project for building AWS Lambda APIs with TypeScript, Serverless Framework, and DynamoDB.

Topics

Resources

Stars

Watchers

Forks

Contributors