Kanba now supports optional PostgreSQL as an alternative to Supabase for local development and self-hosted deployments. This guide will help you set up and use PostgreSQL with Kanba.
-
Start PostgreSQL with Docker:
npm run postgres:start
-
Configure environment:
cp env.example .env.local
Edit
.env.localand set:DATABASE_PROVIDER=postgresql DATABASE_URL=postgresql://postgres:password@localhost:5432/kanba_db
-
Setup database:
npm run postgres:setup
-
Start development server:
npm run dev
-
Install PostgreSQL:
- macOS:
brew install postgresql - Ubuntu/Debian:
sudo apt install postgresql postgresql-contrib - Windows: Download from postgresql.org
- macOS:
-
Create database:
createdb kanba_db
-
Configure environment:
cp env.example .env.local
Edit
.env.localand set:DATABASE_PROVIDER=postgresql DATABASE_URL=postgresql://username:password@localhost:5432/kanba_db
-
Setup database:
npm run postgres:setup
- Node.js 18+ and npm
- PostgreSQL 13+ (or Docker)
- Git
-
Install dependencies:
npm install
-
Install Prisma CLI:
npm install -g prisma
Copy env.example to .env.local and configure:
# Database Configuration
DATABASE_PROVIDER=postgresql # or 'supabase'
# PostgreSQL Configuration
DATABASE_URL=postgresql://username:password@localhost:5432/kanba_db
# Supabase Configuration (fallback)
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_key# Local PostgreSQL
DATABASE_URL=postgresql://postgres:password@localhost:5432/kanba_db
# Docker PostgreSQL
DATABASE_URL=postgresql://postgres:password@localhost:5432/kanba_db
# Railway PostgreSQL
DATABASE_URL=postgresql://username:password@host:port/database
# Supabase PostgreSQL
DATABASE_URL=postgresql://postgres:[password]@[host]:[port]/postgresRun the setup script:
npm run postgres:setupThis will:
- Generate Prisma client
- Push schema to database
- Run migrations
- Seed database (if available)
-
Generate Prisma client:
npm run db:generate
-
Push schema to database:
npm run db:push
-
Run migrations (if any):
npm run db:migrate
# Start PostgreSQL
npm run postgres:start
# Stop PostgreSQL
npm run postgres:stop
# Reset PostgreSQL (delete all data)
npm run postgres:reset
# View logs
docker-compose -f docker-compose.postgres.yml logs -fView and edit your database through a web interface:
npm run db:studio# Generate Prisma client
npm run db:generate
# Push schema changes
npm run db:push
# Create and run migration
npm run db:migrate
# Reset database
npm run db:push --force-reset-
Set environment variable:
DATABASE_PROVIDER=postgresql
-
Configure PostgreSQL connection:
DATABASE_URL=postgresql://...
-
Setup database:
npm run postgres:setup
-
Set environment variable:
DATABASE_PROVIDER=supabase
-
Configure Supabase:
NEXT_PUBLIC_SUPABASE_URL=... NEXT_PUBLIC_SUPABASE_ANON_KEY=...
The PostgreSQL schema includes all the same tables as Supabase:
- profiles - User profiles and authentication
- projects - Kanban projects
- columns - Project columns
- tasks - Tasks within columns
- project_members - Team collaboration
- task_comments - Task comments
- activity_logs - Activity tracking
- notifications - User notifications
- bookmarks - User bookmarks
- stripe_ tables* - Stripe integration
-
"Cannot find module '@prisma/client'"
npm install npm run db:generate
-
"Connection refused"
- Check if PostgreSQL is running
- Verify connection string
- Check firewall settings
-
"Database does not exist"
createdb kanba_db
-
"Permission denied"
- Check PostgreSQL user permissions
- Verify connection string credentials
# Using Docker
npm run postgres:reset
# Using local PostgreSQL
dropdb kanba_db
createdb kanba_db
npm run db:push# Docker logs
docker-compose -f docker-compose.postgres.yml logs postgres
# PostgreSQL logs (local installation)
tail -f /var/log/postgresql/postgresql-*.log- Create Railway project
- Add PostgreSQL service
- Set environment variables:
DATABASE_PROVIDER=postgresql DATABASE_URL=${{Postgres.DATABASE_URL}}
- Add PostgreSQL addon
- Set environment variables in Vercel dashboard
- Deploy with PostgreSQL connection
- Install PostgreSQL on server
- Create database and user
- Set environment variables
- Run migrations:
npm run db:migrate
When contributing to PostgreSQL support:
- Test with both Supabase and PostgreSQL
- Update database adapter if needed
- Add new database helpers for complex queries
- Update this documentation
This PostgreSQL support follows the same license as the main Kanba project.