Hearty

A backend API to support hearty.

Contributing

Dependencies

  1. Python 3.8 - recommend installing using pyenv or pyenv-win
  2. NodeJS - recommend installing using nvm or nvm-windows
  3. Poetry - recommend installing using their primary instructions
  4. Docker - used for consistent deployment artifact packaging. Recommend installing Docker for Desktop and may require installing WSL2 on Windows

Building and Deploying

This project is using Serverless Framework for deployment to AWS. Serverless is installed as a local NPM package, and therefore should be invoked via npx

Makefile

It's recommended to use the Makefile commands instead of interacting directly with the tools.

  1. make build - performs poetry install and npm install
  2. make test - runs Python tests
  3. make black - format application and test directories using Black
  4. make check - runs Python tests and Black, mypy, flake8, etc.
  5. make deploy-all stage={stage} - deploys all components, making the following make deploy* commands duplicative
  6. make deploy-core stage={stage} - runs serverless deploy for the core infrastructure stack
  7. make-deploy-apps stage={stage} - runs serverless deploy for the business apps that depend on the core infrastructure
  8. make docs stage={sage} - generates JSON schema and OpenAPI yml files for public API endpoints

Components

  1. AWS API Gateway HTTP API
  2. AWS Cognito User Pool
  3. Cognito Authorizer

Endpoints / Lambda Functions

  1. /echo - simply logs and returns request event. Can be used to test authorization.

Hacks in place

A list of things likely related to this development initiating on a Windows 10 machine.

  1. pythonBin in serverless.yml to get serverless-python-requirements to work
  2. Editing of poetry.js from serverless-python-requirements per this GitHub issue