Supabase
Quick Start
Open-source Firebase alternative with PostgreSQL
Cost: Supabase has a generous Free Tier: 500MB database, 2 projects, unlimited API requests. Free tier does NOT expire. Pro plan is $25/month for 8GB and unlimited projects. Unused projects can be paused to stay on free tier. Delete projects via the Supabase dashboard to stop charges.
What is Supabase?
Supabase is an open-source Firebase alternative built on PostgreSQL. It provides a hosted database, authentication, real-time subscriptions, storage, and edge functions - all with a generous free tier.
Perfect for Getting Started
Supabase is the fastest way to add a database to your Next.js app. No infrastructure to manage, built-in auth, and you can connect from anywhere - including your local machine during development.
Why Supabase with Fargate?
- Zero Database Management: No VPC configuration needed
- Built-in Auth: Skip Cognito for simpler projects
- Real-time: WebSocket subscriptions out of the box
- Free Tier: 500MB storage, 2 projects free
- Prisma Compatible: Use Prisma ORM with Supabase PostgreSQL
1. Create a Supabase Project
- Go to supabase.com and sign up
- Click New Project
- Choose a name and strong database password
- Select a region close to your Fargate deployment
2. Get Your Connection String
In your Supabase dashboard, go to Settings then Database, then find Connection string:
Bash
# .env
DATABASE_URL="postgresql://postgres.[project-ref]:[password]@aws-0-[region].pooler.supabase.com:6543/postgres?pgbouncer=true"
# For migrations (direct connection)
DIRECT_DATABASE_URL="postgresql://postgres.[project-ref]:[password]@aws-0-[region].pooler.supabase.com:5432/postgres"Use Pooler Connection
Always use the pooler connection (port 6543) for your application. Supabase has connection limits, and serverless/Fargate apps can quickly exhaust them.
3. Install Supabase Client
Terminal
$npm install @supabase/supabase-js
4. Create Supabase Client
TypeScript
// lib/supabase.ts
import { createClient } from '@supabase/supabase-js'
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL!
const supabaseKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
export const supabase = createClient(supabaseUrl, supabaseKey)Supabase Pricing
| Plan | Database | Price |
|---|---|---|
| Free | 500MB, 2 projects | $0 |
| Pro | 8GB, unlimited projects | $25/month |
| Team | Larger quotas, SOC2 | $599/month |