Skip to main content

Backend Environment

Set these variables in your local shell or in a local env file before running the backend. Env files must never be committed.

Server

VariableDefaultPurpose
PORT3333Listening port.
HOST127.0.0.1 in development, 0.0.0.0 in productionBind address.
NODE_ENVdevelopmentRuntime mode.
CORS_ORIGINhttp://localhost:5173Allowed browser origin.
TRUST_PROXYfalseSet to 1 behind an Nginx/PM2 reverse proxy.

Database

VariableRequiredPurpose
DATABASE_URLyes, for DB accessPostgres connection string, e.g. postgresql://postgres:postgres@localhost:5432/amadeq?schema=public.

Live demo

VariableDefaultPurpose
PIXEL_STREAM_URLunsetOptional; returned by /demo-config.
DEMO_MAX_CONNECTIONS10Concurrent demo connection cap.
DEMO_STATUSofflineOne of online, busy, offline.

Frontend redirects

VariableDefaultPurpose
FRONTEND_APP_URLhttp://localhost:5173Used for Stripe Checkout success/cancel redirects.

SMTP

Used by the contact form.

VariableDefaultPurpose
SMTP_HOST— (required)SMTP server.
SMTP_PORT587Use 465 for implicit TLS.
SMTP_USER— (required)SMTP auth user.
SMTP_PASS— (required)SMTP auth password.
SMTP_SECUREtrue when SMTP_PORT=465, otherwise falseImplicit TLS toggle.
SMTP_TLS_REJECT_UNAUTHORIZEDNode.js TLS verification defaultSet to false only for a local/dev SMTP server with a self-signed certificate chain. Production must use a trusted chain instead.
SMTP_FROMAMADEQ Partnerships <SMTP_USER>Sender address.
SMTP_TOpartnerships@amadeq.comRecipient address.

Stripe

VariablePurpose
STRIPE_SECRET_KEYRequired for payments.
STRIPE_WEBHOOK_SECRETRequired for webhook verification.
STRIPE_PRICE_EARLY_ACCESSStripe Price ID for the Individual plan.
STRIPE_PRICE_FOUNDERSStripe Price ID for the Founders plan.

See Stripe Checkout.

Upstream services

VariableDefaultPurpose
LIS_API_URL / LIS_API_KEYLIS chat gateway. The /api/lis proxy injects the key server-side as X-Api-Key; it is never exposed to the browser.
RENDER_API_URLVideo render worker. The /api/render proxy forwards the user's Bearer JWT.
WS_AGENT_API_URLhttps://ws-agent.nezlamna-online.educationDynamic-avatars service. The /api/ws-agent proxy derives user_id from the JWT and injects X-Api-Key + X-User-ID server-side.
WS_AGENT_API_KEYService secret for ws-agent. Sent as X-Api-Key, never exposed to the browser.
warning

WS_AGENT_API_KEY is a dedicated key, distinct from LIS_API_KEY. ws-agent protects /api/users/<id>/avatars with its own X-Api-Key and rejects the LIS key with 401.

Prisma workflow

Before changing prisma/schema.prisma, read Database Migrations.

This project uses a shared Neon Postgres database with all app tables in the non-default web schema. Do not run npx prisma migrate dev, --create-only, or npx prisma db push against that database: none of them is a safe migration workflow here.

The approved flow is: update the schema, hand-write a schema-qualified migration, apply it with prisma migrate deploy using the required search_path URL option, run npx prisma generate, then restart the backend. The full commands and verification steps are maintained in Database Migrations.