Skip to main content

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.

All configuration is loaded at application boot via @nestjs/config and validated before the NestJS module graph is assembled — a missing required variable causes a hard startup failure rather than a silent runtime error. Never commit a .env file to source control. Use .env.example as your template: copy it to .env, fill in the values for your environment, and keep secrets out of version control.

Database

DATABASE_URL
string
required
Supabase Postgres connection string used by Prisma. In local development point this at a local Postgres instance (the .env.example default is postgresql://postgres:innova_secret@localhost:5433/innova_dev_db?schema=public). In production you must use the Supabase transaction pooler on port :6543 with the PgBouncer flags appended.
MONGODB_URI
string
required
MongoDB Atlas (or local Mongo) connection string for the telemetry store. Example: mongodb://root:innova_mongo_secret@localhost:27017/innova_telemetry_local?authSource=admin. In production, use the Atlas SRV URI.
In production, DATABASE_URL must use the Supabase transaction pooler (port :6543) and include the query-string flags ?pgbouncer=true&connection_limit=1. Prisma in a serverless environment opens a new connection on every cold start; without these flags you will exhaust the Postgres connection limit instantly.
DATABASE_URL="postgresql://postgres.<ref>:<password>@aws-0-us-east-1.pooler.supabase.com:6543/postgres?pgbouncer=true&connection_limit=1&schema=public"

Supabase Auth

SUPABASE_URL
string
required
Your project’s Supabase base URL, e.g. https://<project-ref>.supabase.co. Used to validate JWKS tokens and by the service-role client.
SUPABASE_SERVICE_ROLE_KEY
string
required
The server-only service role key from your Supabase project dashboard. This key bypasses Row Level Security and must never be exposed to the browser or a public client.
SUPABASE_ANON_KEY
string
The public anon key from your Supabase project dashboard. Optional in most server-side contexts but required for any endpoint that needs to act on behalf of an anonymous caller.

AWS

AWS_REGION
string
required
AWS region where all resources are provisioned. The canonical value for this project is us-east-1. Must match the region in serverless.yml.
SQS_ATTEMPT_STREAM_URL
string
required
URL of the FIFO telemetry queue (attempt-stream.fifo). Every ingested attempt is published here for durable, ordered delivery to the telemetry worker that persists events to MongoDB.
SQS_LLM_CLASSIFY_URL
string
required
URL of the standard LLM classification queue. Attempts the rule engine cannot classify are forwarded here for async classification by Claude in innova-ai-engine.
SQS_OCR_QUEUE_URL
string
required
URL of the OCR queue. Student photo submissions are pushed here and processed by the OCR worker backed by Gemini.
SQS_ATTEMPT_REPROCESS_URL
string
required
URL of the attempt-reprocess queue. After OCR, graded submission results are reprocessed here to create Attempt records and trigger BKT updates.
SQS_GUIDE_INGEST_URL
string
URL of the guide-ingest queue (v9 guides pipeline). Required in production for the teacher-worksheet flow. The consumer lives in innova-ai-engine.
SQS_SOLUTION_GEN_URL
string
URL of the solution-generation queue (v9 guides pipeline). Required in production; triggers Claude to produce step-by-step solution keys for each guide question.
SQS_SUBMISSION_GRADE_URL
string
URL of the submission-grading queue (v9 guides pipeline). Required in production; triggers the submission grader worker in innova-ai-engine.
SQS_ADHOC_SOLVE_URL
string
URL of the ad-hoc solve queue (v9 guides pipeline). Required in production for on-demand single-question solve requests. The consumer lives in innova-ai-engine.
EXERCISE_GENERATE_QUEUE_URL
string
URL of the exercise-generation queue. Required in production; triggers the innova-ai-engine worker that generates new exercises on demand when a teacher requests LLM-authored items.
S3_GUIDES_BUCKET
string
Name of the S3 bucket that stores teacher worksheet PDFs. Required in production. Example: innova-backend-serverless-prod-guides.
S3_SUBMISSIONS_BUCKET
string
Name of the S3 bucket that stores student photo submissions. Required in production. Example: innova-submissions-prod.
GUIDES_PRESIGNED_PUT_TTL
string
Lifetime in seconds for presigned PUT URLs used when uploading worksheet PDFs to S3. Defaults to 600 (10 minutes) if not set.
GUIDES_PRESIGNED_GET_TTL
string
Lifetime in seconds for presigned GET URLs used when serving worksheet PDFs from S3. Defaults to 300 (5 minutes) if not set.
When running locally with docker compose up -d, LocalStack emulates both SQS and S3 on port 4566. Set your queue URLs to the LocalStack endpoint format so the async pipeline works without a real AWS account:
SQS_ATTEMPT_STREAM_URL="http://localhost:4566/000000000000/innova-backend-serverless-dev-attempt-stream.fifo"
SQS_LLM_CLASSIFY_URL="http://localhost:4566/000000000000/innova-backend-serverless-dev-llm-classify-queue"
SQS_OCR_QUEUE_URL="http://localhost:4566/000000000000/innova-backend-serverless-dev-ocr-queue"
SQS_ATTEMPT_REPROCESS_URL="http://localhost:4566/000000000000/innova-backend-serverless-dev-attempt-reprocess-queue"

AI Providers

ANTHROPIC_API_KEY
string
API key for Anthropic Claude. Required in production for LLM classification (unclassified errors), solution-key generation, and submission grading. Leave blank locally to skip these features.
GEMINI_API_KEY
string
API key for Google Gemini. Required in production for the OCR worker that transcribes student handwritten photos. Leave blank locally if you are not exercising the OCR pipeline.

Email

RESEND_API_KEY
string
Resend API key for transactional email. Required in production for password-recovery flows. Can be left blank in development to skip email sending entirely.
RESEND_FROM_EMAIL
string
The From address used on all outgoing emails. Must be a verified sender domain in your Resend account. Example: Innova <no-reply@superprofes.app>.

Application

PUBLIC_APP_URL
string
Public browser-facing URL of the main web application. Used in email links and redirects. Production value: https://superprofes.app.
PUBLIC_API_URL
string
Public URL of this API. Used in self-referencing links and email templates. Production value: https://api.superprofes.app.
PUBLIC_PRACTICE_URL
string
Public URL of the student practice application. Used in email links and redirects. Production value: https://practica.superprofes.app. Corresponds to the PUBLIC_PRACTICE_URL key injected into Lambda by serverless.yml.
CORS_ORIGINS
string
Comma-separated list of browser origins that are allowed to make cross-origin requests to the API. Production example: https://superprofes.app,https://app.superprofes.app. In development: http://localhost:3001,http://localhost:3002,http://localhost:3004,http://localhost:8081.
LOG_LEVEL
string
Pino log level threshold. Accepted values: debug, info, warn. Defaults to info when not set. Use debug locally to see detailed request traces.

Build docs developers (and LLMs) love