Microservice boilerplate
Description
Usage
Slack commands
AWS
The deployment is done by the IAM User . The policies for this user are
tracked by infrastructure/iam.json
. If you plan on making changes to the policies for the user, make sure they're
reflected in this file.
You'll need to make sure that you have the credentials for the user set up locally. You'll need to do the following
- Generate api keys for deployment of that user via the console
- Configure your aws credentials as follows
[foo-deploy]
aws_access_key_id=<redacted>
aws_secret_access_key=<redacted>
Side note about iam.json
If you're having issues with saving the contents of the json file in the inline policy ui of the AWS console make sure to remove all of the white space. There's a size limit for the aws account and the whitespace takes up a majority of that size.
The deployment is run through the deploy
npm script.
Environment variables
There are a few environment variables that are set for the lambda that are used at runtime.
Environment variable | Purpose |
---|---|
LOGGING | This is used to define the current logging level of the application. |
FOO_TABLE | The name of the DynamoDB table generated by the serverless deployment process. |
Infrastructure
The following resources are used to back this API:
Service | Purpose | Reference |
---|---|---|
API Gateway | Handles HTTP requests and routes to Lambda | |
DynamoDB | Keeps application state | |
Lambda | Handles the requests for the api | |
CloudFormation | Creates the backing resources | |
CloudWatch | Logging for the app |
Architecture
Design
This uses an MVC architecture built on top of Express. Express is used for handling the http request, parsing the request authorization, and returning the response.
Concepts
Entity
Objects created by dynamoose used to simplify interaction with DynamoDB queries. These are responsible for querying and mutating data in the database.
Controller
Responsible for tying together models with business logic.
Repository
A wrapper for the entity specific connection to the database that performs rich, reusable operations against the entity type.