Getting Started
This guide will help you set up the API backend for local development.
Prerequisites
- Node.js 22+
- pnpm 10+
- Docker and Docker Compose
- PostgreSQL client (optional, for debugging)
Installation
Clone the repository and install dependencies:
bashgit clone <api-repo-url> cd api pnpm installSet up environment variables:
bashcp .env.example .envConfigure your
.envfile with required values (see below)
Environment Variables
Key environment variables:
| Variable | Description |
|---|---|
DATABASE_URL | PostgreSQL connection string |
REDIS_URL | Redis connection string |
NEO4J_URI | Neo4j bolt URI |
JWT_SECRET | Secret for JWT signing |
STRIPE_SECRET_KEY | Stripe API key |
SENDGRID_API_KEY | SendGrid API key |
Starting the Database
Start PostgreSQL, Redis, and Neo4j with Docker:
bash
pnpm services:up # from the repo rootRunning Migrations
Apply database migrations:
bash
pnpm db:migrateStarting the Server
Start the development server with hot reload:
bash
pnpm devThe API will be available at http://localhost:8080.
Verifying the Setup
Check the health endpoint:
bashcurl http://localhost:8080/healthView the API documentation at
http://localhost:8080/reference
Running Tests
bash
pnpm test # Run all tests
pnpm test:watch # Watch mode
pnpm test src/path/to/test.ts # Single fileTroubleshooting
Database Connection Issues
Ensure Docker containers are running:
bash
docker compose psPort Already in Use
Check what's using port 8080:
bash
lsof -i :8080Migration Errors
Try reverting and re-running:
bash
pnpm db:revert
pnpm db:migrate