Skip to Content
DocsArchitecture

Architecture

The source of truth is ARCHITECTURE.md in the repository. This page is a summary.

Packages

PathPackageStatus
packages/core@quickben/coreAvailable
packages/db-memory@quickben/db-memoryAvailable
packages/adapter-tests@quickben/adapter-tests (private)Available
packages/db-drizzle@quickben/db-drizzleAvailable
packages/next@quickben/nextAvailable
packages/admin@quickben/adminAvailable
packages/plugin-tenancy@quickben/plugin-tenancyPlanned
packages/create-quickbencreate-quickbenPlanned
apps/docsThis siteAvailable
apps/playgroundNext.js app using everything (PGlite)Available

Dependencies point one way. Adapters and other packages depend on @quickben/core as a peer dependency. Core depends only on Zod.

Layers

quickben.config.ts collections, fields, access, hooks, plugins │ ▼ defineConfig applies plugins in order, validates slugs and relations │ ▼ local API (qb) access → hooks → Zod validation → relations → transaction │ ▼ DatabaseAdapter memory, Drizzle (Postgres, PGlite, SQLite), others later

The route handlers and the admin UI call the local API. They do not talk to the adapter directly.

Next.js integration

FilePackageExport
app/api/[...quickben]/route.ts@quickben/nextcreateRouteHandlers(config)
app/admin/[[...segments]]/page.tsx@quickben/admincreateAdminPage(config, { serverFunction })
app/admin/layout.tsx@quickben/adminimport "@quickben/admin/styles.css"
PackageRuns on the serverRuns in the browser
@quickben/nextRoute handlers, getQuickben, getRequestContextNothing
@quickben/adminShell, dashboard, list and edit views, one server functionForm submit and errors, relation picker, JSON editor, delete dialog, toast

Core responsibilities

ConcernDone byDetail
TypescoreInferred from fields. No code generation.
ValidationcoreZod 4 schemas generated from fields, then field validate.
AccesscoreRules per operation; filters AND-ed with queries.
HookscoreRun inside the write transaction.
RelationscoreStored as ids; loaded by core with depth (0–3).
CursorscoreKeyset positions turned into where filters.
IdscoreUUIDv7.
Storage and queryadapterfind, findOne, count, create, update, delete, transaction.
Unique valuesadapterThrows ConflictError.

Tooling

ToolVersion
Node.js22.18 or later (CI: 22 and 24)
pnpm12, pinned with Corepack
TypeScript6.0
ESLint10, flat config
tsdown0.23
Vitest5
Turborepo2

All packages are ESM only, TypeScript strict, with exports maps.

Last updated on