Skip to content
Discord Get Started

AI Coding Prompts

Pre-built prompts you can copy directly into an AI coding assistant to scaffold a working DB9 integration. Each prompt includes the DB9 connection pattern, framework best practices, and DB9-specific features.

Compatible with: Claude Code, Cursor, GitHub Copilot, ChatGPT, and any LLM that generates code.

  1. Pick the prompt that matches your tech stack below.
  2. Click the copy button on the code block.
  3. Paste into your AI assistant.
  4. Replace YOUR_DATABASE_URL with your actual connection string.

Prompt
Build a Next.js 14+ App Router application with Prisma ORM connected to a DB9 database.
DB9 connection details:
- Connection string format: postgresql://<tenant_id>.admin@pg.db9.io:5433/postgres?sslmode=require
- Store the connection string in .env.local as DATABASE_URL
- DB9 is PostgreSQL-compatible on port 5433 — no custom adapter needed
Requirements:
1. Initialize Prisma with the PostgreSQL provider
2. Create a schema with at least two related models (e.g. User and Post)
3. Set up a singleton PrismaClient in lib/prisma.ts to avoid multiple instances in dev
4. Create Server Components that fetch data with Prisma
5. Create a Route Handler (app/api/) for mutations
6. Create a Server Action for form submissions
7. Add proper error handling and TypeScript types
Prisma setup commands:
npm install prisma @prisma/client
npx prisma init
npx prisma db push (for quick schema sync)
npx prisma generate
DB9 features to consider:
- Use db9 branch create for safe schema experiments before pushing to main
- DB9 supports JSONB columns for flexible data
- Vector search is available via pgvector for AI/RAG features
- Anonymous databases can be created instantly for prototyping: db9 create --name myapp
Reference docs: https://db9.ai/docs/guides/nextjs/ and https://db9.ai/docs/guides/prisma/
Prompt
Build a Next.js 14+ App Router application with Drizzle ORM connected to a DB9 database.
DB9 connection details:
- Connection string format: postgresql://<tenant_id>.admin@pg.db9.io:5433/postgres?sslmode=require
- Store the connection string in .env.local as DATABASE_URL
- DB9 is PostgreSQL-compatible on port 5433 — no custom adapter needed
Requirements:
1. Install drizzle-orm and drizzle-kit with the postgres-js driver
2. Define a schema in src/db/schema.ts using drizzle's pgTable
3. Set up the database client in src/db/index.ts
4. Configure drizzle.config.ts pointing to DB9
5. Create Server Components that query with Drizzle
6. Create Route Handlers for mutations
7. Use Drizzle's type-safe query builder — avoid raw SQL
8. Add proper connection pooling with postgres-js
Install commands:
npm install drizzle-orm postgres
npm install -D drizzle-kit
Push schema:
npx drizzle-kit push
DB9 features to consider:
- Use db9 branch create for safe schema migrations before pushing to main
- DB9 supports JSONB columns — use Drizzle's jsonb() type
- Vector search is available via pgvector for AI/RAG features
- Anonymous databases require no signup: db9 create --name myapp
Reference docs: https://db9.ai/docs/guides/nextjs/ and https://db9.ai/docs/guides/drizzle/
Prompt
Build an Express.js REST API with Knex.js query builder connected to a DB9 database.
DB9 connection details:
- Connection string format: postgresql://<tenant_id>.admin@pg.db9.io:5433/postgres?sslmode=require
- Store the connection string in a .env file as DATABASE_URL
- DB9 is PostgreSQL-compatible on port 5433 — use the pg driver
Requirements:
1. Set up Express with proper middleware (cors, json parsing, error handling)
2. Configure Knex with the pg driver pointing to DB9
3. Create a migration for at least two related tables
4. Build CRUD endpoints for the primary resource
5. Use Knex transactions for multi-step operations
6. Add request validation
7. Structure the project: routes/, controllers/, db/ directories
Install commands:
npm install express knex pg dotenv
npx knex init
npx knex migrate:make create_tables
npx knex migrate:latest
Knex config for DB9:
client: 'pg'
connection: process.env.DATABASE_URL
pool: { min: 2, max: 10 }
ssl: { rejectUnauthorized: false }
DB9 features to consider:
- Use db9 branch create to test migrations safely before applying to main
- pg_cron is available for scheduled background jobs via SQL
- HTTP from SQL: call external APIs directly from DB9 with http_get()/http_post()
- Anonymous databases require no signup: db9 create --name myapp
Reference docs: https://db9.ai/docs/guides/knex/ and https://db9.ai/docs/connect/
Prompt
Build a SvelteKit application with Drizzle ORM connected to a DB9 database.
DB9 connection details:
- Connection string format: postgresql://<tenant_id>.admin@pg.db9.io:5433/postgres?sslmode=require
- Store the connection string in a .env file as DATABASE_URL
- DB9 is PostgreSQL-compatible on port 5433 — no custom adapter needed
Requirements:
1. Create a SvelteKit project with TypeScript
2. Install drizzle-orm with the postgres-js driver
3. Define schema in src/lib/server/db/schema.ts using pgTable
4. Set up the db client in src/lib/server/db/index.ts (server-only module)
5. Use SvelteKit load functions (+page.server.ts) for data fetching
6. Create form actions for mutations
7. Use Drizzle's type-safe query builder throughout
8. Ensure database code only runs server-side
Install commands:
npm install drizzle-orm postgres
npm install -D drizzle-kit
npx drizzle-kit push
DB9 features to consider:
- Use db9 branch create for safe schema experiments
- DB9 supports JSONB columns — use Drizzle's jsonb() type
- Vector search via pgvector for AI-powered features
- Anonymous databases require no signup: db9 create --name myapp
Reference docs: https://db9.ai/docs/guides/drizzle/ and https://db9.ai/docs/connect/

Prompt
Build a Python application with SQLAlchemy 2.0 connected to a DB9 database.
DB9 connection details:
- Connection string format: postgresql://<tenant_id>.admin@pg.db9.io:5433/postgres?sslmode=require
- IMPORTANT: SQLAlchemy requires the prefix postgresql+psycopg:// (not postgresql://)
Convert the DB9 connection string by replacing "postgresql://" with "postgresql+psycopg://"
- Store the connection string in a .env file as DATABASE_URL
Requirements:
1. Use SQLAlchemy 2.0 API with mapped_column and type-annotated models
2. Use psycopg3 (psycopg[binary]) as the driver — not psycopg2
3. Create an engine with pool_pre_ping=True
4. Define at least two related models with relationships
5. Use sessionmaker and context managers for transactions
6. Implement CRUD operations using the 2.0 query API
7. Add Alembic for migrations
Install commands:
pip install "sqlalchemy>=2.0.0" "psycopg[binary]>=3.1.0" python-dotenv
pip install alembic # for migrations
DB9 features to consider:
- Use db9 branch create for safe schema experiments before applying migrations
- Vector search: pip install pgvector, then use the Vector type for embedding columns
- DB9 supports JSONB — use sqlalchemy.dialects.postgresql.JSONB
- Anonymous databases require no signup: db9 create --name myapp
Reference docs: https://db9.ai/docs/guides/python-sqlalchemy/
Prompt
Build a Django application connected to a DB9 database.
DB9 connection details:
- Host: pg.db9.io
- Port: 5433
- Database name: postgres
- User: <tenant_id>.admin
- DB9 is PostgreSQL-compatible — use Django's built-in postgresql backend
Requirements:
1. Create a Django project with at least one app
2. Configure DATABASES in settings.py for DB9
3. Define models with at least two related tables
4. Create and apply migrations
5. Set up Django REST Framework for an API (or use views)
6. Add admin site configuration
7. Use environment variables for credentials (django-environ or python-dotenv)
Django DATABASES config for DB9:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'postgres',
'USER': '<tenant_id>.admin',
'PASSWORD': '<your_password>',
'HOST': 'pg.db9.io',
'PORT': '5433',
'OPTIONS': {'sslmode': 'require'},
}
}
Install commands:
pip install django psycopg[binary] django-environ
django-admin startproject myproject
python manage.py startapp myapp
python manage.py migrate
DB9 features to consider:
- Use db9 branch create to test migrations on a branch before applying to main
- Django's JSONField works with DB9's JSONB support
- Vector search: install pgvector and django-pgvector for AI/RAG features
- Anonymous databases require no signup: db9 create --name myapp
Reference docs: https://db9.ai/docs/connect/
Prompt
Build a Flask REST API with SQLAlchemy connected to a DB9 database.
DB9 connection details:
- Connection string format: postgresql://<tenant_id>.admin@pg.db9.io:5433/postgres?sslmode=require
- IMPORTANT: For SQLAlchemy, replace "postgresql://" with "postgresql+psycopg://"
- Store the connection string in a .env file as DATABASE_URL
Requirements:
1. Set up Flask with Flask-SQLAlchemy for ORM integration
2. Use SQLAlchemy 2.0 style models with mapped_column
3. Use psycopg3 (psycopg[binary]) as the driver
4. Define at least two related models
5. Create RESTful CRUD endpoints using Flask blueprints
6. Use Flask-Migrate (Alembic) for database migrations
7. Add proper error handling and JSON responses
8. Structure the project with an application factory pattern
Install commands:
pip install flask flask-sqlalchemy "psycopg[binary]>=3.1.0" flask-migrate python-dotenv
Flask-SQLAlchemy config for DB9:
SQLALCHEMY_DATABASE_URI must use the postgresql+psycopg:// prefix
SQLALCHEMY_ENGINE_OPTIONS = {"pool_pre_ping": True}
DB9 features to consider:
- Use db9 branch create for safe schema experiments before migrating
- Vector search: pip install pgvector for AI/RAG features
- DB9 supports JSONB for flexible document storage
- Anonymous databases require no signup: db9 create --name myapp
Reference docs: https://db9.ai/docs/guides/python-sqlalchemy/ and https://db9.ai/docs/connect/

Prompt
Build a Go REST API with GORM connected to a DB9 database.
DB9 connection details:
- Connection string (DSN): postgresql://<tenant_id>.admin@pg.db9.io:5433/postgres?sslmode=require
- GORM uses the pgx v5 driver via gorm.io/driver/postgres
- Store the DSN in an environment variable DATABASE_URL
Requirements:
1. Set up a Go project with GORM and the postgres driver
2. Define struct models with gorm tags for at least two related tables
3. Use AutoMigrate for schema setup
4. Build a REST API using net/http or chi/gin router
5. Implement CRUD operations with proper error handling
6. Use GORM transactions for multi-step operations
7. Add connection pooling configuration via database/sql
Install commands:
go mod init myapp
go get gorm.io/gorm gorm.io/driver/postgres
GORM connection setup:
dsn := os.Getenv("DATABASE_URL")
db, err := gorm.Open(postgres.New(postgres.Config{DSN: dsn}), &gorm.Config{})
sqlDB, _ := db.DB()
sqlDB.SetMaxOpenConns(25)
sqlDB.SetMaxIdleConns(5)
DB9 features to consider:
- Use db9 branch create for safe schema experiments before AutoMigrate on main
- Vector search: use pgvector-go for embedding columns
- DB9 supports JSONB — use datatypes.JSON from gorm.io/datatypes
- Anonymous databases require no signup: db9 create --name myapp
Reference docs: https://db9.ai/docs/guides/gorm/

Prompt
Build a Rust web service with SQLx connected to a DB9 database.
DB9 connection details:
- Connection string format: postgresql://<tenant_id>.admin@pg.db9.io:5433/postgres?sslmode=require
- Store the connection string in a .env file as DATABASE_URL
- SQLx connects via the PostgreSQL protocol — DB9 is fully compatible
Requirements:
1. Set up a Rust project with SQLx (postgres feature + runtime-tokio + tls-rustls)
2. Use sqlx::PgPool for connection pooling
3. Define models as Rust structs deriving FromRow
4. Use compile-time checked queries with sqlx::query_as! where possible
5. Build a REST API using Axum or Actix-web
6. Implement CRUD endpoints with proper error handling
7. Use SQLx migrations for schema management
Cargo.toml dependencies:
sqlx = { version = "0.8", features = ["runtime-tokio", "tls-rustls", "postgres", "macros"] }
tokio = { version = "1", features = ["full"] }
axum = "0.7" # or actix-web
dotenvy = "0.15"
serde = { version = "1", features = ["derive"] }
SQLx commands:
sqlx database create (not needed — DB9 database already exists)
sqlx migrate add create_tables
sqlx migrate run
DB9 features to consider:
- Use db9 branch create to test migrations on a branch before applying to main
- Vector search: use pgvector with SQLx for embedding storage and similarity search
- DB9 supports JSONB — use sqlx::types::Json<T>
- Anonymous databases require no signup: db9 create --name myapp
Reference docs: https://db9.ai/docs/connect/

Prompt
Build a Ruby on Rails application connected to a DB9 database.
DB9 connection details:
- Host: pg.db9.io
- Port: 5433
- Database name: postgres
- User: <tenant_id>.admin
- DB9 is PostgreSQL-compatible — use the standard pg gem
Requirements:
1. Create a new Rails app with the PostgreSQL adapter
2. Configure config/database.yml for DB9
3. Generate at least two related models with a migration
4. Set up Active Record associations
5. Create a RESTful controller with CRUD actions
6. Add model validations
7. Use Rails credentials or environment variables for the password
database.yml config for DB9:
default: &default
adapter: postgresql
host: pg.db9.io
port: 5433
database: postgres
username: <tenant_id>.admin
password: <%= ENV["DB9_PASSWORD"] %>
sslmode: require
Install commands:
rails new myapp --database=postgresql
cd myapp
rails generate model User name:string email:string
rails generate model Post title:string body:text user:references
rails db:migrate
DB9 features to consider:
- Use db9 branch create to test migrations on a branch before applying to production
- Rails jsonb columns work natively with DB9
- Vector search: use the neighbor gem with pgvector for AI/RAG features
- Anonymous databases require no signup: db9 create --name myapp
Reference docs: https://db9.ai/docs/connect/

Each prompt above follows a consistent structure:

SectionPurpose
Connection detailsDB9 host, port (5433), connection string format, environment variable naming
Framework setupInstall commands, project structure, configuration
Code requirementsModels, CRUD, transactions, error handling
DB9 featuresBranching, anonymous databases, vector search, JSONB, and other capabilities
Reference linksPointers to the relevant DB9 docs for the AI to consult