From v0 prototype to production database in 5 minutes
Published: May 17, 2026
Category: AI · Next.js · Databases
Reading time: 8 minutes
Author: NEXUS AI Team
v0 by Vercel generates a beautiful React component in 60 seconds. Lovable, Bolt, and Replit do the same for whole frontends. The result looks production-ready in the browser.
Then you try to save a user. There is no database. There is no auth backend. There is no file storage. The "deploy" button shipped a frontend with a fetch call pointed at a URL that does not exist yet.
This is the deploy gap for prototyping tools, and it is where most teams either give up or end up wiring three SaaS dashboards together. This post shows the third path: take the v0 prototype, give it a real Postgres backend, attach a bucket for uploads, and have the whole stack running in about 5 minutes.
For the broader picture of why AI-generated apps need a different deploy story, see Your AI app is generated. Now how do you deploy it?.
What v0 (and friends) actually ship
The current generation of AI prototyping tools ship a Next.js frontend with hard-coded data, or wire it to a serverless route file with mock responses. You can run it locally. You can deploy the frontend to Vercel. What you do not get out of the box:
- A managed database with persistence (Postgres, MySQL, Mongo).
- An object store for image uploads, model artifacts, or generated assets.
- A background worker for async tasks.
- Secrets management for API keys.
- Backups and a restore path.
- Logs you can stream.
For a real app you need all of these. For an AI-built side project you usually need at least the first two.
Three ways to add a real backend
Vercel Postgres + Vercel KV. Convenient if your frontend is already on Vercel. Adds a second billing line, a separate IAM model, and locks the data to Vercel's region story. No background workers.
Bring-your-own Supabase, Neon, or PlanetScale. Best-in-class managed databases. You still own the wiring between the database, your frontend, your storage provider (separate again), your queue provider (separate again), and your secrets vault. Three dashboards minimum, sometimes five.
NEXUS AI. One deploy gives you a containerized backend, a managed Postgres, optional Redis, an S3-compatible bucket, encrypted secrets, backups, scaling, and a public URL. One dashboard. One CLI. One MCP server your AI agent can drive end-to-end.
This post walks through the third path because the others are well documented elsewhere.
Step 1: export the v0 frontend
v0 already supports Add to codebase. Push the result to a GitHub repo. The frontend will look something like:
my-v0-app/
app/
layout.tsx
page.tsx
api/
users/
route.ts ← currently returns mock data
uploads/
route.ts ← currently returns a fake URL
package.json
next.config.js
The two route files are where we replace the mocks. We will leave them in the same Next.js app rather than building a separate Express backend. v0 + Next.js + Postgres + S3 is a complete production stack on its own.
Step 2: wire the route handlers to real services
Update app/api/users/route.ts to talk to Postgres:
import { NextResponse } from "next/server";
import { Pool } from "pg";
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
export async function GET() {
const { rows } = await pool.query(
"SELECT id, email, created_at FROM users ORDER BY created_at DESC LIMIT 50"
);
return NextResponse.json(rows);
}
export async function POST(req: Request) {
const { email } = await req.json();
const { rows } = await pool.query(
"INSERT INTO users (email) VALUES ($1) RETURNING id, email, created_at",
[email]
);
return NextResponse.json(rows[0]);
}
Update app/api/uploads/route.ts to push to the S3-compatible bucket NEXUS AI provisions:
import { NextResponse } from "next/server";
import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3";
import { randomUUID } from "crypto";
const s3 = new S3Client({
endpoint: process.env.S3_ENDPOINT,
region: process.env.S3_REGION || "us-east-1",
forcePathStyle: true,
credentials: {
accessKeyId: process.env.S3_ACCESS_KEY!,
secretAccessKey: process.env.S3_SECRET_KEY!,
},
});
export async function POST(req: Request) {
const form = await req.formData();
const file = form.get("file") as File;
const key = `${randomUUID()}-${file.name}`;
const body = Buffer.from(await file.arrayBuffer());
await s3.send(
new PutObjectCommand({
Bucket: process.env.S3_BUCKET!,
Key: key,
Body: body,
ContentType: file.type,
})
);
return NextResponse.json({ key, url: `${process.env.S3_ENDPOINT}/${process.env.S3_BUCKET}/${key}` });
}
Add a tiny migration that creates the users table. Put it in db/init.sql:
CREATE TABLE IF NOT EXISTS users (
id serial PRIMARY KEY,
email text NOT NULL UNIQUE,
created_at timestamptz NOT NULL DEFAULT now()
);
Commit and push.
Step 3: deploy the whole stack with one command
Install the NEXUS AI CLI:
curl -fsSL https://nexusai.run/install.sh | bash # Linux
curl -fsSL https://nexusai.run/install-mac.sh | bash # macOS
nexus auth login
Deploy the app, Postgres, and a bucket:
nexus deploy source \
--repo https://github.com/you/my-v0-app.git \
--name my-v0-app \
--provider docker \
--framework nextjs \
--services postgresql \
--wait
Create and attach a bucket for uploads:
nexus bucket create user-uploads --display-name "User uploads"
nexus bucket attach <bucket-id> <deployment-id>
nexus deploy redeploy <deployment-id> --wait
The platform builds the Next.js production image, provisions a Postgres 15 container with a persistent volume, generates a scoped per-bucket IAM service account, injects the environment variables (DATABASE_URL, S3_ENDPOINT, S3_BUCKET, S3_ACCESS_KEY, S3_SECRET_KEY), opens a public HTTPS URL through Traefik, and starts streaming logs.
Run the schema migration:
nexus db query <postgres-service-id> --file db/init.sql
Step 4: verify the full path
Hit the deployed URL:
curl -X POST https://your-app.nexusai.run/api/users \
-H "Content-Type: application/json" \
-d '{"email":"first@example.com"}'
curl https://your-app.nexusai.run/api/users
Expected response on the GET:
[
{
"id": 1,
"email": "first@example.com",
"created_at": "2026-05-17T03:14:22.117Z"
}
]
Upload a file:
curl -X POST https://your-app.nexusai.run/api/uploads \
-F "file=@./avatar.png"
Expected response:
{
"key": "9b4e2a01-avatar.png",
"url": "https://minio.nexusai.run/user-uploads/9b4e2a01-avatar.png"
}
You now have a v0-generated frontend talking to a real Postgres and a real S3 bucket. No third dashboard.
Step 5: take the first backup
The first ops habit worth installing on day one is backups. Take a snapshot:
nexus db services my-v0-app
nexus db backup <postgres-service-id>
nexus db backups <postgres-service-id>
Schedule recurring backups:
nexus db backup-schedule <postgres-service-id> --cron "0 3 * * *" # daily at 3am UTC
Backups are encrypted, retained per your plan limits, and downloadable on demand:
nexus db backup-download <postgres-service-id> <backup-id> --out ./dump.sql
Or share with a teammate via a signed URL with a 30-second to 1-hour TTL:
nexus db backup-download <postgres-service-id> <backup-id> --share --ttl 600
Step 6: scale when the prototype takes off
The day the post hits the front page of Hacker News:
nexus deploy scale my-v0-app 5
The Next.js app scales to 5 replicas behind the load balancer. Postgres and the bucket stay as the single source of truth for state. The frontend layer is stateless, so scaling horizontally is safe.
When traffic dies down:
nexus deploy scale my-v0-app 1
Why one platform instead of three
Every additional vendor in the path between your code and your data adds three costs you do not see on day one:
- Operational tax. Each dashboard needs a login, a billing setup, an IAM model, and a backup story. Each is a place a breach or an expired credit card can stop your app.
- Latency. Database in one region, object store in another, frontend on edge: each network hop is real milliseconds on every request.
- Recovery surface. When something breaks you debug across vendor boundaries. Slack threads with five companies' support teams resolve slower than one ticket with one provider.
Consolidating the backend into one platform does not preempt best-of-breed choices later. You can run NEXUS AI as the prototype platform and migrate the database to a dedicated provider after product-market fit. nexus db backup-download gives you a portable Postgres dump whenever you want to leave.
Patterns that scale beyond v0
The same pattern works for Lovable, Bolt, Replit, and any framework v0 supports:
-
Lovable. Push the Lovable export to GitHub, deploy with
--framework nextjsor--framework vite, attach Postgres and a bucket. - Bolt.new. Same flow. Bolt generates standalone Next.js or Vite projects.
- Replit. Connect your Replit GitHub mirror, deploy with the appropriate framework flag.
- Claude Code or Cursor generated apps. Direct push, direct deploy. Claude Code can also call the NEXUS AI MCP tools and deploy itself (see MCP-driven deploys).
The deploy command stays the same. The only thing that changes is the framework flag.
FAQ
Does v0 work with NEXUS AI directly?
v0 generates a Next.js project. NEXUS AI deploys Next.js projects from any Git repository. There is no special integration required. Push to GitHub, run nexus deploy source --framework nextjs.
Do I need to write a Dockerfile?
No. NEXUS AI detects Next.js and generates a multi-stage production Dockerfile (build with npm run build, run with node server.js or next start as appropriate).
Can I keep my frontend on Vercel and put only the backend on NEXUS AI?
Yes. Deploy just an API service (nexus deploy source --framework express for a standalone Express backend, or a Next.js app with only app/api/ routes used). Point your Vercel frontend at the NEXUS AI URL via NEXT_PUBLIC_API_URL. You get Vercel's CDN and NEXUS AI's stateful backend.
Does Postgres survive container restarts?
Yes. The Postgres data lives on a persistent volume attached to the deployment. Volumes survive container restarts, redeploys, and host reboots. See How NEXUS AI keeps your Postgres alive across host reboots for the implementation details.
What about authentication?
NEXUS AI does not ship a managed auth provider. Use Auth.js (NextAuth), Clerk, or Supabase Auth from your Next.js app. The auth provider stores session state in your NEXUS AI Postgres or Redis service.
Can my AI agent run all of this for me?
Yes. Connect the NEXUS AI MCP server to Claude Code, Cursor, or another MCP client. The agent calls nexusai_deploy_source, nexusai_bucket_create, nexusai_bucket_attach, and nexusai_db_query to do everything in this post end-to-end. See MCP-driven deploys for the 60-second setup.
The deploy gap from v0 prototype to production app used to be the bottleneck. With one CLI command and one platform it collapses to about 5 minutes.
Top comments (0)