This guide walks you through spinning up the full Innova Backend Serverless stack on your local machine. The local environment mirrors production as closely as possible: NestJS runs in watch mode, MongoDB and LocalStack (SQS + S3 emulation) run in Docker, and Prisma manages schema migrations against a Supabase-hosted or local Postgres database.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/vruizz22/innova-backend-serverless/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before you begin, make sure the following tools are available on your machine:- Node.js ≥ 20 — install via nvm to keep versions isolated across projects
- pnpm ≥ 9 — enable with
corepack enable && corepack prepare pnpm@latest --activate - Docker + Docker Compose v2 — required for MongoDB and LocalStack containers
- Supabase project or local Postgres — the relational database and auth layer; a free Supabase project covers both
Setup Steps
Configure your environment
Copy the example file and fill in the required values. At minimum you need
DATABASE_URL, MONGODB_URI, and your Supabase keys. SQS queue URLs can be pointed at LocalStack for fully local development (see the Environment Variables reference for LocalStack URL format).Start local infrastructure
This single command launches MongoDB 7 (telemetry store) and LocalStack 3 (SQS + S3 emulation). Both containers persist data in named Docker volumes so they survive restarts.Confirm both containers are healthy:
Apply database migrations
Run all pending Prisma migrations against the database pointed to by
DATABASE_URL. On first run this creates the full v9 schema.Seed demo data
Populate the database with a demo school, courses, students, and exercises so you have realistic data to work with immediately.
(Optional) Seed demo auth users
Create the corresponding Supabase Auth identities for the seeded demo users. This step is guarded by two environment flags to prevent accidental execution.The script calls the Supabase Admin REST API and is fully idempotent — running it twice is safe.
Start the development server
NestJS starts in watch mode with hot reload. The server listens on port 3000 by default.You should see Pino JSON logs and a line confirming the application is listening on
http://localhost:3000.Verify the installation
Check the health endpoint and browse the auto-generated OpenAPI docs:Then open your browser at http://localhost:3000/docs to explore the full Swagger UI.
Docker Compose Services
Thedocker-compose.yml in the repository root provides two services. Postgres is intentionally not included — it is provided by your Supabase project or a local Postgres instance that you configure via DATABASE_URL.
| Service | Port | Description |
|---|---|---|
mongodb | 27017 | MongoDB 7 used as the telemetry store for raw attempt events and AI job audit records |
localstack | 4566 | LocalStack 3 emulating AWS SQS and S3, enabling the full async pipeline without a real AWS account |
The
.env.example file shows DATABASE_URL pointing to a local Postgres on port :5433 (postgresql://postgres:innova_secret@localhost:5433/innova_dev_db). If you are using a Supabase project instead, replace this with your project’s connection string — the session pooler URL (port :5432) is fine for local migration work.Local SQS Consumer
The OCR → attempts reprocess loop requires an active consumer to drain theattempt-reprocess queue. In production this is a Lambda function triggered by SQS events. Locally, run the consumer script in a separate terminal:
scripts/local-reprocess-consumer.ts) polls the LocalStack SQS queue in a tight loop and processes each message the same way the Lambda worker does in production.
Common Commands
| Command | Description |
|---|---|
pnpm start:dev | Start the NestJS server with hot-reload (TypeScript watch mode) |
pnpm start:prod | Start the compiled server from dist/main (production binary) |
pnpm build | Compile the project with nest build for production bundling |
pnpm lint | Run ESLint with auto-fix across all source and test files |
pnpm format | Run Prettier across all src/**/*.ts and test/**/*.ts files |
pnpm test | Run all Jest unit tests |
pnpm test:watch | Run Jest in interactive watch mode |
pnpm test:cov | Run tests and generate a coverage report (CI gate: ≥ 75%) |
pnpm test:e2e | Run end-to-end tests (requires a test database; see test/jest-e2e.json) |
pnpm prisma studio | Open the Prisma database GUI in your browser |
pnpm prisma migrate dev --name <name> | Create and apply a new named Prisma migration |
pnpm consume:reprocess | Run the local SQS consumer for the attempt-reprocess queue |
pnpm seed:auth | Seed Supabase Auth demo users (requires ALLOW_SEED=1 and SEED_DEMO_PASSWORD) |
docker compose logs -f | Stream live logs from the MongoDB and LocalStack containers |
docker compose down -v | Stop all containers and delete named volumes (wipes local data) |