DomainRuntime
The backend for your business domain: typed data, live queries, actions and durable workflows.
DomainRuntime is a hosted backend you define in TypeScript. You write your domain — the entities your business works with and the actions that change them — and DomainRuntime runs it: a database with live queries, authenticated actions, file storage and durable workflows, at a URL of its own.
Three words you will see everywhere:
- A domain is your data model and the operations on it, in one TypeScript file.
- An action is a named, typed operation that changes data. It is the only way data changes.
- An environment is a running copy of your domain with its own data and URL: one per developer, and one for production.
import { domain, defineAction, i } from "@domainruntime/domain";
import { z } from "zod";
export default domain("tasks")
.withSchema({
entities: {
tasks_task: i.entity({
title: i.string(),
done: i.boolean(),
createdAt: i.date().indexed(),
}),
},
links: {},
rooms: {},
})
.withActions({
create: defineAction({
input: z.object({ taskId: z.string().uuid(), title: z.string().min(1) }),
output: z.object({ taskId: z.string() }),
async execute({ input, runtime }) {
await runtime.tx((tx) =>
tx.tasks_task[input.taskId].update({ title: input.title, done: false, createdAt: Date.now() }),
);
return { taskId: input.taskId };
},
}),
});"use client";
import { db } from "@/lib/db";
export default function Tasks() {
const { data } = db.useQuery({ tasks_task: {} });
return (
<>
<button onClick={() => db.actions.tasks.create({ taskId: crypto.randomUUID(), title: "Ship it" })}>
Add
</button>
<ul>{data?.tasks_task.map((t) => <li key={t.id}>{t.title}</li>)}</ul>
</>
);
}The page reads live: open it in two tabs and both update. It never writes directly — every change is a call to an action you defined, with validated input and a recorded caller.
The domain above runs in production today.
runtime.tx and the db browser client are planned; each page shows what to write today. The status page lists every piece.Start here
- Quickstart — from an empty folder to a live environment.
- How it works — what runs where, and why writes go through actions.
- Using LLMs — rules and Markdown docs for your coding agent.
What you get
| Modeling data | Entities, links and indexes, typed end to end. | Verified |
| Reading data | Queries that update live when the data changes. | Verified (the db client is planned) |
| Actions | The only way data changes: validated, attributed, retry-safe. | Verified (runtime.tx, runtime.query planned) |
| Workflows | Long-running actions that survive restarts. | Verified in production |
| Files and streams | Uploads and ordered streams, stored with your data. | Verified (client helpers planned) |
| Environments | A development environment per developer, production from a release. | CLI on npm planned |
| Platform | A CLI and a platform SDK to manage it all from code. | Planned |