Example Serverless+Typescript codebase that adheres to the RealWorld API spec and opinionated patterns of the aws-ts-starter.
aws-realworld-starter
is a serverless seed written in Typescript that provides the following out of the box:
- Follows The Repository Pattern
- Structured in a way to have features carved out into microservices
- Strives for 100% unit test coverage to encourage BDD/TDD
- Fully functional end-to-end testing of the RealWorld API spec via a Serverless YAML
- A default Repository implementation against a Dynamo DB
- An AWS handler wrapper that takes care of the API Gateway callback and error handling, either by thrown errors or by caught promises
- Fork / Clone this repository
- Install the AWS CLI -
npm install -g aws
- Install the Serverless CLI -
npm install -g serverless
- Run
npm install
in your working directory - Configure your AWS CLI -
aws configure
with youraws_access_key_id
andaws_secret_access_key
- Create a JWT signing secret in the AWS System Manager's Parameter Store:
- Parameter name:
real-world-auth-jwt-secret
- Gogo: https://console.aws.amazon.com/systems-manager/parameters/create?region=us-east-1
- Parameter name:
TODO: Serverless Generator
A .travis.yml file is already included for you. If you do not have a Travis CI account, go here. Once registered, activate your repository, navigate to settings, and add the following Environment Variables:
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
This seed uses AWS as the provider by default and these credentials are used to deploy and run your serverless application.
A public place to display code coverage of your API. Add this Environment Variable to your Travis CI repository's settings:
repo_token
- Coveralls token for uploading code coverage report
Unit tests can be run via npm test
. If you have never run the end to end tests, or have code changes that need to be deployed before running the end to end tests, use npm run test:e2e:deploy
, otherwise to execute the end to end tests of what is deployed to your serverless provider, use npm run test:e2e
.
Note:
that when you run the deploy routine, it will run a gulp task that will automatically replace the token [[ENDPOINT]]
in each e2e test file and replace it with the base URL of the deployed AWS api gateway.