This repository contains Peter's submission for Onica's take-home test. The deliverables as well as requirements. assumptions, tradeoffs, .. etc. are documented here as well
- Amazon DynamoDB Table
- AWS Lambda
- API Gateway
- For the Infrastructure as Code technology, I chose
serverless
. Although this was my first time using it, I decided to learn something new while working on this take-home. Insideserverless.yml
I also used raw CloudFormation when I needed to. - Here are the
serverless
plugins I used- serverless-python-requirements: Used to automatically install the requirements inside requirements.txt to have our semi-reproducible build
- serverless-pseudo-parameters: Used to be able to reference AWS Pseudo Parameters inside the
serverless.yml
- For the application code, I chose Python and was careful to build a modular micro-service following the necessary patterns to build a loosely-coupled code-base. The architecture in this project follows the Layered Architecture pattern demonstrated in Eric Evan's Domain Driven Design (The blue book).
- Install Python, at least version 3.7. Detailed instructions on this are found here.
- Install
virtualenv
by typingpython -m pip install virtualenv
. - Create a virtualenv by typing
python -m virtualenv -p python venv/
and activate by typingsource venv/bin/activate
. - Install Python requirements by typing
python -m pip install -r requirements.txt
- Install
serverless
. Detailed instructions on this are found here. - Install Node and npm from here.
- Install serverless plugins by typing
npm install
. - Authenticate
serverless
with your AWS account. Many methods for accomplishing this can be found here.
- Write tests, tests, and more tests. For the most part, it makes sense here to set using the
doctest
module. It's easy, simple, and gets the job done. - Define more custom exceptions to handle different business logic cases, move things like
UserId
andName
to another file containing value objects because I just placed them theentities.py
file for now while they are in fact, value objects. - Add a CI/CD pipeline to automate the process of testing the code, integrating with dependencies, and faster deployment.
- I would have added pagination using limit-offset style.
- I would have added and configured a linter, style guide checker, and a static type checker and made them part of the CI/CD pipeline.
- I would have added a swagger file and based the API configuration off it; This would be useful because it would mean that API docs would never go out of date as the API gateway would be based off of them.