This is the backend API service for Reflections | Projections 2025, built with Node.js, Express, and TypeScript. It includes a complete self-hosted Supabase infrastructure for local development.
-
Install dependencies:
yarn
-
Set up environment variables:
- Reach out to your Dev Chairs for the
.env
file - Place it in the root of the
rp-api
directory - Optional: Add
DEV_ADMIN_EMAIL=your.email@example.com
to your.env
file for local admin access
- Reach out to your Dev Chairs for the
-
Start the full development environment:
docker compose up --build
The API includes several Docker Compose configurations for different development scenarios:
docker-compose.yml
- Spins up ALL services required locally (api, db, kong, studio, rest, meta)
docker compose up --build
docker-compose.api.yml
- Only spins up the API service (can configure to connect to prod database with env)
docker compose -f docker-compose.api.yml up --build
docker-compose.db.yml
- Only spins up the db-related services (db, kong, studio, rest, meta)
docker compose -f docker-compose.db.yml up --build
docker-compose.test.yml
- Only spins up the basic db services required for testing (db, kong, rest)
# Run tests in Docker
yarn test:docker
# Or manually start test environment
docker compose -f docker-compose.test.yml up --build
The database is automatically initialized with the scripts in docker/init-scripts/
. These scripts run in order:
00-roles.sql
- Creates Supabase roles and users (anon, authenticated, service_role, etc.)01-schema.sql
- Creates database schema, tables, and types02-grants.sql
- Sets up permissions for all roles
You can modify the database schema in docker/init-scripts/01-schema.sql
.
Task | Command |
---|---|
Install dependencies | yarn |
Start development server | yarn dev |
Start production server | yarn start |
Run tests | yarn test |
Run tests in Docker | yarn test:docker |
Lint code | yarn lint |
Format code | yarn format |
Build project | yarn build |
Verify (build + lint + format) | yarn verify |
View API logs | yarn logs |
Enter API container | yarn shell |
Restart API service | yarn restart |
When running locally with Docker Compose:
Service | URL | Description |
---|---|---|
API | http://localhost:3000 | Main API endpoints |
Supabase Studio | http://localhost:8000 | Database management interface |
Kong Gateway | http://localhost:8000 | API gateway |
PostgREST | http://localhost:3001 | REST API for PostgreSQL |
# Install dependencies
yarn
# Start development server
yarn dev
# Start full environment
docker compose up --build
# In another terminal, view logs
yarn logs
# Enter the API container for debugging
yarn shell
# Run tests locally
yarn test
# Run tests in Docker environment
yarn test:docker
- Port conflicts: Make sure ports 3000, 5432, and 8000 are available
- Environment variables: Ensure your
.env
file is properly configured - Database connection: Check that the database service is healthy before starting the API
# View all container logs
docker compose logs -f
# View specific service logs
docker compose logs -f api
# Restart a specific service
docker compose restart api
# Clean up containers and volumes
docker compose down -v
- Follow the existing code style (use
yarn format
to format code) - Write tests for new features
- Run
yarn verify
before committing - Ensure all tests pass with
yarn test:docker
Feel free to open a PR or ask the team! For environment setup, reach out to your Dev Chairs.