Buildml is designed to run on standard cloud infrastructure. The Next.js application can be deployed to Vercel or any Node.js-capable host, while the FastAPI executor runs as an isolated Docker service. This page covers every required external service, the full environment variable reference, and a production readiness checklist.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Praashh/buildml/llms.txt
Use this file to discover all available pages before exploring further.
Architecture Overview
A production Buildml deployment spans five infrastructure components that communicate over HTTPS:Required Services
PostgreSQL
Buildml uses Prisma with the@prisma/adapter-pg driver. Any standard PostgreSQL 14+ instance works.
Recommended managed providers:
- Neon — serverless PostgreSQL, generous free tier
- Supabase — PostgreSQL with additional tooling
- Railway — simple provisioning, good for small teams
- Self-hosted PostgreSQL via Docker
Upstash Redis
Redis serves two purposes: rate limiting (enforced on every submission) and ephemeral run result caching (results from the Run action are written here and polled by the client). Create a Redis database at Upstash Console and copy the REST URL and token.Upstash QStash
QStash is the async job queue. When a user submits code, the Next.js tRPC handler publishes a message to QStash, which then delivers it to theapi/webhooks/process-submission/ endpoint. This keeps the HTTP response fast and moves execution off the request thread. Create a QStash instance in the same Upstash Console.
Google OAuth App
Buildml uses NextAuth.js v5 with the Google provider for authentication. Create an OAuth 2.0 client in Google Cloud Console:- Navigate to APIs & Services → Credentials → Create Credentials → OAuth client ID.
- Set the application type to Web application.
- Add
https://your-domain.com/api/auth/callback/googleas an authorised redirect URI. - Copy the Client ID and Client Secret.
FastAPI Executor Service
The executor is a separate Python service distributed as a Docker image. It receives a JSON payload containing user code and problem metadata, runs the code in a sandboxed environment, and returns a structured result. Deploy it behind a private network or a shared secret — it must not be publicly accessible without authentication. SetEXECUTOR_SECRET to a strong random string and ensure the executor validates the same secret on every request.
Environment Variable Reference
All variables are validated at startup by@t3-oss/env-nextjs (via src/env.js). A missing or malformed required variable will produce a clear startup error rather than a silent runtime failure. Import and use env from ~/env.js in application code — never access process.env directly.
Full PostgreSQL connection string. Prisma uses this to connect via
@prisma/adapter-pg.Random secret string used by NextAuth.js v5 to sign session tokens and cookies. In Generate a secure value with:
src/env.js this variable is named NEXTAUTH_SECRET and is read from process.env.NEXTAUTH_SECRET. Required in production — omitting it will cause a startup error.The
.env.example file in the repository shows this variable as AUTH_SECRET, but the application code (src/env.js, src/server/auth/config.ts, src/middleware.ts) reads process.env.NEXTAUTH_SECRET. Set the variable as NEXTAUTH_SECRET in your environment.OAuth 2.0 Client ID from Google Cloud Console. Used by the NextAuth.js Google provider.
OAuth 2.0 Client Secret from Google Cloud Console. Keep this value out of version control.
Upstash Redis REST endpoint URL. Found on the database detail page in the Upstash Console.
Upstash Redis REST token. Used alongside the URL to authenticate every Redis call from the application.
QStash publish token. The application uses this to enqueue new code execution jobs to the QStash API.
QStash webhook signing key (current). Used by the
api/webhooks/process-submission/ handler to verify that incoming webhook requests genuinely originate from QStash and have not been tampered with.QStash webhook signing key (next). QStash rotates signing keys; providing both the current and next key ensures zero-downtime key rotation without dropped webhooks.
The fully-qualified public URL of your Next.js application. In
src/env.js, the internal DEPLOYMENT_URL variable is populated from process.env.NEXT_PUBLIC_DEPLOYMENT_URL. QStash uses this value to construct the webhook callback URL.The URL of the FastAPI executor service. The webhook handler posts code execution payloads to
EXECUTOR_URL/execute. In production, this should be an internal network address or a private hostname — not a public URL.Shared secret sent with every request from the Next.js webhook handler to the executor. The executor must validate this value on each request. Change the default
dev-secret value before deploying to production.Node environment. Set to
production in production deployments. When NODE_ENV is production, NEXTAUTH_SECRET becomes strictly required (it is optional in development).Set to
true to skip Zod validation of environment variables at build time. Useful for Docker builds and CI pipelines that run next build without a live database or secrets available.Production Checklist
Provision all required services
Ensure you have active instances of PostgreSQL, Upstash Redis, and Upstash QStash, and that your Google OAuth app has the correct production redirect URI configured.
Set all environment variables
Configure every variable listed above in your deployment environment (Vercel environment settings, Docker secrets, etc.). Do not leave any required field blank in production. Remember to use
NEXTAUTH_SECRET (not AUTH_SECRET) and NEXT_PUBLIC_DEPLOYMENT_URL (not DEPLOYMENT_URL).Run database migrations
Apply the Prisma schema to your production PostgreSQL instance. Use Alternatively, to create a migration file without applying it (for review before deploy), use:
db:generate to create and apply a versioned migration (runs prisma migrate dev) rather than db:push, which is for local prototyping only:Deploy the FastAPI executor
Build and start the executor Docker image. Ensure it:
- Is not exposed on a public port without authentication.
- Reads and validates
EXECUTOR_SECRETon every inbound request. - Is reachable from the Next.js application at the address you set in
EXECUTOR_URL.
Deploy the Next.js application
Deploy to Vercel or your Node.js host. On Vercel, environment variables are set under Project → Settings → Environment Variables.For Docker builds or CI pipelines that run
next build without a live database, set the skip flag to bypass env validation:Configure QStash webhook URL
In the Upstash Console, verify that QStash is configured to deliver messages to:This URL must match the value derived from
NEXT_PUBLIC_DEPLOYMENT_URL in your environment.