Quickback Docs

Output Structure

Understanding the files and directories generated by the Quickback compiler.

The compiler generates a complete project structure based on your definitions and provider configuration. The output varies depending on your runtime (Cloudflare vs Bun) and enabled features.

Warning: Never edit files in src/ directly. They are overwritten on every compile. Make changes in your quickback/ definitions instead.

Cloudflare Output

src/
├── index.ts                    # Hono app entry point (Workers export)
├── env.d.ts                    # Cloudflare bindings TypeScript types
├── db/
│   ├── index.ts                # Database connection factory
│   ├── auth-schema.ts          # Auth table schemas (dual mode)
│   └── features-schema.ts     # Feature table schemas (dual mode)
├── auth/
│   └── index.ts                # Better Auth instance & config
├── features/
│   └── {feature}/
│       ├── schema.ts           # Drizzle table definition
│       ├── routes.ts           # CRUD + action endpoints
│       └── actions.ts          # Action handlers (if defined)
├── lib/
│   ├── access.ts               # Access control helpers
│   ├── types.ts                # Runtime type definitions
│   ├── masks.ts                # Field masking utilities
│   ├── services.ts             # Service layer
│   └── audit-wrapper.ts        # Auto-inject audit fields
└── middleware/
    ├── auth.ts                 # Auth context middleware
    ├── db.ts                   # Database instance middleware
    └── services.ts             # Service injection middleware

drizzle/
├── auth/                       # Auth migrations (dual mode)
│   ├── meta/
│   │   ├── _journal.json
│   │   └── 0000_snapshot.json
│   └── 0000_initial.sql
└── features/                   # Feature migrations (dual mode)
    ├── meta/
    │   ├── _journal.json
    │   └── 0000_snapshot.json
    └── 0000_initial.sql

# Root config files
├── package.json
├── tsconfig.json
├── wrangler.toml               # Cloudflare Workers config
├── drizzle.config.ts           # Features DB drizzle config
└── drizzle.auth.config.ts      # Auth DB drizzle config (dual mode)

Bun Output

src/
├── index.ts                    # Hono app entry point (Bun server)
├── db/
│   ├── index.ts                # SQLite connection (bun:sqlite)
│   └── schema.ts               # Combined schema (single DB)
├── auth/
│   └── index.ts                # Better Auth instance
├── features/
│   └── {feature}/
│       ├── schema.ts
│       ├── routes.ts
│       └── actions.ts
├── lib/
│   ├── access.ts
│   ├── types.ts
│   ├── masks.ts
│   ├── services.ts
│   └── audit-wrapper.ts
└── middleware/
    ├── auth.ts
    ├── db.ts
    └── services.ts

drizzle/                        # Single migration directory
├── meta/
│   ├── _journal.json
│   └── 0000_snapshot.json
└── 0000_initial.sql

data/                           # SQLite database files
└── app.db

├── package.json
├── tsconfig.json
└── drizzle.config.ts

Key Differences by Runtime

AspectCloudflareBun
Entry pointWorkers export defaultBun.serve() with port
DatabaseD1 bindings (dual mode)SQLite file (single DB)
Typesenv.d.ts for bindingsNo extra types needed
Configwrangler.toml.env file
Migrationsdrizzle/auth/ + drizzle/features/drizzle/
Drizzle configs2 configs (auth + features)1 config

Optional Output Files

These files are generated only when the corresponding features are configured:

Embeddings

When any feature has embeddings configured:

src/
├── lib/
│   └── embeddings.ts           # Embedding helpers
├── routes/
│   └── embeddings.ts           # POST /api/v1/embeddings endpoint
└── queue-consumer.ts           # Queue handler for async embedding jobs

File Storage (R2)

When fileStorage is configured:

src/
└── routes/
    └── storage.ts              # File upload/download endpoints
drizzle/
└── files/                      # File metadata migrations
    ├── meta/
    └── 0000_*.sql

Webhooks

When webhooks are enabled:

src/
└── lib/
    └── webhooks/
        ├── index.ts            # Webhook module entry
        ├── sign.ts             # Webhook payload signing
        ├── handlers.ts         # Handler registry
        ├── emit.ts             # Queue emission helpers
        ├── routes.ts           # Inbound/outbound endpoints
        └── providers/
            ├── index.ts
            └── stripe.ts       # Stripe webhook handler
drizzle/
└── webhooks/                   # Webhook schema migrations
    ├── meta/
    └── 0000_*.sql

Realtime

When any feature has realtime configured:

src/
└── lib/
    └── realtime.ts             # Broadcast helpers

cloudflare-workers/             # Separate Durable Objects worker
└── broadcast/
    ├── Broadcaster.ts
    ├── index.ts
    └── wrangler.toml

Device Authorization

When the deviceAuthorization plugin is enabled:

src/
└── routes/
    └── cli-auth.ts             # Device auth flow endpoints

Database Schemas

Dual Database Mode (Cloudflare Default)

The compiler separates schemas into two files:

src/db/auth-schema.ts — Re-exports Better Auth table schemas:

  • users, sessions, accounts
  • organizations, members, invitations (if organizations enabled)
  • Plugin-specific tables (apiKeys, etc.)

src/db/features-schema.ts — Re-exports your feature schemas:

  • All tables defined with defineTable()
  • Audit field columns added automatically

Single Database Mode (Bun Default)

src/db/schema.ts — Combined re-export of all schemas (auth + features).

Generated Routes

For each feature, the compiler generates a routes file at src/features/{name}/routes.ts containing:

RouteGenerated When
GET /crud.list configured
GET /:idcrud.get configured
POST /crud.create configured
PATCH /:idcrud.update configured
DELETE /:idcrud.delete configured
PUT /:idcrud.put configured
POST /batchcrud.create exists (auto-enabled)
PATCH /batchcrud.update exists (auto-enabled)
DELETE /batchcrud.delete exists (auto-enabled)
PUT /batchcrud.put exists (auto-enabled)
GET /views/{name}views configured
POST /:id/{action}Record-based actions defined
POST /{action}Standalone actions defined

All routes are mounted under /api/v1/{feature} in the main app.

Migrations

The compiler runs drizzle-kit generate during compilation to produce SQL migration files. On subsequent compiles, it uses existingFiles (your current migration state) to generate only incremental changes.

Migration files follow the Drizzle Kit naming convention:

0000_initial.sql
0001_add_status_column.sql
0002_create_orders_table.sql

See Also

On this page