Production deployment
The production site is split across three services.
| Part | Where | What runs there |
|---|---|---|
| Web app and API | Vercel (www.mutatelab.fun) | Next.js pages and API routes |
| Postgres, Redis and the worker | Railway | Data, the job queue and background jobs (image generation, round settlement, transaction reconciliation) |
| Uploaded and generated images | Vercel Blob (private store) | Content-addressed image files |
The web app and the worker must point at the same Postgres, Redis and Blob store.
Environment variables
Set these on both Vercel (Production) and the Railway worker unless noted.
| Variable | Notes |
|---|---|
DATABASE_URL | Railway Postgres. Vercel uses the public connection URL; the worker can use the private one |
DATABASE_POOL_MAX | Connections per instance. Default 5. Keep it low on Vercel: each serverless instance opens its own pool |
REDIS_URL | Railway Redis (public URL on Vercel, private on the worker) |
BLOB_READ_WRITE_TOKEN | The Blob store's token. Without it, images are written to local disk and are lost on Vercel |
APP_URL, NEXT_PUBLIC_APP_URL | https://www.mutatelab.fun, no trailing slash |
PUBLIC_METADATA_BASE_URL | https://www.mutatelab.fun; token metadata URLs are built from it |
SOLANA_CLUSTER, SOLANA_RPC_URLS, NEXT_PUBLIC_SOLANA_RPC_URL | Chain access. Use a dedicated RPC rather than the public endpoint |
PROTOCOL_METADATA_AUTHORITY | The protocol wallet's public key. Required to prepare a launch |
PROTOCOL_METADATA_AUTHORITY_KEYPAIR | That wallet's secret key (JSON byte array). Sensitive. Needed to execute Forge identity upgrades |
TRUST_PROXY | true on Vercel, so rate limits use each visitor's real address instead of one shared key. Vercel only |
DBC_MIGRATION_QUOTE_THRESHOLD | Devnet only, SOL pair only: graduation target in SOL, skipping the Jupiter price lookup. Currently 2. Remove it (and set a Jupiter price key) for USDC, stock pairs and mainnet |
MUTATE_*, TREASURY_*, DBC_MIGRATION_USD_TARGET | As in .env.example |
Signing keys: the protocol metadata authority (signs Forge identity upgrades) and the treasury executor (signs buybacks) can be given as environment secrets, since Vercel and Railway have no key files. Set PROTOCOL_METADATA_AUTHORITY_KEYPAIR and TREASURY_EXECUTOR_KEYPAIR to the JSON array of 64 secret-key bytes (or that JSON base64 encoded), and store them as sensitive variables. The secret wins over the *_KEYPAIR_PATH file path used in local development. The key must match PROTOCOL_METADATA_AUTHORITY. Launching a token only needs the public key.
Railway
The project is mutate in the Cool Hurricane workspace, with three services in the production environment: Postgres, Redis and worker. Everything is in the sfo region, and vercel.json pins the Vercel functions to sfo1 so queries stay close to the database.
- Databases. Add Postgres and Redis. Because Vercel is outside Railway's private network, turn on Public Access for each in its Settings, then click Deploy to apply it. This sets
DATABASE_PUBLIC_URLandREDIS_PUBLIC_URL. - Worker. The worker is a service with no GitHub link; deploy it from this folder with
railway up --service worker. Railway's builder (Railpack) detects a Next.js app, so these variables on the worker override that:RAILPACK_BUILD_CMD=echo skip-next-buildskips the website build.RAILPACK_START_CMD=npm run start:workerapplies pending migrations, then starts the worker (start:workerinpackage.json)..railwayignorekeeps local data, tests and the Rust files out of the upload (the rootCargo.tomlotherwise makes Railway try to build a Rust app).
- Worker variables.
DATABASE_URL=${{Postgres.DATABASE_URL}}andREDIS_URL=${{Redis.REDIS_URL}}(the private network), plus the shared variables in the table above. - Vercel variables.
DATABASE_URLis the public Postgres URL with?sslmode=no-verifyappended (the connection is encrypted; Railway's certificate is self-signed so it is not verified).REDIS_URLis the public Redis URL.DATABASE_POOL_MAX=3.
railway.toml and railpack.json record the start command, restart policy and the Node provider (the root Cargo.toml would otherwise make Railway try to build a Rust app). Both point at npm run start:worker.
The worker service is connected to the GitHub repository (coolhurricane/mutate, branch main), so every push to main redeploys it, the same way Vercel redeploys the site. A manual deploy from a local folder is still possible with railway up --service worker --detach.
Public Access means anyone with the connection string can reach the database, so the string stays secret (Vercel stores it as a sensitive variable) and the password is the generated one. Public traffic is billed as egress.
Vercel Blob
Create a private Blob store for the project and connect it, which adds BLOB_READ_WRITE_TOKEN to Vercel. Copy the same token to Railway. Uploads are stored as uploads/<sha256>-<owner>.<ext> and served through /api/media/[id], never from a public blob URL.
First deploy checklist
- Migrations applied to the Railway database (the worker does this on every start).
curl https://www.mutatelab.fun/api/statusreturns healthy.- Upload artwork in the incubator and confirm it renders after a refresh (proves Blob works).
- The worker log shows it connected to Redis and is waiting for jobs.
- Launch a test token on devnet and watch the worker reconcile it.
Notes
The devnet protocol wallet was generated for testing; its key is also saved at
~/.mutate/protocol-authority-devnet.jsonon the machine that created it (owner-only permissions). Use a separately generated and securely stored key for mainnet.Redis must be a real Redis (BullMQ uses blocking commands and long-lived connections). A serverless Redis that bills per command will be expensive.
The public devnet RPC rate limits aggressively. A dedicated RPC is strongly recommended before real traffic.
Back up the Railway Postgres. Generation history is append-only and is the permanent record.