# API Quickstart Reference ## Getting Started #### 1. Install Requried Dependencies node/npm: ``` curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash # Install nvm # Restart your shell nvm install latest nvm use latest ``` docker: ``` brew install docker ``` commitizen: ``` brew install commitizen ``` pre-commit: ``` pip install pre-commit ``` #### 2. Setup Environment Variables Populate the mandatory environment variables in `.env` ``` AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_REGION= AWS_SECRET_NAME= ``` #### 3. Configure AWS VPN Client Download and install the [AWS VPN Client](https://aws.amazon.com/vpn/client-vpn-download/). Configuration is available in *1password* under `aws vpn client config` #### 4. Done Preview the documentation at [localhost:3000/nowatch/swagger](http://localhost:3000/nowatch/swagger) ## Development and Deployment ### Commit Convention We use [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/). A quick summary: Commits are grouped into `fix`, `chore`, `ci`, `docs`, `feat`. Commits that break existing functionality append a `!` to the group (for example `feat!`). A description is added after the group separated by a colon. A couple examples: ``` fix: fixed a simple bug feat!: added a new feature that breaks existing functionality ci: updated ci ``` #### Formatting Formatting is handled by **Prettier**. Install the [vsc extension](https://open-vsx.org/extension/esbenp/prettier-vscode) or the [cli](https://prettier.io/docs/install). It is recommended to turn on the `Format On Save` vsc setting. Formatting rules are defined in `.prettierrc` and are currently in sync with the dashboard as well. #### Deployment targets | Environment | EB environment | URL | Purpose | | --- | --- | --- | --- | | Testing | `api-testing-env` | [api-testing.nowatch.tech](https://api-testing.nowatch.tech/) | Used by backend to test backend deployments, ran on every commit | | Dev | `api-dev-env` | [api-dev.nowatch.tech](https://api-dev.nowatch.tech/) | Used by app developers to smap app test data | | Test | `api-test-env` | [api-test.nowatch.tech](https://api-test.nowatch.tech/) | Internal company testing environment, staging, incorrectly called "test" | | Production | `api-prod-env` | [api.nowatch.com](https://api.nowatch.com/) | Customer facing live API | #### Deployment strategy We use [trunk-based development](https://trunkbaseddevelopment.com/). New releases should only be done on the `main` brahc. This is the process of creating a new release: 1. Create a release tag using `make release` (for example it creates `5.7.3`) 2. Push the tag (`git push origin 5.7.3`) This flow runs a github action that deploys it to testing and uploads the app version. To promote it to different environments (after the github action has finished): ``` eb deploy api-dev-env --version 5.7.3 eb deploy api-test-env --version 5.7.3 eb deploy api-prod-env --version 5.7.3 ```