Deployment

Host Openfront Cannabis on Railway, Vercel, or your own Node host with PostgreSQL and S3-compatible storage.

What you need

  • Node.js 20 or later (Node 22 is recommended for Next.js 16).
  • PostgreSQL you are allowed to migrate.
  • S3-compatible object storage.
  • A secret store for environment variables.

Environment variables

VariableRequiredPurpose
DATABASE_URLAlwaysPostgreSQL connection string
SESSION_SECRETAlwaysAt least 32 characters; generate with openssl rand -hex 32
S3_BUCKET_NAME, S3_REGION, S3_ACCESS_KEY_ID, S3_SECRET_ACCESS_KEY, S3_ENDPOINTWhen NODE_ENV=productionKeystone file storage
SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASSWORD, SMTP_FROM, SMTP_STORE_LINKOptionalPassword-reset email
OPENROUTER_API_KEY, OPENROUTER_MODEL, OPENROUTER_MAX_TOKENSOptionalDashboard AI chat
AEROPAY_API_KEY, AEROPAY_API_SECRET, AEROPAY_MERCHANT_ID, AEROPAY_ENV, AEROPAY_BANK_ACCOUNT_ID, AEROPAY_WEBHOOK_SECRETOptionalAeropay bank payments, see Payment providers

Deploy

Provision services

Create the PostgreSQL database and the storage bucket. Back up the database before every upgrade.

Set variables

Set NODE_ENV=production and the variables above in your host's secret store. Never commit .env.

Build and migrate

The build is keystone build --no-ui && next build. Run npm run migrate (prisma migrate deploy) as a deploy or start step. Neither npm run dev nor npm run build applies migrations.

Start

Run npm start. Open /dashboard/init to create the first administrator, then complete onboarding.

Railway

railway.toml is included. Build is keystone build --no-ui && next build. Start is npm run migrate && next start, so migrations run on every start once the database is reachable.

Vercel

The README has a deploy button that prompts for DATABASE_URL, SESSION_SECRET and the S3 credentials. Add S3_ENDPOINT as well, and run npm run migrate against the production database.

Upgrades

  1. Back up the database.
  2. Pull the new source and run npm ci.
  3. Run npx keystone build --no-ui and npm run migrate.
  4. Restart. Use npm run migrate:gen only on a disposable development database.

On this page