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.tsKey Differences by Runtime
| Aspect | Cloudflare | Bun |
|---|---|---|
| Entry point | Workers export default | Bun.serve() with port |
| Database | D1 bindings (dual mode) | SQLite file (single DB) |
| Types | env.d.ts for bindings | No extra types needed |
| Config | wrangler.toml | .env file |
| Migrations | drizzle/auth/ + drizzle/features/ | drizzle/ |
| Drizzle configs | 2 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 jobsFile Storage (R2)
When fileStorage is configured:
src/
└── routes/
└── storage.ts # File upload/download endpoints
drizzle/
└── files/ # File metadata migrations
├── meta/
└── 0000_*.sqlWebhooks
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_*.sqlRealtime
When any feature has realtime configured:
src/
└── lib/
└── realtime.ts # Broadcast helpers
cloudflare-workers/ # Separate Durable Objects worker
└── broadcast/
├── Broadcaster.ts
├── index.ts
└── wrangler.tomlDevice Authorization
When the deviceAuthorization plugin is enabled:
src/
└── routes/
└── cli-auth.ts # Device auth flow endpointsDatabase 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,accountsorganizations,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:
| Route | Generated When |
|---|---|
GET / | crud.list configured |
GET /:id | crud.get configured |
POST / | crud.create configured |
PATCH /:id | crud.update configured |
DELETE /:id | crud.delete configured |
PUT /:id | crud.put configured |
POST /batch | crud.create exists (auto-enabled) |
PATCH /batch | crud.update exists (auto-enabled) |
DELETE /batch | crud.delete exists (auto-enabled) |
PUT /batch | crud.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.sqlSee Also
- Providers — Configure runtime, database, and auth providers
- Environment variables — Required variables by runtime