LogoLogoLogoLogo
ComponentsBlocksTemplatesStarterDocs
Docs
  • Introduction
  • Installation
  • Changelog
  • Starter
    • Introduction
    • Getting Started
    • Folder Structure
    • Database
    • Basic (Auth)
    • Artificial Intelligence
    • OAuth (Auth)
    • Storage
    • Documentation
    • Polar (Payment)
    • Creem (Payment)
    • Resend (Email)

    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.
    Folder StructureBasic (Auth)

    On This Page

    Setup (Two Steps)Database StructureSchema OrganizationUsing the DatabaseCommon Tasks (The Commands)Adding New Tables (Workflow)Environment VariablesBest Practices (I suggest you play by these rules)
    LogoLogoLogoLogo

    Build faster with practical UI blocks for real apps.

    Pages

    ComponentsBlocksTemplatesStarter

    Account

    ManageLicensesPricing

    Support

    Contact UsPrivacy PolicyTerms of ServiceDocs

    © 2026 PaceUI. All rights reserved.

    PACEUI