QUESTPIE
Build Your BackendArchitecture

File Convention

How QUESTPIE discovers your files and wires them into the runtime — naming rules, layouts, and discovery mechanics.

QUESTPIE uses your file system as the source of truth. Drop a file in the right directory, run codegen, and it's part of your app. No manual registration.

Directory Categories

Each directory maps to a category of entity:

DirectoryEntityExport StyleKey Derivation
collections/CollectionsDefault or namedFactory arg → export name
globals/GlobalsDefault or namedFactory arg → export name
routes/RoutesDefaultFilename → camelCase/slash path
jobs/JobsDefaultFilename → camelCase
routes/ (raw)RoutesDefaultFilename → slash-separated path
services/ServicesDefaultFilename → camelCase
emails/Email templatesDefaultFilename → camelCase
blocks/BlocksNamed exportsFactory arg → export name
messages/i18n messagesDefaultFilename → locale key
migrations/DB migrationsDefaultArray (ordered)
seeds/DB seedsDefaultArray (ordered)

Name derivation

Factory string args are entity identities for collections, globals, blocks, views, and components. They are converted from kebab-case to camelCase:

Mermaid

Only hyphens are camelized. Underscores are preserved, so global("site_settings") generates the key site_settings, not siteSettings.

Single-File Conventions

Some configs are single files, not directories:

FileFactoryPurpose
questpie.config.tsruntimeConfig({...})DB, plugins, adapters
modules.tsexport default [...]Module dependencies
config/auth.tsauthConfig({...})Auth configuration
config/app.tsexport default appConfig({...})App-level config (context, locale, tenant scoping)
config/admin.tsadminConfig({...})Admin sidebar, dashboard, branding, locale
config/openapi.tsopenApiConfig({...})OpenAPI and Scalar UI options
fields.tsexport default { ...customFields }Custom field type definitions

Layouts

By-Type (default)

Group files by entity type:

Mermaid

By-Feature

Group files by domain:

Mermaid

Mixed

Both layouts can coexist. Codegen scans all configured paths.

Nested Namespacing

Routes support nested directories:

Mermaid

Discovery Process

  1. Scan — Codegen walks the configured directories
  2. Match — Files matching the category pattern are picked up
  3. Import — Each file is imported and its exports are read
  4. Key derivation — Factory string arg → export name → filename (camelCase)
  5. Merge — Project entities + module entities are merged
  6. Emit — Generated types and runtime wiring in .generated/

The #questpie Import

Collection and global files use #questpie as an import alias:

import { collection } from "#questpie/factories";

This resolves to the generated app context, giving the builders access to field types and relation targets for autocompletion. It's configured via TypeScript path mapping.

On this page