# DomainRuntime

URL: https://docs.domainruntime.dev/docs
Status: Guide
Reviewed: 2026-09-22



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.

```ts title="src/domain.ts"
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 };
      },
    }),
  });
```

```tsx title="src/app/page.tsx"
"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.

<div className="docs-note">
  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](/docs/reference/status)

   lists every piece.
</div>

## Start here [#start-here]

* [Quickstart](/docs/introduction/quickstart) — from an empty folder to a live environment.
* [How it works](/docs/introduction/how-it-works) — what runs where, and why writes go through actions.
* [Using LLMs](/docs/introduction/using-llms) — rules and Markdown docs for your coding agent.

## What you get [#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                                          |
