Directory structure

Where each kind of code goes in a Caldera app.

A new starter app looks like this. Every folder has one job, and the generators (caldera make:*) put files where they belong.

This is the Inertia version. In a Next.js app, src/ is the same, and Next's app/ takes the place of resources/.

app.ts
auth.ts
env.ts
http.ts
inertia.ts
middleware.ts
server.ts
app.tsx
app.css
AGENTS.md
.env

The server: src/

WhatWhereGenerator
Environment variables, validated with Zodsrc/env.ts
Config: the only place env is readsrc/config/*.tsmake:config
Tablessrc/db/tables/*.ts (and src/db/schema.ts)make:model
Relations: every table is registered heresrc/db/relations.ts
Modelssrc/models/*.tsmake:model
Policies: who may do whatsrc/policies/*.tsmake:policy
Routessrc/routes/*.tsmake:routes
Middleware, by name (mw.auth())src/middleware.ts
Queued jobssrc/jobs/*.tsmake:job
Events and listenerssrc/events/*.ts, src/listeners/*.tsmake:event, make:listener
Schedulessrc/schedules/*.tsmake:schedule
Mails (React Email)src/mail/*.tsxmake:mail
Notificationssrc/notifications/*.tsmake:notification
Realtime channelssrc/channels/*.tsmake:channel
Factories and seederssrc/db/factories/, src/db/seeders/make:factory, make:seeder

src/app.ts puts the app together from its providers (database, auth, queue, mail…), src/http.ts is the HTTP stack (security headers, the session, pages, your routes, error pages), and src/server.ts starts it on Node. Routes, policies, jobs, mails and channels are found by caldera generate: there's no list to keep up to date.

The pages: resources/

WhatWhere
Pages, rendered with c.render('Posts/Index', props)resources/pages/**/*.tsx (make:page)
Layouts, picked per pageresources/layout.ts, resources/layouts/
UI components (coss ui: Base UI and Tailwind)resources/components/ui/
The theme: colours, fonts, radiusresources/app.css
Navigationresources/components/navigation.ts

The components are your own code, copied into the app. Add more with npx shadcn add @coss/<name>.

Everything else

  • lang/: translations, one folder per locale (lang/en is the reference).
  • drizzle/: migrations, committed with the code (caldera db:generate).
  • tests/: Vitest tests, and Playwright browser tests in tests/browser/.
  • public/: files served as they are, including the production build of the pages.
  • .caldera/: generated types and registries. Don't edit them; caldera dev and caldera generate rewrite them.
  • AGENTS.md: how the app is laid out and what's in it, for people and coding agents. Its lists of routes, models, jobs and channels are regenerated as you work.

On this page