GuidesNext.jsPostgreSQLdeployment

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.

R

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.

Start free

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-saas

Step 2: Add Prisma for database access

npm install prisma @prisma/client
npx prisma init

This 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 dev

Visit 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 deploy

That'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:

  1. Built your Next.js app in a container
  2. Provisioned a managed PostgreSQL database
  3. Set DATABASE_URL as an environment variable
  4. Ran npx prisma migrate deploy automatically
  5. Deployed with SSL, health checks, and auto-restart
  6. Set up a .raidframe.app subdomain

No Dockerfile needed. No separate database service. No YAML configuration.

How much does this cost?

StageUsersCost
Development0$0/mo
MVP launch1-100$0/mo
Growing100-1,000$0/mo (free tier)
Scaling1,000-10,000~$25-50/mo
Profitable SaaS10,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.

Start free

How do I add Redis?

rf add redis

Your 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.com

RaidFrame 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.com

Variables 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?

Deploy your Next.js app with a database today — start for free.

Next.jsPostgreSQLdeploymentfree hosting

Ship faster with RaidFrame

Auto-scaling compute, managed databases, global CDN, and zero-config CI/CD. Free tier included.