Construction sequence · 6 floors · 2 full sheets

Build from the foundation up.

Typed TypeScript packages. Dot composes them into one app, and the compiler checks the wiring. With the journal nothing writes to a row directly: every change is an event, and a reducer turns it into the row in the same transaction. Each floor is one step; the two that matter most come with their own drawing sheet.

bun add @arki/dot

F1 · Define · what a Dot app is

Read one chain. That is the whole app.

A Dot app is a list of units. Each unit says what it provides and how it shuts down. start() boots the list top to bottom; dispose() closes it bottom to top. If a unit is not in the chain, it does not run.

Detail · DefineD-1
packages/dot/README.md · lines 33, 41–49, 72–74, 81–82 · the quick start, runnable
import { defineApp, infra } from '@arki/dot';const database = infra({  name: 'database',  provides: {    db: () => openDb(process.env.DATABASE_URL), // ← one factory per key; may be async  },  async dispose({ db }) {    await db.close();  },});const app = await defineApp('pizzeria')  .infra(database, stripe) // providers before consumers — enforced at compile time  .start();await app.stop();await app.dispose();
apps/avocabo/backend/src/app.ts · lines 16, 18, 21, 23–31, 42–48, 65–66 · a real app
import { defineApp, logHandlers, token } from '@arki/dot';import { tanstackStart } from '@arki/tanstack-start/dot';import { features } from './features';import { sentryErrors } from './entrypoints/middleware';import { gateway } from './entrypoints/gateway';import { database } from './infra/db';import { cache } from './infra/kv';import { authn } from './infra/auth';import { audioStorage } from './infra/audio-storage';import { locking } from './infra/locks';import { appMail, emailClient } from './infra/mail/client';import { embedding, vectorErasure, vectors } from './infra/vectors/vectors';export const app = defineApp('avocabo', { observers: [sentryErrors, logHandlers()] })  .infra(database, cache, appMail, emailClient, authn, locking, embedding, vectors, vectorErasure, audioStorage)  .features(features)  .entrypoints(    hostClock,    gateway,    tanstackStart({    }),  );
.infra(…)
What the app runs on: Postgres, a cache, mail, sign-in, locks, vector search, audio storage.
.features(…)
What the app does: its features.
.entrypoints(…)
How the world gets in: the cron clock, the RPC gateway and the web server.

F2 · Wire · the compiler checks the order

Put a unit before what it needs. It will not compile.

Units boot in the order you list them. A unit that needs db must come after the unit that provides it. Swap them, and your editor rejects the line before anything runs.

Elevation: providers below consumers.

sessions and orders both need db. The database unit provides it, so it must come first.

packages/dot/docs/examples/quickstart.ts · lines 9–10, 32–34, 47–48 · two units that need db
import { defineApp, infra } from '@arki/dot';import { defineFeature } from '@arki/dot/feature';export const sessions = infra({  name: 'sessions',  needs: { db: database.provides.db }, // the handle, not a string: a typo cannot compileexport const orders = defineFeature('orders')  .needs({ db: database.provides.db })
packages/dot/docs/examples/quickstart-wrong-order.mjs · lines 8, 10, 13 · the mistake
import { defineApp } from '@arki/dot';import { database, orders, sessions } from './quickstart.js';export default defineApp('shop').infra(sessions, database).features([orders]);

TypeScript · packages/dot/src/define-app.ts

Property ''DOT: a unit in this list cannot be mounted at its position'' is missing in type ...
  ... NeedsError<EmptyShape, WireNeeds<{ db: Handle<..., "db", "database">; }>> ...

Plain JavaScript has no type check, so the kernel checks too. It stops the app at configure, before any boot hook runs. Its error, ARKI_DOT_E020, names both units and their positions.

Every list boots left to right: .infra() first, then .features([…]), then .entrypoints().

F3 · Feature · model · usecases · infra · entrypoints

Open a feature and read what your product does. The plumbing waits outside.

A feature is one part of your product, like the waitlist. In the middle are its rules: the model, the things it knows, and the usecases, what someone can do: sign up, unsubscribe, count. They are plain functions, with no HTTP, no SQL and no email in them. Around them sit the infra, how the feature talks to the outside, and the entrypoints, how a request gets in. So you read what your product does in one place, test a rule by handing it only what it names, and change the storage or add a new way in without touching a rule. The infra can never reach into the rules: the types forbid it. A feature joins the app with one line.

  • modelthe things and their rules
  • usecaseswhat someone can do
  • infrahow it talks to the outside
  • entrypointshow a request gets in
Detail · FeatureD-3
apps/avocabo/backend/src/features.ts · lines 48, 53–54, 74, 84 · one line per feature
import { waitlist } from './features/waitlist/feature';export const features = [  health,  waitlist,] as const;
apps/avocabo/backend/src/features/waitlist/feature.ts · lines 11, 15–17, 20–22, 30–38
import { defineFeature, entrypointOnly } from '@arki/dot/feature';import { database } from '../../infra/db';import { cache } from '../../infra/kv';import { emailClient } from '../../infra/mail/client';import { limiter } from './infra/signup-limiter';import { store } from './infra/store';import { turnstile } from './infra/turnstile';const waitlistDeps = defineFeature('waitlist')  // The store binds `db`, the signup limiter binds `kv`; usecases never see them.  .needs({    db: entrypointOnly(database.provides.db),    kv: entrypointOnly(cache.provides.kv),    // The app's outbound email client; a test fakes the plugin.    mailer: emailClient.provides.emailClient,  })  .infra(store, limiter, turnstile);
.needs({…})
What the feature takes from the app: the database, the cache and the mailer.
entrypointOnly(…)
This service goes to the feature’s infra and entrypoints only. Usecases never see it.
.infra(…)
How the feature talks to the outside world: a store, a rate limiter and a bot check.
Pick<Deps, 'repos'>
A usecase names the services it uses. This one uses the repos and nothing else.
apps/avocabo/backend/src/features/waitlist/usecases/public-count.ts · lines 1, 7–16
import type { Deps } from '../feature';export const publicCount =  ({ repos: { entries } }: Pick<Deps, 'repos'>) =>  async () => {    const [pending, invited, activated] = await Promise.all([      entries.countByStatus('pending'),      entries.countByStatus('invited'),      entries.countByStatus('activated'),    ]);    return { total: pending + invited + activated };  };

F4 · Remember · @arki/journal · five things you can try

Crash it. Retry it. Nothing pays twice, nothing gets lost.

Chapter · @arki/journalsheets J-100 to J-104 · every code line is copied from a real file

Every change is saved with its history and its follow-up work in one go, and you can always prove the table is right.

Simulated in your browser. The code is real.

J-100 · the row is a replay

Your row is its events, replayed.

An entity is a normal Postgres table plus a few small functions called reducers. Each reducer says what one event does to the row. Append an event, and its reducer patches the row in the same transaction. The row stays a plain table you select from. Like event sourcing, without the complexity.

Replaying through version 1 of 2. The live row stays at version 2.

journal_events · the history of order ord_42
seqversiontypedata
421OrderPlaced{ customerId: 'cus_ada', total: 950 }
432OrderPaid{ amount: 950 }
orders · the live rowselect * from orders where id = 'ord_42'
idcustomer_idtotalstatusversion
ord_42cus_ada950paid2
Only status and version changed: .on returned a patch.
journal.replay(db, order, 'ord_42', { throughVersion: 1 })the same reducers, folded from nothing, up to that version
idcustomer_idtotalstatusversion
ord_42cus_ada950placed1
A read, not a write: the live row is untouched · README.md:366

Why it matters: you get the full history and can rebuild any row at any version, but you still read and query a normal table. Sheet J-103 works because of this.

packages/journal/README.md · lines 46, 52, 69–71, 73–77
import { CommandConflict, CommandNotFound, initJournal, need } from '@arki/journal';export const j = initJournal({ tables, meta: z.object({ actorId: z.string() }) });export const OrderPlaced = j.event('OrderPlaced', z.object({ customerId: z.string(), total: z.int().positive() }));export const OrderPaid = j.event('OrderPaid', z.object({ amount: z.int().positive() }));export const OrderCancelled = j.event('OrderCancelled', z.object({ reason: z.string().min(1) }));export const order = j  .entity('order', orders)  .create(OrderPlaced, e => ({ customerId: e.data.customerId, total: e.data.total, status: 'placed' }))  .on(OrderPaid, () => ({ status: 'paid' })) // a patch: only the columns that change  .on(OrderCancelled, () => null); // null deletes the row; the events stay

J-101 · all or nothing, then the follow-up work

Pull the plug. Nothing is written, or all of it.

One command, payOrder, makes four writes in one transaction: the event, the row, the inline projection, and the job for the email. Cut the power at any point and Postgres never sees a commit, so none of the four exist. Let it commit, and only then can a worker pick up the job. The job id is the email's idempotency key, so a worker that dies after sending can run the job again and the inbox still shows one email.

Second attempt, same job id, still one email.

  1. 1 event
  2. 2 row
  3. 3 projection
  4. 4 job
  5. commit

one transaction · committed

journal_events · new rowseq 43 · v2 · OrderPaid · { amount: 950 }appended first · write.ts:272
orders · the roword_42 · status: placed → paid · version 1 → 2.on(OrderPaid, () => ({ status: 'paid' })) · README.md:76
customer-stats · inline projectionRan in this transaction. It listens to OrderPlaced only, so OrderPaid leaves placed: 1 as it is.README.md:93 · write.ts:378
journal_jobs · new rowjob_c4m · effect: order-mail · event_seq: 43effect 'order-mail' · write.ts:405

after commit · the worker's side

journal_jobs · job_c4meffect: order-mail · attempts: 2
acked on attempt 2: doneA worker can pick up the job only after the commit. A job row that never committed does not exist.
inbox · [email protected]order-paid · ord_42 · idempotencyKey: job_c4mStill 1 email after 2 attempts: the provider deduped the second send on its key.
same job id, one emailThe job ran twice as job_c4m. The mail provider dedupes on that key, so the second send changes nothing.

Proof: src/journal.test.ts:245 “a throwing projection rolls back events, row and jobs” · src/jobs.pg.test.ts:166 “a crash after the external effect, before the ack, repeats the job under the same id”.

packages/journal/README.md · lines 46, 81–90, 106–114
import { CommandConflict, CommandNotFound, initJournal, need } from '@arki/journal';export const payOrder = j.command(  'payOrder',  z.object({ orderId: orderIdSchema, amount: z.int().positive() }),  (input, { write }) =>    write(order, input.orderId, row => {      if (!row) return CommandNotFound({ detail: 'Order not found' });      if (row.status !== 'placed') return CommandConflict({ detail: `Order is already ${row.status}` });      return [OrderPaid({ amount: input.amount })]; // [] means: write nothing    }),);export const orderMail = j.effect(  'order-mail',  order,  { mailer: need<Mailer>() },  {    OrderPaid: (e, { jobId, mailer }) =>      mailer.send({ template: 'order-paid', orderId: e.entityId, idempotencyKey: jobId }),  },);
packages/journal/src/write.ts · lines 19, 154, 314–318, 368, 386–389, 434 · the four writes, in order
import type { PgStore } from './store.js';        const storage = deps.store.bind(sp);          await route.log.bind(sp).append({            kind: entity.kind,            entityId: id,            expectedVersion: baseVersion,            events: appended,          const updated = await storage.rows.update(entity, id, { ...next, version: finalVersion }, stored);        for (const event of recorded) {          for (const projection of projections) {            if (projection.types.has(event.type) && projection.entities.some(e => e.kind === entity.kind)) {              await projection.run(sp, event);        await storage.jobs.enqueue(jobs);

J-102 · idempotency receipts

The webhook arrives three times. The handler runs once.

A payment provider sends a webhook again until you answer. Run the command with the event id as its idempotency key. The first run claims a receipt row and does the work. Every later run with the same key finds the receipt and answers with the stored result. It writes nothing. The same key with a different body is refused as a CommandConflict.

Delivery 3: same reply, the handler did not run, nothing written.

handlerruns: 1how many times the command body ran
journal_receiptskey: 'stripe:evt_1Ab3' · command: 'payOrder' · input: { orderId: 'ord_42', amount: 950 } · result: { value: … } · command_id: 'cmd_8d1'key · command · input · result · command_id
journal_events
  • seq 43 · v2 · OrderPaid · command_id: cmd_8d1
one OrderPaid, whatever the delivery count
replies · what each delivery got back
deliveryreplyhow
1{ row: { status: 'paid', version: 2 }, events: [OrderPaid] }the handler ran, the receipt was written
2{ row: { status: 'paid', version: 2 }, events: [OrderPaid] }from the receipt: the handler did not run, nothing written
3{ row: { status: 'paid', version: 2 }, events: [OrderPaid] }from the receipt: the handler did not run, nothing written

Proof: src/command.test.ts:593 “a repeat with the same key and input returns the first result without running the handler again”.

packages/journal/src/command.ts · lines 24, 28, 76–79, 85–88
import { CommandConflict, JournalError } from './errors.js';import { assertRoundTrips, sameValue } from './storage.js';    const held = await deps.store      .bind(tx)      .receipts.claim({ key, command: name, input: throughJson(input) ?? null, commandId: own });    if (held === undefined) return undefined;    if (held.command !== name)      return CommandConflict({ detail: `the idempotency key is held by command "${held.command}", not "${name}"` });    if (!sameValue(held.input, throughJson(input) ?? null))      return CommandConflict({ detail: `the idempotency key was used by command "${name}" with a different input` });

J-103 · verify, repair, forget

Someone edits the database by hand. Prove it, fix it, forget what you must.

Because the row is a replay of its events (sheet J-100), the journal can always check it. verify folds the events and compares, column by column. repair writes the folded row back, and queues no job. forget rewrites the events that hold personal data to their erased form, stamps them, and repairs the row so it matches. The history still replays.

1 column drifted. Repair writes the folded row back and queues no job.

orders · the live rowselect * from orders where id = 'ord_42'
idcustomer_idtotalstatusversion
ord_42cus_ada950shipped2
Edited by hand with a plain UPDATE. No event says so.
verify · expected and actual
columnexpectedactual
statuspaidshipped
expected: the reducers folded over journal_events
journal_events · history of ord_42 · the source of truth
seqversiontypedataerased_at
421OrderPlaced{ customerId: 'cus_ada', total: 950 }null
432OrderPaid{ amount: 950 }null

The README's own OrderPlaced has no erased form. Here it is given one that blanks customerId, the way README.md:260 shows.

Proof: src/journal.test.ts:583 “verify reports a drifted row and repair fixes it from the log” · src/journal.test.ts:688 “forget rewrites the events that have an erased form, stamps them, and repairs the row to match”.

packages/journal/README.md · lines 46, 73–77
import { CommandConflict, CommandNotFound, initJournal, need } from '@arki/journal';export const order = j  .entity('order', orders)  .create(OrderPlaced, e => ({ customerId: e.data.customerId, total: e.data.total, status: 'placed' }))  .on(OrderPaid, () => ({ status: 'paid' })) // a patch: only the columns that change  .on(OrderCancelled, () => null); // null deletes the row; the events stay

Other verbs: replay(db, entity, id, { throughVersion }) (returns the reducer-shaped row), verify(db, entity, id), repair(db, entity, id)

README.md:477

journal.forget(db, entity, id) rewrites every stored event of that entity that has an erased form to it, sets erased_at on those rows, and then repairs the row from the rewritten log, so the row and its history agree. All in one transaction.

README.md:373

An event that can hold personal data declares its erased form: j.event('MessageSent', schema, { erased: data => ({ ...data, content: '' }) }).

README.md:371

J-104 · durable workflow · next · not on npm yet · latest published is 0.2.1

A refund that survives a restart and undoes itself.

A workflow is a list of steps. Every step writes a checkpoint event before and after it runs. Restart the server in the middle of a step and the run goes on from the last checkpoint. The step runs again with the same key, so the provider makes one refund. The run then waits until the provider's webhook sends a signal, or three days pass. Cancel it and the undo functions run, newest first.

Done. One signal, one finish, one refund at the provider.

  1. hold
  2. payBack
  3. settled · waitFor 3d
  4. finish
journal_events · the run's history, one row per checkpoint
seqtypenodenote
70RunStartedpayments.refund v1 · input { paymentId: 'pay_3x', amount: 950 }
71NodeScheduledholdkey 'wfr_9k2:hold:do'
72NodeCompletedholdresult { holdId: 'hold_2q7' }
73NodeScheduledpayBackkey 'wfr_9k2:payBack:do'
74NodeCompletedpayBackresult { refundId: 're_5t8' }, checked by output
75Parkedsettledwaits for 'provider.refund.settled' · timeout 3d
76SignalReceivedsettled'provider.refund.settled' · { settledAt: '2026-10-21T14:02:00Z' }
77NodeCompletedsettledresult: the signal payload
78RunCompletedoutput { refundId: 're_5t8', settledAt: '2026-10-21T14:02:00Z' }
provider · paymentshold calls: 1 · refund calls: 1 · release calls: 0
refunds made: 1Every try of payBack sends the same key, so the provider makes one refund.
compensation · newest firstnot runningA step without undo is skipped, and its work stays done.

The run's signal is provider.refund.settled, the one named in the code below.

Proof: src/workflow/runner.test.ts:459 “crash after external success before checkpoint re-runs the step with the same key, and the committed checkpoint never runs it again” · src/workflow/compensation.test.ts:311 “cancel on a parked run undoes completed steps in reverse and ends cancelled” · src/workflow/compensation.test.ts:399 “a dead step waits for an operator by default and compensates with onDeadStep” · src/workflow/wait.pg.test.ts:155 “a signal that commits while the timeout is in flight wins, and the timeout commits nothing”.

packages/journal/README.md · lines 977, 1004–1013
import { z } from 'zod';  .step('hold', ({ input, payments }) => payments.hold(input.paymentId, input.amount), {    undo: ({ result, payments }) => payments.release(result.holdId),  })  // `key` is the same on every try of this step: the provider dedupes on it. `output` checks the stored result, so  // `def.read` types it and an operator can supply it by hand (`resolveStep`).  .step('payBack', ({ input, key, payments }) => payments.refund(input.paymentId, input.amount, key), {    output: z.object({ refundId: z.string() }),  })  // The run parks here until the provider's webhook sends the signal.  .waitFor('settled', { signal: 'provider.refund.settled', schema: Settled, timeout: '3d' })

F5 · Serve · TanStack Start

One call serves the app. Every route gets its services, typed.

TanStack Start serves the web app, and it is one entrypoint in the chain. startServer starts the app once per process. Then every request gets the started app on context: its services, an RPC client and the caller’s session, all typed.

Detail · ServeD-5
apps/avocabo/start/src/server.ts · lines 9–10, 16–17, 19, 47–51
import { app } from '@avocabo/backend/app';import { createStartHandler, defaultStreamHandler } from '@tanstack/react-start/server';import { startServer } from '@arki/tanstack-start/server';import { withServerErrorOverlay } from '@arki/tanstack-start/server-error-overlay';import { env } from '~/env';export const server = startServer(app, {  hot: import.meta.hot,  eager: env.NODE_ENV === 'production',  handler: withServerErrorOverlay(createStartHandler(defaultStreamHandler)),});
apps/avocabo/backend/src/app.ts · lines 18, 24, 27, 48–51
import { tanstackStart } from '@arki/tanstack-start/dot';import { gateway } from './entrypoints/gateway';import { authn } from './infra/auth';    tanstackStart({      needs: { rpc: gateway.provides.rpc, auth: authn.provides.auth, scheduler },      session: ({ auth }, request) => auth.principal(request.headers),      rpc: ({ rpc }, request) => rpc.client(request.headers),
apps/avocabo/start/src/routes/waitlist/unsubscribe.tsx · lines 1, 3, 38–41, 53–54
import { createFileRoute } from '@tanstack/react-router';import { orThrow } from '@arki/failure';export const Route = createFileRoute('/waitlist/unsubscribe')({  server: {    handlers: {      GET: async ({ request, context }) => {          const { waitlistUnsubscribe } = context.services;          const outcome = orThrow(await waitlistUnsubscribe.byToken(token));
context.services
Every service the app provides, typed. Here, the waitlist’s unsubscribe.
context.rpc
The app’s RPC client. It calls the procedures in the same process.
context.session()
Who is calling, read from the request headers.

F6 · Inspect · and test

See every unit before it runs. Then start the real app in a test.

dot explain prints every unit, what it needs and what it provides. It never boots, so no connection opens. dot doctor boots the app for real, then shuts it down. A test starts the same app you ship.

Detail · InspectD-6
packages/dot/docs/quickstart.md · lines 169, 191–195 · the command, then its real output
dot explain --app src/app.ts --json | jq -c '.data.plugins[], .data.dependencies[]'{"name":"database","role":"infra","dependencies":[],"provides":["db"]}{"name":"sessions","role":"infra","dependencies":["db"],"provides":["sessions"]}{"name":"orders","role":"feature","dependencies":["db"],"provides":["orders.usecases","orders.services","feature.orders","orders"]}{"from":"sessions","to":"database","kind":"requires","key":"db"}{"from":"orders","to":"database","kind":"requires","key":"db"}
Real output · dot explain --app src/app.ts --graph run on avocabo (prelaunch). Built with arki. The first lines of 449.
flowchart TD  %% numbers = boot order  subgraph infra["infra · what features need"]    p0["1 · db"]    p1["2 · kv"]    p2["3 · mail"]    p3["4 · email-client"]    p4["5 · auth"]    p5["6 · locks"]    p7["8 · vector-index/embeddings"]    p8["9 · vector-index/vectorIndex"]    p10["11 · account/repos"]    p11["12 · account/outboundMail"]    p13["14 · billing/repos"]…
packages/dot/docs/quickstart.md · lines 207, 232–236 · the command, then its real output
dot doctor --app src/app.ts --json | jq -c '.data.status, (.data.plugins[] | {plugin, status}), .data.issues'"success"{"plugin":"database","status":"ok"}{"plugin":"sessions","status":"ok"}{"plugin":"orders","status":"ok"}[]
demos/faultline/backend/src/delivery.test.ts · lines 1, 4–5, 10, 14, 24–33
import { afterAll, beforeAll, describe, expect, it } from 'vitest';import { isFailure, orThrow } from '@arki/failure';import { listen } from '@arki/http';import { app } from './app';import { hooksEngine } from './hooks';beforeAll(async () => {  started = orThrow(await app.start());  // The worker's HTTP calls (reports, partner webhook, mail provider) reach this server (WEB_ORIGIN).  server = await listen(hooksEngine(started.services.db), { port: 3576, hostname: '127.0.0.1' });});afterAll(async () => {  server.forceClose();  await started.dispose();});

Structure · the mental model

Plain values, typed failures, declared wiring.

Most code is now written by an agent and read by one. So the rules live in the compiler, the lint rule and the test, not in a convention someone has to remember. A function returns its value or a failure. A unit declares what it needs. Work runs in a scope that owns it. The explicit form is the point: no magic, nothing to unwrap, no runtime to learn.

Returns

The value itself, or a failure. Nobody writes the union; the compiler infers it, and the lint rule reports a call that throws a failure away. Bugs still throw.

packages/failure/README.md · lines 26, 28–32, 34–35, 37–38 · nobody wrote the return type
import { defineFailure, isFailure } from '@arki/failure';const EmailTaken = defineFailure('user.email_taken', {  status: 409,  data: z.object({ email: z.string() }),  message: 'email {email} is taken (someone beat you to it)',});const taken = new Set(['[email protected]']);const signUp = (email: string) => (taken.has(email) ? EmailTaken({ email }) : { email });const result = signUp('[email protected]');if (!isFailure(result)) throw new Error('expected a failure');
Needs

Declared on the unit, once. A unit names the handle it takes. If no unit before it provides that handle, the app will not compile, whether the provider comes later or not at all.

packages/dot/README.md · lines 33, 51–53, 58–60 · the handle is typed
import { defineApp, infra } from '@arki/dot';const stripe = infra({  name: 'stripe',  needs: { db: database.provides.db }, // typed handle — destructure in hooks  provides: {    stripe: ({ db }) => makeStripeClient(db), // factories see the needs  },
Runs

Owned work on plain Promises and AbortSignal. A scope joins every task it started, then runs cleanup newest first. No fibers, no effect type.

packages/async/README.md · lines 161, 165–171 · cleanup runs newest first
import { cleanup, resource, scoped } from '@arki/async';const rows = await scoped({  db: resource(    () => ({ query: () => ['select 1'] }),    () => { events.push('db closed'); },  ),  metrics: cleanup(() => { events.push('metrics flushed'); }),}, ({ db }) => db.query());

Nameplate · real apps

Built with arki

avocabo

Newsletter digest. 26 features, one Dot chain, TanStack Start as the front door.

apps/avocabo/backend/src/app.ts

kapodopera

Payments. The refund workflow starts from RefundApproved and waits for Stripe's signal.

apps/kapodopera/backend/src/features/_shared/payments/journal.ts

everseek

Webhooks write to the journal as the system actor.

apps/everseek/backend/src/core/run-command.ts

games-platform

Taps fan out realtime after commit, so subscribers never hear a rolled-back change.

apps/games-platform/backend/src/journal.root.ts

foreman

Trust changes as journal events, with an atomic staleness check: a stale write returns CommandConflict.

apps/foreman/backend/src/features/enrollment/journal.ts

faultline

Small demo. The test starts the real app.

demos/faultline/backend/src/app.ts

Materials · 5 release waves

The packages, by wave.

Every wave depends only on the waves below it. Import one and stop there.

W1 · FoundationValidate input. Return failures as values.
  • @arki/schema
  • @arki/failure
  • @arki/contracts
  • @arki/log
  • @arki/ts
  • @arki/date
  • @arki/string
  • @arki/clock
  • @arki/math
  • @arki/async
W2 · DOT KernelCompose packages into an app.
  • @arki/cli
  • @arki/dot
  • @arki/env
  • @arki/resilience
W3 · InfrastructureConnect Postgres, queues, mail and sign-in.
  • @arki/db
  • @arki/kv
  • @arki/http
  • @arki/journal
  • @arki/live
  • @arki/lock
  • @arki/mail
  • @arki/auth
W4 · FrontendPut a React interface on it.
  • @arki/icons
  • @arki/ui
W5 · SpecializedHandle money and payments.
  • @arki/money
  • @arki/payments

Site office · where to start

Start small. Grow by composition.

  1. Install the kernel.
  2. Scaffold an app with dot new. You get an env plugin and a boot test.
  3. Read the quickstart. It breaks the app on purpose and reads the error.
bun add @arki/dot
When not to use this
  • You need a web server or a router. Dot composes services; serve HTTP with TanStack Start, Hono or oRPC.
  • You want plugins loaded from disk or config. Dot never auto-loads.
  • The program has one or two services. A function with try/finally is shorter.
  • You need a scope per request. Dot has one service graph per app.
  • You are building a shed. A shed needs no blueprint.