PaceUI

Blocks
MCPComponentsTemplatesChartsStarter
Docs
IntroductionInstallationChangelog
Starter
OverviewGetting StartedFolder StructureAIAuth BasicAuth OAuthDatabaseDocumentationEmail ResendPayment CreemPayment PolarStorage

Build faster with Pro

Unlock all premium blocks, templates, and support future updates.

Get Full Access

Database

PreviousNext

It's just PostgreSQL and Drizzle ORM. Type-safe and ready for production, no BS.

Starter comes with PostgreSQL and Drizzle ORM already set up. Add your DATABASE_URL and start working.

Setup (Two Steps)

  1. Set the DB URL in .env:
DATABASE_URL=postgres://user:password@host:port/dbname
  1. Push schema to the DB:
bun run db:push

Done. DB is live.

Database Structure

Schema Organization

Schemas are organized by feature under src/features/*/. Everything gets exported through the main file: src/features/database/schema.ts.

Examples:

  • Auth schema is at: src/features/auth/auth.schema.ts
  • New stuff goes in: src/features/yourfeature/yourfeature.schema.ts

Using the Database

The db instance is available from src/features/database/db.ts. Import it for server-side use:

// Example query
const allRoles = await db.select().from(roles);

Common Tasks (The Commands)

TaskCommand
Push schema changes to the databasebun run db:push
Generate new migration filesbun run db:generate
Add a new tableCreate the file, then run bun run db:push

Adding New Tables (Workflow)

  1. Create your schema file: src/features/yourfeature/yourfeature.schema.ts
  2. Export the new tables using Drizzle's pgTable().
  3. Export that file from src/features/database/schema.ts.
  4. Run bun run db:push.

That's all you need.

Environment Variables

Required:

  • DATABASE_URL - Gotta have your PostgreSQL connection string here.

Deployment Tip: Use a managed DB service—Railway, Supabase, Neon, whatever. They give you the secure connection strings you need.

Best Practices (I suggest you play by these rules)

  • Keep schema files with their features.
  • Never commit .env to version control. Ever.
  • For production, use migrations (db:generate) for schema changes. db:push is for dev/testing.

PaceUI

The ultimate toolkit empowering your designers and developers to launch their next big idea without ever settling on quality

Pages

ComponentsBlocksMCPTemplatesStarter

Account

ManageLicensesPricing

Support

AffiliateContact UsPrivacy PolicyTerms of ServiceDocs

© 2026 PaceUI. All rights reserved. Built by indie developer, Denish

PACEUI