Eve library

Arete Deployment

Guide

Revision 1

On this page

This document covers the moving parts the Arete API + apps need in production. AWS-specific provisioning is in docs/domains/arete/cloud/aws.md (TBD — Phase 28.16.1 deliverables).

API service (apps/arete/api)#

Runtime: Node.js 20+. Single binary built by pnpm nx build arete-api.

Required environment variables#

Var Default Notes
NODE_ENV development Set to production in deploy
PORT 3020
HOST 127.0.0.1 Bind to 0.0.0.0 behind a load balancer
JWT_SECRET arete-dev-secret-change-me (rejected in production) Must be set in production
JWT_ISSUER arete-api
JWT_ACCESS_TOKEN_TTL 900 (15 min) seconds
JWT_REFRESH_TOKEN_TTL 604800 (7 days) seconds
DATABASE_URL postgresql://oshun:oshun_dev@localhost:5432/oshun_dev Postgres 14+
DB_POOL_MIN / DB_POOL_MAX 2 / 10
REDIS_URL redis://localhost:6379 Used for rate limiting
RATE_LIMIT_MAX 100 requests per window
RATE_LIMIT_WINDOW_MS 60000
LOG_LEVEL info trace / debug / info / warn / error / fatal
METRICS_PORT 9090 Prometheus scrape target
CORS_ORIGIN * Tighten in prod
SMTP_HOST / SMTP_PORT / SMTP_SECURE / SMTP_USER / SMTP_PASS / SMTP_FROM Mailpit defaults Real SMTP credentials in prod
WEB_URL http://localhost:5173 Used for password-reset links
COACH_STREAM_INTERVAL_MS 50 Per-token cadence for the SSE stream

JWT_SECRET=arete-dev-secret-change-me is rejected at boot when NODE_ENV=production.

Health probes#

Three Kubernetes-friendly probes ship under /health*:

  • GET /health — liveness. Returns 200 if the process is responding.
  • GET /health/ready — readiness. Returns 200 only when DB + Redis pings succeed.
  • GET /health/startup — slow-startup probe.

Migrations#

sh
pnpm drizzle-kit generate:pg     # produce a new SQL migration
pnpm drizzle-kit migrate:pg      # apply pending migrations

Run migrate:pg as part of the deploy pipeline, before swapping pods.

Observability#

The API ships a Prometheus scrape endpoint on METRICS_PORT (default 9090). Per-request fields (requestId, correlationId, latencyMs, userId) flow through structured pino logs.

Web app (apps/arete/web)#

Vite SPA. Build with pnpm nx build arete-web; the output lives in apps/arete/web/dist/.

Reverse-proxy /api/* to the API service. The web build assumes a matching origin or a tracked CORS allowlist.

Mobile app (apps/arete/mobile)#

React Native 0.73. The new react-native-image-picker dependency requires:

sh
cd apps/arete/mobile
pnpm install
cd ios && pod install

Configure the backend URL in src/utils/constants.ts (API.BASE_URL) before building a release. EAS builds for App Store / Google Play are covered in Phase 28.16.3 (TBD).

CI#

.github/workflows/arete.yml runs lint + typecheck + the @arete/core, @arete/api, and @arete/web vitest suites on every PR that touches apps/arete/** or libs/arete/**. See the workflow file for the full matrix.