Deploy Next.js + Postgres for Free
Deploy a full-stack Next.js app with a PostgreSQL database on RaidFrame for $0. Step-by-step guide with code examples — from localhost to production in 5 minutes.
RaidFrame Team
December 12, 2025 · 5 min read
TL;DR — You can deploy a full-stack Next.js app with a managed PostgreSQL database on RaidFrame for free. No credit card. No splitting your app across Vercel + Neon + a separate Redis service. One platform, one command: rf deploy.
What you'll build
A production-ready Next.js application with:
- Server-side rendering and API routes
- A managed PostgreSQL database
- Environment variables and secrets
- SSL and a custom domain
- Auto-scaling when traffic grows
Total cost: $0 until you need to scale.
Why this matters
Most guides tell you to deploy Next.js on Vercel and your database on Supabase or Neon. That means managing two services, two billing accounts, and connection issues between them.
On RaidFrame, your app and database live on the same platform. No cross-service latency. No juggling credentials across providers. No surprise bills from AI bots hitting your Vercel functions.
Try RaidFrame free
Deploy your first app in 60 seconds. No credit card required.
Prerequisites
- Node.js 18+ installed
- A GitHub account
- A RaidFrame account (sign up free)
Step 1: Create a Next.js app
npx create-next-app@latest my-saas --typescript --tailwind --app
cd my-saasStep 2: Add Prisma for database access
npm install prisma @prisma/client
npx prisma initThis creates a prisma/schema.prisma file. Update it:
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
model User {
id String @id @default(cuid())
email String @unique
name String?
createdAt DateTime @default(now())
}Step 3: Create an API route
Create src/app/api/users/route.ts:
import { PrismaClient } from "@prisma/client";
import { NextResponse } from "next/server";
const prisma = new PrismaClient();
export async function GET() {
const users = await prisma.user.findMany();
return NextResponse.json(users);
}
export async function POST(request: Request) {
const { email, name } = await request.json();
const user = await prisma.user.create({
data: { email, name },
});
return NextResponse.json(user, { status: 201 });
}Step 4: Test locally
# Start a local Postgres (Docker)
docker run -d --name pg -e POSTGRES_PASSWORD=dev -p 5432:5432 postgres:16
# Set the connection string
echo 'DATABASE_URL="postgresql://postgres:dev@localhost:5432/mydb"' > .env
# Run migrations
npx prisma migrate dev --name init
# Start the app
npm run devVisit http://localhost:3000 — your app is running with a real database.
Step 5: Deploy to RaidFrame
# Install the RaidFrame CLI
npm install -g @raidframe/cli
# Login
rf login
# Initialize your project
rf init
# Deploy — this creates your app AND a managed Postgres database
rf deployThat's it. RaidFrame detects your Next.js app, provisions a managed PostgreSQL instance, runs your Prisma migrations, and deploys everything with SSL.
Your app is live at my-saas.raidframe.app.
What just happened?
In one command, RaidFrame:
- Built your Next.js app in a container
- Provisioned a managed PostgreSQL database
- Set
DATABASE_URLas an environment variable - Ran
npx prisma migrate deployautomatically - Deployed with SSL, health checks, and auto-restart
- Set up a
.raidframe.appsubdomain
No Dockerfile needed. No separate database service. No YAML configuration.
How much does this cost?
| Stage | Users | Cost |
|---|---|---|
| Development | 0 | $0/mo |
| MVP launch | 1-100 | $0/mo |
| Growing | 100-1,000 | $0/mo (free tier) |
| Scaling | 1,000-10,000 | ~$25-50/mo |
| Profitable SaaS | 10,000+ | ~$100-200/mo |
Compare that to Vercel Pro ($20/user/mo) + Neon ($19/mo) + Redis ($25/mo) = $64+/mo before you have a single paying customer.
Try RaidFrame free
Deploy your first app in 60 seconds. No credit card required.
How do I add Redis?
rf add redisYour REDIS_URL environment variable is automatically set. Use it in your app:
import { createClient } from "redis";
const redis = createClient({ url: process.env.REDIS_URL });
await redis.connect();How do I add a custom domain?
rf domains add myapp.comRaidFrame provisions an SSL certificate automatically. Point your DNS A record to the IP shown in the CLI output.
How do I set environment variables?
rf env set STRIPE_SECRET_KEY sk_live_xxx
rf env set NEXT_PUBLIC_APP_URL https://myapp.comVariables are encrypted at rest and injected at runtime. Never committed to your repo.
FAQ
Can I use App Router and Server Components?
Yes. RaidFrame runs your Next.js app as a Node.js server, not serverless functions. All Next.js features work — App Router, Server Components, Server Actions, middleware, ISR, streaming.
Is the database really free?
Yes. The free tier includes a managed PostgreSQL instance with 256 MB storage. That's enough for tens of thousands of rows. When you need more, upgrade to Pro.
What happens if my app gets traffic?
RaidFrame auto-scales your app. If you're on the free tier, your app runs on a single instance. On Pro, it scales from 2 to 20 instances based on CPU and response time.
Can I use Prisma, Drizzle, or raw SQL?
All of them. RaidFrame gives you a standard PostgreSQL connection string. Use whatever ORM or query builder you prefer.
How is this different from Vercel + Neon?
On Vercel, your frontend runs as serverless functions with cold starts. Your database is on a separate service with its own billing. On RaidFrame, everything runs on the same platform — no cold starts, no cross-service latency, no split billing.
What's next?
- Add Stripe payments to your SaaS
- Scale your database to 1M queries/sec
- Set up CI/CD for zero-downtime deploys
Deploy your Next.js app with a database today — start for free.
Ship faster with RaidFrame
Auto-scaling compute, managed databases, global CDN, and zero-config CI/CD. Free tier included.