Databases
Telbase provisions managed databases automatically when it detects an ORM in your project. No configuration, no connection strings to copy — just deploy.
How It Works
When you run telbase deploy, the CLI scans your project for an ORM (Prisma, Drizzle, Django, SQLAlchemy, GORM, or Ent). If it finds one, it provisions the right database on first deploy:
- Prisma or Drizzle with SQLite — a managed SQLite database is created automatically
- Prisma, Drizzle, Django, SQLAlchemy, GORM, or Ent with PostgreSQL — a managed PostgreSQL database is created automatically
- No ORM detected — no database provisioned (deploy as a static site or API)
The DATABASE_URL environment variable is set automatically. Your code connects to the database without any changes.
SQLite vs PostgreSQL
Best for most internal tools. Simple, fast, no connection pooling to worry about.
- Single-file database, replicated globally
- Microsecond reads at the edge
- Works with any compute provider (Vercel, GCP)
- Ideal for: dashboards, approval workflows, trackers, CRUD apps
Use SQLite when your Prisma schema has provider = "sqlite" or url = "file:./dev.db".
Migrations
Migrations run automatically on every deploy. Telbase detects your migration tool (Prisma Migrate or Drizzle Kit) and injects the migration command into the build step. No manual intervention needed.
# Check which migrations have been applied
telbase db migrate:status
# Run migrations manually (if needed)
telbase db migrate
# Preview without applying
telbase db migrate --dry-runnpx prisma migrate deploy (or the Drizzle equivalent) to your build command automatically.Querying Your Database
Run SQL directly from the CLI. Useful for debugging, data inspection, and one-off queries.
Read-only queries
# SELECT, WITH, and EXPLAIN queries (max 1,000 rows)
telbase db query "SELECT count(*) FROM users"
# From a file
telbase db query --file analytics.sqlWrite queries
# INSERT, UPDATE, DELETE, CREATE TABLE, ALTER TABLE
telbase db exec "UPDATE users SET role = 'admin' WHERE email = '[email protected]'"
# From a file
telbase db exec --file seed.sqlInteractive session (PostgreSQL)
# Opens a psql session connected to your database
telbase db connectBackups
Paid plans include automatic daily backups and manual snapshot support.
# Create a manual backup
telbase db backup --name "before-migration"
# List all backups
telbase db backups
# Restore from a backup
telbase db restore <backup-id>
# Restore the most recent backup
telbase db restore --latestPostgreSQL Extensions
Enable popular PostgreSQL extensions directly from the CLI. Telbase supports pgvector, pg_trgm, PostGIS, and uuid-ossp.
# List available extensions
telbase db extensions
# Enable pgvector for AI embeddings
telbase db enable-extension pgvectorEmbedding presets
When enabling pgvector, use a preset to auto-configure the vector dimensions and create a sample embeddings table:
# OpenAI text-embedding-3-small (1536 dimensions)
telbase db enable-extension pgvector --preset openai-3-small --create-table
# OpenAI text-embedding-3-large (3072 dimensions)
telbase db enable-extension pgvector --preset openai-3-large --create-table
# Voyage AI embeddings (1024 dimensions)
telbase db enable-extension pgvector --preset claude --create-table
# Custom dimensions
telbase db enable-extension pgvector --dimensions 384 --create-tableAvailable presets: openai-ada-002, openai-3-small, openai-3-large, claude, cohere-english, sentence-transformers.
For a complete guide on auto-detection, embedding presets, and deploying RAG applications, see Vector Search & RAG.
--index-type (hnsw, ivfflat, none) and --metric (cosine, l2, inner_product).Environment Variables
DATABASE_URL is set automatically when a database is provisioned. To access it locally for development:
# Download all env vars to .env.local
telbase env pull
# View the connection string
telbase env get DATABASE_URLIf you need additional database-related variables (e.g., a read-only replica URL or a direct connection for migrations), set them with:
telbase env set DIRECT_URL=postgres://... --secretNext Steps
- Quick Start — deploy your first app
- Using with Claude Code — AI-powered database provisioning and debugging
- CLI Reference — full
dbcommand reference with all flags - Guides & Articles — schema patterns, best practices, and more