Quickback Docs

Neon

Using Neon PostgreSQL with Quickback Stack. Connection modes, Drizzle integration, and Neon Authorize setup.

Neon provides serverless PostgreSQL that works with Cloudflare Workers via HTTP connections. Choose Neon when you need PostgreSQL features (JSON operators, full-text search, advanced indexing) or database-level Row Level Security.

Configuration

import { defineConfig, defineRuntime, defineDatabase, defineAuth } from "@quickback/compiler";

export default defineConfig({
  name: "my-app",
  providers: {
    runtime: defineRuntime("cloudflare"),
    database: defineDatabase("neon", {
      connectionMode: "auto",
      pooled: true,
    }),
    auth: defineAuth("better-auth"),
  },
});

Connection Modes

ModeBest ForHow It Works
HTTPCloudflare Workers, edge functionsStateless HTTP queries via @neondatabase/serverless
WebSocketNode.js, BunPersistent WebSocket connection for lower latency
Auto (default)Mixed environmentsDetects runtime and picks the best mode

Environment Variables

Set your Neon connection string as a secret:

# For Cloudflare Workers
npx wrangler secret put DATABASE_URL
# Paste your Neon connection string: postgresql://user:pass@ep-xxx.region.neon.tech/dbname

# For local development (.env)
DATABASE_URL=postgresql://user:pass@ep-xxx.region.neon.tech/dbname

Migrations

Neon uses PostgreSQL migrations (different from D1's SQLite migrations):

# Generate migrations after compiling
quickback compile

# Apply migrations
npm run db:migrate

When to Choose Neon vs D1

FactorNeonD1
SQL dialectPostgreSQLSQLite
Security modelRLS + application-layerApplication-layer only
Multi-regionBuilt-in replicationSingle region per database
PricingFree tier, then usage-basedFree tier, then usage-based
Best forComplex queries, existing Postgres appsEdge-first, simple schemas

See Also

  • Neon Integration — Complete setup guide with RLS policy details
  • D1 — Alternative: SQLite at the edge
  • Providers — All database provider options

On this page