DomainRuntimedocs
Introduction
PlannedWhat works todayReviewed 2026-09-22

Project structure

The files a DomainRuntime app has and what each one is for.

Planned layout. create-app today also generates src/runtime.ts, instant.schema.ts and an /api/domain route for the standalone adapter; druntime does not need them.
my-app/
├─ src/
│  ├─ domain.ts              your domain: entities, links, actions
│  ├─ lib/db.ts              the browser client, typed from the domain
│  └─ app/                   your Next.js app
├─ .domainruntime/
│  ├─ dev.json               what druntime runs: domain entry and client commands
│  ├─ link.json              the project and environment this folder is linked to (druntime link)
│  └─ dev-session.json       the running development session (not in git)
├─ .env.local                DOMAIN_RUNTIME_URL and public configuration, written by druntime (not in git)
├─ DOMAIN.md                 your business in plain words, for people and agents
└─ package.json

src/domain.ts

The source of truth. The database schema, the typed client and the action endpoints are derived from it. Keep it free of UI code: it runs in the runtime, not in the browser.

For a larger product, split it and compose:

src/domain/
├─ index.ts        export default the root domain
├─ orders.ts       domain("orders").withSchema({…}).withActions({…})
└─ billing.ts      domain("billing").includes(orders).withSchema({…}).withActions({…})

.domainruntime/dev.json

{
  "name": "my-app",
  "domain": "src/domain.ts",
  "clients": [
    { "name": "web", "cwd": ".", "command": ["pnpm", "run", "dev"] }
  ]
}

clients lists the commands druntime starts and gives the environment's URL. Add an Expo or desktop app the same way. See Local development.

Naming

  • Domain names are camelCase: orders, supplierNetwork.
  • Entities are prefixed with their domain: orders_order, orders_lineItem. Entities share one namespace per environment and domains are composed, so the prefix keeps them apart and tells a reader which domain owns each one.
  • Action ids are <domain>.<action>: orders.place.

On this page