History and plan
On this page

This page is for how the backend half was built and the decisions it keeps. Milestone names appear here and nowhere else in the backend docs. What the product does today is on the other pages, starting at Backends.
The intent
Globetrotter is one studio for a whole project. A project is a frontend, a
backend, or both: one repo, separate codebases, sharing only designs/ and the
contract. The backend is controlled from the same UI as the pages. Languages are
targets you switch on, one or several at once, generated from the same service
file; you can run Python and Rust side by side against the same journeys and read
the traces before you choose. Every change on either side lands in the journal
and the memory, and the agent watches both sides: when a page asks for something
the service lacks, or a service changes under a page, it notices, names it, and
offers the fix.
Start anywhere

globetrotter init asks one question: frontend, backend, both or static. A
static site is a frontend whose pages bind nothing to a server. A backend-only
project has no frontend/; its studio (npx globetrotter dev) lists it on the
home page as a backend and opens on the Backend view, the agent beside it.
globetrotter add backend or add frontend bolts the other side on later, and
the contract that already exists becomes the new side's starting point.
One language, or two side by side

A backend names its targets in globetrotter.config.json (backend.targets);
backend.default is the one the pages talk to, and the rest run beside it on
their own ports. The Targets view lists each with what it leaves out, Compare
runs the same checks against each running target and reads their traces side by
side, and Make default moves the pages over at the next request. What is
still to write in the default target is the pages' to-do; another target's is
said on its own line and never makes a page look unready while the default
answers. Python and Rust ship; the picture is how a third would join. See
Targets.
One way through

Types are generated once from the service file into the language and into the OpenAPI file. Writes, audit rows and events share one transaction. Your code is the body of an operation and the body of a step; everything around it is generated and regenerated.
Agents in sync

Nobody holds a lock for long and nobody is told what another is doing in chat. Every hand reads the same five things before it acts (recall, status, who is here, the asks for it, what changed since its cursor) and writes through the same path: a hash, a short lock, a journal line. Disagreement between a page and a service is a lint on both files with the fix on the side that does not own the path.
What stays the same
Pages, the catalogue, validated ops, sync, memory, lint, status, the Agent tab
and the MCP tools: all of it carries over by name. A service file is validated by
the same rules as a design file (its primitives have a registry of their own, so
they never show up in Add); a generated Python package carries the same
@generated-hash as a generated page; an implementation module carries the same
@stub-hash as a binding module.
Decided
- The engine stays TypeScript; languages are plugins with a four-method contract .
- This repo. Three new packages:
primitives,target-python,target-rust. - Frontend and backend are separate codebases in one repo, sharing
designs/and the contract. - Python is generated async-only; Alembic runs the SQL migrations core emits
(Rust runs the same files with
sqlx::migrate!). - fieldops is the first generated backend: its seven hand-written route handlers and in-memory store are what M1 replaced, with its pages unchanged.
How it was built
The work was planned in milestones, each ending with something a person could use.
| Milestone | What it added |
|---|---|
| M0 | The service schema, the primitives catalogue, lint, the target contract and the write path (lock, journal, presence, asks). |
| M1, Python | A generated FastAPI backend that runs. fieldops' seven route handlers and in-memory store were replaced; its design, bindings and useApi() did not change. |
| M2, sign-in | Ways in, the role ladder, row rules, audit and the outbox. storefront's order needs a member. |
| M3, flows | Flows, the relay, the worker, jobs, observability, and the cache, files, search and notify primitives. |
| M4, the studio | The Backend tab, asks across sides, who_is_here, blame, contract drift, ready-made blocks and bookings. |
| M5, Rust | The Rust target, running beside Python on one database, compared and switched in the Targets view. |
The Rust target began as a smoke test of the target contract: a service's entities as a Rust crate that compiles and reads the rows the Python backend wrote.
The audit, from 12 November 2026
After M5 the whole backend half was read as a stranger would read it, and the findings became a second list, A1 to A11. It is still under way.
| Item | What it is | On 12 November |
|---|---|---|
| A1 | The backend docs rewritten as a set | being written |
| A2 | Fail closed: an unset environment refuses to start | done, both targets |
| A3 | Deployable as generated: Dockerfile, compose, .env.example, README, CI, ruff and pyright |
written, in the three examples |
| A4 | Safe defaults: CORS, security headers, a sign-in rate limit, pool settings, bounded lists | done, both targets (seed in Python only) |
| A5 | Build words out of generated comments | Python done |
| A6 | Vocabulary: what a service design can say | additions 1 to 8 built, the ninth awaits a decision |
| A7 | Studio: Overview and entity diagram first, then API, Migrations and More | built, with views for the new vocabulary |
| A8 | A flagship example at real size | open |
| A9 | Decisions asked of the user: resource routes and /v1, problem+json, the flagship example |
asked |
| A10 | Small wrong words in mail's flows and the studio | open |
| A11 | The docs walked by hand | open |
The vocabulary (A6) was specified and built the same day, on core, the catalogue, the Python target and the Rust target:
| Addition | What a design can now say |
|---|---|
| 1, queries | Filters, sort, paging by page or cursor, search fields. |
| 2, many-to-many | A joined relation, or one through an entity with fields of its own. |
| 3, tenants | Organisations, membership, a role in each, rows scoped in the repository. |
| 4, shapes | Answers that are not entity rows: counts, sums, typed hand-written answers. |
| 5, transitions | A state machine on an enum field, with guards and events. |
| 6, clients | A typed outbound HTTP client with timeout, retry and a breaker. |
| 7, webhooks | Signed inbound webhooks, each event handled once. |
| 8, object storage | Files in an S3-compatible bucket. |
| 9, route shapes | Resource routes, a version prefix, problem+json: not built, awaiting a decision. |
What was built differently from the specification, and what is left, is in plans/vocabulary-a6.md.
13 November 2026
- Input rules, in one place. How a create and an update read a value is core's, and both targets follow it: decimals as text, a blank optional value not given, a 409 that names a taken key or unique value, an update held to its field's rules and changing only what is sent, a link checked before it is set (a 404 that names the row it points at) (Reference). They came from using storefront's catalogue and fieldops' technicians, not from the plan.
- The examples grew to real size (A8). Storefront has a catalogue with filters, a sort, cursor pages, a search and pictures, and payment by a signed webhook. Fieldops has technicians as rows, counted reports, Undo kept in a table, sign-in by API key, a state machine for a job, a work list, photos, a scheduled job and a flow. Each was pressed on Python and again on Rust from a scratch copy; the transcripts are in Targets.
- Credentials read strictly. The Python target decodes a session cookie, a magic link and a passkey state as base64url only; a malformed one is the 401 a wrong one is. A generated test presses the API key and the session cookie; the magic link and the passkey state are not pressed.
- A service may be named Wiring, Auth, Jobs or Flows. Its module keeps the
name; the generated one moves beside it. A service named as a built-in router
(Files, Session, Token and six more) keeps its router too: the built-in one
is
routers/builtin_<name>.py. - A refused delete says why. A delete that rows still point at answers
409,
This team still has members: remove or move them first., on both targets (Reference); fieldops'Technicians.removeis the example. - Unique, added later. A field made unique after its table was made, or a column added unique, writes its migration, with the query that finds rows sharing a value.
- A changed delete rule writes its migration. A relation's
onDelete, or the entity it points at, changed on a table that is there: postgres makes the constraint again, sqlite's file is the rebuild to run by hand (fieldops'0007_on_delete_job_assignee_id.sql). - mysql keeps links. Each is a named constraint of its table
(
<table>_<column>_fkey), join tables too, and a rename carries the name. A store written before is told bysync, which writes the statements that add its keys (mysql-foreign-keys.sql, a stub: rewritten to what is still owed while untouched, kept once edited) and names the ones still lacking until the migrations hold each. Written, never run. - Dropped tables go in order. In one migration, the table that points at another is dropped first; two that point at each other lose the keys between them first (sqlite defers its checks).
- Links, row times and null. A list is kept by a link
(
?assignee=<id>) and ordered bycreatedAtorupdatedAt, andnullempties a field whose param saysclears. Pressed on both targets on a scratch copy of fieldops. - A where on a link or a row time, and a link emptied by null. A list's
fixed
wherenames a single link (assignee=<id>,!=,=null,!=null) or a row time (updatedAt>=<instant>), andnullempties an optional link whose param saysclears. Pressed on each target on its own scratch copy of fieldops, sqlite only. - Times on sqlite compared as instants. Found while pressing the above: a
seed's
2026-01-01T13:00:00+00:00and the app's2026-01-01 13:00:00.000000were compared as text, so a cursor over a time came back out of order and looped on aT-form row. Both targets now compare, order and page by the instant (julianday, to the millisecond); no row is rewritten. Times within a millisecond tie, and the key decides. - An audit row does not keep a personal value. A
personalfield reads"[personal]"inbeforeandafter,nullwhere there was none: the row says the field was touched and by whom, not what it was. Both targets wrote identical rows on one sqlite file. - Checkpoint three was green. 637 tests; the studio and mail end to end 398, fieldops 57, storefront 57; presses, a11y, monkey, journeys, tour and states; ruff and pyright on the three backends. Not exercised: postgres and mysql, and the mysql keys and drop cycles beyond their tests.
- An index on a time works on sqlite. It is written as an index of
julianday(col), the expression the lists order by; fieldops has one onupdatedAt(migration 0008). - Checkpoint four was green. 640 tests; the studio and mail end to end
398, fieldops 57, storefront 57. On a scratch fieldops, migrations through
0008 by its own runner, then Python and Rust on one sqlite file holding
three forms of time:
/workby assignee, unassigned and byupdatedAtwith a cursor to the end gave the same answers, order and audit rows, and Rust took a cursor Python gave. Not run this time: the studio's Backend view, presses, a11y, monkey, journeys, tour, states, ruff, pyright, postgres, mysql. - fieldops unassigns a job (14 November).
Work.assignsentassigneeId: nullgives the job back to nobody; the param is required and saysclears, which both targets take. Checkpoint five was green: 645 tests; the studio and mail end to end 398, fieldops 57, storefront 57; on one sqlite file Python and Rust answered assign,null, an unknown key, a missing and a wrong-typed one with equal statuses and errors. The showntechniciantext differed (Python's body writes it; the Rust copy had only the generated body), and was equal, audit rows too, once the same body was written in a scratch Rust crate. Not run: presses, a11y, monkey, tour, states, journeys, postgres, mysql. - An audit row names the operation that wrote it (14 November):
Work.assign,job:flagOverdue. An existing project gets the column from a migrationsyncwrites (fieldops0009, storefront0012, mail0004); rows kept before it say none. Both targets wrote the same values on one sqlite file. A flow step's and a webhook's row were not pressed. - Rust says a database is behind, as Python does (14 November): the
start line,
/ready503, an audited command 503 and the audit reader, each naming the runner that owns the database. Its sqlite is built withSQLITE_DQS=0(backend/.cargo/config.toml), so a missing column is an error, never a wrong answer. Checkpoint six was green: 653 tests; the studio and mail end to end 399, fieldops 57, storefront 57; the audit'soperationequal on both targets on one sqlite file. It found Python on a database the Rust runner applied naming the wrong runner; fixed the same day, and Python'smigratenow refuses such a database. Not run: presses, a11y and monkey for fieldops, tour, states, journeys, postgres, mysql. - fieldops on both targets, and on Postgres (15 and 16 November):
fieldops keeps a Rust crate beside its Python bodies (
ruston 8010, Python the default); pressed side by side, the pages' operations gave the same answers. A flow step's own write names the flow as its principal on Rust as on Python.sync --checkwithout cargo passes with a warning;GLOBETROTTER_REQUIRE_CARGO=1fails. fieldops' Python backend ran on Postgres 16: migrated, pressed, 29 contract tests passed against it. That run found the ids ofaudit_log,outboxandflow_runwritten as text where Postgres holds a uuid, so every audited write answered 500; fixed.globetrotter a11ytakes--theme darkand--open <dialog>. Python's repository now holds a create and an update to the design's rules, as Rust's does; with that, every fieldops operation was pressed on both targets and the audit rows were equal, 13 and 13. CI installs the Rust toolchain and fails without cargo (not yet run on GitHub). Two targets'.gitignorelines land in one file. Not run: mysql, Redis. - Rust on Postgres, a later engine, the same rules (16 November):
fieldops' Rust crate ran on Postgres 16 beside Python: its own runner
applied 0001 to 0009, 39 presses answered the same, 22 audit rows each; the
Rust audit reader now prints
via <operation>as Python's. That run found that an engine added later made the first engine's next migration fail (duplicate column name: operation); now the new engine's0001is the present schema,NNNN_nothing_here.sqlkeeps the numbers level, and anADD COLUMNgoes only to the engine that lacks it. A generated create on Rust refuses in Python's words: every missing value at once, a link marked Always under its field (it was a 404), an end before its start (it was kept); the crate gainstests/rules.rs. In the studio's bar people keep their order, earliest first, and one who leaves comes back last. Not run then: mysql, Redis, Schemathesis against Rust on Postgres, a rule on an update. - MySQL, bounded strings, one 400 (16 November): fieldops' Python
backend ran on a real MySQL 8.4. Two faults showed first: the runner sent a
whole file as one statement, and a
TEXTdefault was not an expression; both fixed. A failed migration on mysql no longer says "rolled back". The contract suite on the live servers then found two 500s: a value longer than itsVARCHAR(255), and a NUL on Postgres. Now astringwith no max is 255 in the contract and the rules, and no text takes a NUL, params and sign-in included. The first cut checked every request in one place in the Python app; checkpoint nine was red on it: it read the body a second time, so every upload answered 500, and it refused a NUL where the contract allows one, so the suites of all three examples failed. It was removed: each target refuses only where the contract says. After that the suite was 29 passed, 40 skipped on Postgres (three runs) and on MySQL (two). Rust now says what is missing with the rules, one 400 as Python; the Python suite passes against fieldops' Rust binary on sqlite. Not run: the 40 in-process tests on a live engine, Rust on mysql, Rust on Postgres since these changes, tenants and managed keys live, Redis. - fieldops ships on Postgres; migrations lock and go back; the image runs
(16 to 18 November): fieldops' own database is Postgres 16 from its compose
file (
127.0.0.1:5440, no.env), no scratch copy; its in-process tests ran on it, 69 passed.migratetakes a lock per database (Postgres advisory, MySQLGET_LOCK, a sqlite lock file) and--down [--to NNNN]runs the down files sync now writes; a down that cannot be honest is one-- REFUSED:line. The Rust runner took the same lock, and six findings of its review were fixed (the state read inside the lock, a pool of one, no statement timeout on the migrate connection, a false unlock refused,--downwith no revisions, Windows). The Python image was built and run once: 389 MB, non-root, healthy; its.dockerignorefirst let the Rust build's folders in (632 MB). Strings are bounded at 255 and no text takes a NUL, on both targets. Not run: the pages against fieldops on Postgres, Redis, the Rust and MySQL images, MySQL locks, the false-unlock path (Limits; Postgres, lock and down, Rust lock, image). - No suppressions. The Python target emits no
# noqaand no# type: ignore: generated code passes ruff and pyright as written. - Mostly SQLite. One backend ships on Postgres (fieldops; Python, and Rust beside it on a scratch copy) and ran on MySQL (Python only); nothing was run on Redis (Limits).
19 November 2026
- What a first project met. A walk from an empty folder, a list of tasks
with an
addcommand and an optional date, found six things, now fixed. A param made from an optional field is optional, a blank optional date is left out, and the contract allows""only where optional. A command namedaddis read as a create, in the studio and inadd_operationalike; one reader,operationOwnership, says whether a command is generated or yours, and the Command card (Why, To have it generated) and the 501 of both targets use its words. A refusal names every refused field at once, under JSON names, with a page's form fields asdraft.<field>, the same body from both targets (transcript). A failed load shows no sample rows. A Form page named after an entity takes its fields; the data contract panel says an action nothing answers and offers Calls. The Migrations note prints the project's own migrate command, and the field review reads the last written migration. Not run: Postgres and MySQL (Reference).
The plan
The full plan, with the research, the stack picks and versions, the milestones
M0 to M6, the risks and the review history, is
plans/globetrotter-for-backends.html.
The plan's pictures on this page are taken from it by docs/plan-shots.mjs;
the backend tree by docs/backend-shots.mjs, from fieldops' own files.
The work runs as a loop. The build ledger is the task list
and its status; .claude/skills/backend-loop is how a session proceeds, and
service-design, target-plugin, sync-protocol and milestone-verify are the
specifications each task follows; .claude/agents/backend-*.md are the
engineers, the reviewer and the verifier.
Next: Backends, Quickstart.