# API Deployment

## Build

```bash
npm install
npm run build --workspace @aechr/shared
npm run build --workspace @aechr/api
```

## Runtime

```bash
cd apps/api
node dist/apps/api/src/main.js
```

## Pre-deploy checklist

- configure all environment variables from `ENVIRONMENT.md`
- run Prisma client generation
- apply Prisma SQL migrations to the target MySQL database
- run `npm run test --workspace @aechr/api`
- verify Swagger at `/docs`
- verify cron callers send `x-cron-secret`

## Operational notes

- refresh tokens are persisted and revoked in `refresh_tokens`
- cron runs are logged in `cron_job_logs`
- reminders are logged in `reminder_logs`
- all business deletes are soft deletes
