Node.js server deployment
Build for production
Run the build command from the project root. Nitro compiles the application and writes the output to the The
.output/ directory..output/ directory contains everything needed to run the application — no node_modules or source files are required on the server.Set production environment variables
Configure all required environment variables in your hosting environment. Do not copy your
See Environment variables for the complete reference.
.env file to the server — set variables directly through your platform’s interface or use a secrets manager.The seven variables read by nuxt.config.ts runtimeConfig are:| Variable | Required | Description |
|---|---|---|
DATABASE_URL | Yes | Production PostgreSQL connection string. |
JWT_SECRET | Yes | Secret for signing JWTs. Use 32+ random characters. |
CLOUDINARY_CLOUD_NAME | No | Cloudinary cloud name for photo uploads. |
CLOUDINARY_API_KEY | No | Cloudinary API key. |
CLOUDINARY_API_SECRET | No | Cloudinary API secret. |
NUXT_PUBLIC_TURNSTILE_SITE_KEY | Yes | Production Turnstile site key (browser-facing). |
TURNSTILE_SECRET_KEY | Yes | Production Turnstile secret key (server-side). |
Push database schema to production
Apply the Drizzle schema to your production database. Ensure This creates all tables defined in
DATABASE_URL is pointing to your production database before running this command.server/database/schema.ts if they do not already exist.Seed initial admin user (optional)
If you are setting up a fresh production database rather than migrating data from development, run the seed script to create the initial admin account.
Start the server
Start the production server using Node.js.The server listens on port
3000 by default. You can change this with the PORT environment variable.Vercel deployment
Vercel auto-detects Nuxt.js projects and configures the build pipeline automatically.-
Install the Vercel CLI:
-
Deploy to production from the project root:
- Add all environment variables in the Vercel dashboard under Settings → Environment Variables. Set them for the Production environment.
Vercel is the recommended platform when using Neon DB, as both are optimized for serverless connections. Neon’s serverless driver handles connection pooling automatically.
Environment variables in production
See Environment variables for the complete variable reference. Two variables require special attention for production:TURNSTILE_SECRET_KEYandNUXT_PUBLIC_TURNSTILE_SITE_KEYmust be keys registered in the Cloudflare Turnstile dashboard with your production domain. Keys registered forlocalhostwill not work in production, and test keys bypass verification entirely.JWT_SECRETmust be consistent across all instances if you run multiple replicas. Changing this value in production immediately invalidates all active sessions.
Security considerations
- Use a strong
JWT_SECRET— Generate at least 32 random characters. Useopenssl rand -base64 32to produce a cryptographically secure value. - Enable HTTPS — Secure cookies require HTTPS. Most platforms provide TLS automatically; if self-hosting, use a reverse proxy like Nginx or Caddy with a Let’s Encrypt certificate.
- Keep
DATABASE_URLprivate — The Neon connection string contains your database credentials. Only set it as a server-side environment variable — never expose it to the browser. - Set the Turnstile domain — In the Cloudflare Turnstile dashboard, configure the widget’s allowed domains to your production URL only.