We mostly follow Uber Style Guide.
Note: would change over time.
.
├── template.yaml # AWS SAM Template
├── Makefile # Makefile
├── handlers # Main application commands & entry point
│ └── <lambda-name> # Contains 'main.go' lambda handler
├── migrations # Database migrations
├── models # database entities (including their specific enum interfaces)
├── repositories # database access layer
├── config # configurations and env variable/setup
└── pkg # 3rd party lib wrappers and/or utility functions. (Utilities should be extracted)
├── utils # utility library.
└── db # database library.
└── migrations # utilities for database migrations
NOTE: 'dev' instances of database are used for Local Development.
- AWS CLI already configured with Administrator permission
- Docker installed
- SAM CLI - Install the SAM CLI
- watchexec
You may need the following for local testing.
Install the CLI tools and Docker CE
brew install watchexec
We use testing
package that is built-in in Golang and you can simply run the following command to run our tests locally:
go test -v ./handlers/<lambda-name>/
- Code defensively: never make assumption about the data in the database or api response.
- Data Duplication, denormalizing data: document stores are allowed to denormalize data.
- Duplicated data changes can be enforced.