Use when working with Neon serverless PostgreSQL database. Covers database setup, CLI commands, Drizzle ORM integration, schema migrations, connection pooling, and user data storage patterns for authentication and chat history.
When working with Neon PostgreSQL:
Check if database exists
.env or .env.local for DATABASE_URLneon connection-stringFor schema changes
drizzle.config.ts is configureddrizzle-kit generatedrizzle-kit pushFor user data storage
users table for authenticationsessions table for session managementchat_history table for conversationsuser_id foreign keyFor queries
DATABASE_URL="postgresql://user:[email protected]/neondb?sslmode=require"
import { drizzle } from 'drizzle-orm/neon-http';
import { neon } from '@neondatabase/serverless';
const sql = neon(process.env.DATABASE_URL!);
export const db = drizzle(sql);
For this Physical AI RAG chatbot:
timestamp('created_at').defaultNow()text('id').primaryKey() with crypto.randomUUID()For detailed information, check these references:
references/neon-cli.mdreferences/drizzle-orm.mdreferences/database-schemas.mdreferences/query-patterns.mdreferences/migrations.md