Database options
You can use either:- Local PostgreSQL - Best for offline development
- Neon Postgres - Managed cloud database with connection pooling
Local PostgreSQL setup
Install PostgreSQL
Create a database
Set DATABASE_URL
Add toapps/server/.env:
apps/server/.env
Neon database setup
Create a Neon project
Sign up at Neon and create a new project.
Sync Neon to local (optional)
If you’re using Neon for production, you can sync it to a local PostgreSQL instance:- Dumps your Neon database
- Imports it into your local PostgreSQL
- Preserves schema and data
Schema management
Better Skills uses Drizzle Kit for database migrations and schema management.Push schema changes
Apply schema changes directly to your database (development only):Generate migrations
Create a new migration from schema changes:packages/db/migrations/.
Run migrations
Apply pending migrations to your database:Open database studio
Launch Drizzle Studio to browse and edit data:https://local.drizzle.studio.
Database schema location
All schema definitions live in:- User tables (Better Auth)
- Skills and skill relationships
- Graph links and mentions
- Sessions and accounts
Environment variables
The database connection is configured through:apps/server/.env
DATABASE_URL from apps/server/.env when running:
bun run db:pushbun run db:generatebun run db:migratebun run db:studio
Common workflows
First-time setup
Modify schema
Reset database
To completely reset your local database:Troubleshooting
Connection refused on port 5432
Connection refused on port 5432
PostgreSQL is not running. Start it:
DATABASE_URL not found
DATABASE_URL not found
Ensure
apps/server/.env exists and contains DATABASE_URL. Drizzle Kit reads from this location.Migration conflicts
Migration conflicts
If migrations conflict:
- Review migration files in
packages/db/migrations/ - Manually resolve conflicts in SQL
- Re-run
bun run db:migrate
Next steps
Environment Variables
Configure all required environment variables
Development Setup
Return to development setup guide