- Modules: `use`/`pub`, directory-as-module, per-module symbol resolution (a
flat first-wins merge silently ran the wrong `pub fn` body), six reserved
stdlib namespaces typed UNKNOWN-BUT-RESERVED.
- Surface: `and`/`or` (own precedence tier, short-circuit, Bool-only), `${}`
interpolation desugared at parse time, `const`, break/continue with
drop-correct exits, do-while, inline-fn rejection.
- switch expr/stmt: required `default` over scalars/Text, arm unification,
EQ/EQS+JZ lowering, per-arm drop scopes with N-way JOIN-DROP; `default`
sorted last by a shared lowering order (textual order made arms dead).
- typedef records: structural, same shape = one class entry; `?name: T`
nullable-by-shape; emit_ctor fills omitted defaults; `type` as field name.
- Enum variants: all-bare unions = int ordinals; any-payload = one class
entry per variant, tag IS the header class_id (no header field, no format
bump); exhaustive switch without `default`; arity checked both directions.
- Payload escape modeled as move-out (pointer-kind fields only — a scalar
escape is a copy); caller reaps owned heap temps passed by borrow: two
unbounded LSan-blind leaks, 10.5 MB -> 1.5 MB flat over 300k iterations.
- Fixed en route, each with a RED repro: dead E209 builtin-arg check and
`int_to_text` missing from both types.ml builtin tables (both segfaulted
wovm), multi-file phantom double-report, emit_ctor's field temp clobbering
dst in tail position (pre-existing), warnings swallowed without an error.
- Two fenced VM builtins: `int_to_text` (13), `variant_tag` (14).
- 14+565 unit (was 14+401), corpus 71 (was 32) plain and under wovm_asan,
wovm-test + cli_smoke green. Log-watcher 307 -> 93 diagnostics (85 E101 /
4 E207 / 1 E208 / 3 W202); the 5 non-E101 residuals await Task 7 grammar.
|
||
|---|---|---|
| .dev | ||
| .vscode | ||
| compiler | ||
| crates | ||
| docs | ||
| infra | ||
| prototypes/wo-db | ||
| runtime | ||
| scripts | ||
| static | ||
| templates | ||
| tests/corpus | ||
| .gitignore | ||
| .gitmodules | ||
| Cargo.lock | ||
| Cargo.toml | ||
| CLAUDE.md | ||
| justfile | ||
| prompt.md | ||
| README.md | ||
writeonce
A declarative full-stack programming language. You write .wo files; the runtime compiles them into a binary that owns the database, serves REST, and pushes live subscriptions — no external database, no external web server, no frontend framework.
Think Go + Postgres + net/http + Phoenix LiveView, folded into one language and one binary.
persistant database
- reads and writes database to RAM, persist data to postgres SQL.
- The entire database lives in RAM; every committed write is mirrored to PostgreSQL as a backup — asynchronously, behind the runtime's own WAL, never in the read or ack path. Set
WO_PG=postgres://user@host:5432/dband every type's rows appear as a Postgres table (named by its@table(name: ...)annotation) that you can query with plainpsql. Plan and phases:docs/plan/16-postgres-mirror.md; try it:just pricing-pg-demo.
Quickstart
git clone https://github.com/shoneyJ/writeonce
cd writeonce
cargo run --bin wo -- run docs/examples/blog # serve the sample blog on :8080
curl http://127.0.0.1:8080/api/articles # it's a real REST API now
See .dev/reference/rest/blog.rest for a preconfigured HTTP-request file that drives the whole sample — open it in VS Code (with the REST Client extension) or JetBrains and click "Send Request" on each block.
What this repository contains
| Path | What it is |
|---|---|
crates/rt/ |
The new .wo language runtime — lexer, type-DSL parser, in-memory engine, axum REST server. Produces the wo binary. |
crates/{ql,value,engine,txn,db,wal,sub,http,gen,policy,logic,service,ui,app}/ |
14 empty placeholder crates scaffolded for Phases 2–6. Real code extracts from rt/ as each phase activates. |
docs/runtime/wo-language.md |
Start here. The language overview: toolchain, hello-world, stdlib, client model. |
docs/runtime/database.md |
The 7-phase engineering series that drives the runtime's design. |
docs/examples/blog/ |
Sample .wo project: blog with articles, authors, tags, comments. ~200 lines. |
docs/examples/ecommerce/ |
Sample .wo project: storefront + live order-ops table + cross-paradigm checkout. ~300 lines. |
prototypes/wo-db/ |
C++ prototype of the query-layer engine (SQL + Cypher + document paths, RETURNING aliases, LIVE stub). ~2k lines, smoke tests pass. Reference implementation the Rust port follows. |
.dev/reference/rest/ |
.rest files (VS Code REST Client / JetBrains HTTP format) for manually testing the running prototype. |
.dev/reference/crates/ |
The v1 writeonce blog — 13 Rust crates implementing the original .seg + sidecar-index storage engine and .htmlx templating. Preserved as a nested workspace; see .dev/reference/README.md. |
Current stage
The runtime is under active development. Each stage lands as an independently shippable cut:
| Stage | What works | Status |
|---|---|---|
| 1 | wo run <dir> discovers every .wo file under a directory |
✅ shipped |
| 2 | Type-DSL parser, in-memory engine, REST CRUD (list / get / create / update / delete) generated from service rest blocks, JSON bodies with auto-id, default-value seeding, partial-update PATCH |
✅ shipped — cargo run -- run docs/examples/blog |
| 3 | LIVE subscriptions over WebSocket, delta frames on commit, me / session layer |
pending |
| 4+ | Transactional fns (fn checkout in txn snapshot), row-level policies, type-attached triggers, ##ui SSR, WAL durability, codegen |
see docs/runtime/database.md |
cargo test --lib at the root runs 14 unit tests covering the lexer, parser, compiler, and engine. Stage-3 endpoints respond 501 Not Implemented until they land.
Build & test
cargo build # builds all 15 crates (only `rt` has real code)
cargo test --lib # 14 unit tests
cargo run --bin wo -- run docs/examples/blog # serve the blog sample
cargo run --bin wo -- run docs/examples/ecommerce # serve the ecommerce sample
# Override the listen address
WO_LISTEN=127.0.0.1:9000 cargo run --bin wo -- run docs/examples/blog
The v1 codebase (reference)
The original writeonce blog engine — 13 crates, flat-file .seg storage, sidecar indexes, .htmlx templates, hand-rolled epoll event loop — moved to .dev/reference/crates/ when the new runtime was scaffolded. It's a nested Cargo workspace:
cd .dev/reference/crates
cargo build # all 13 v1 crates still compile
cargo test # 12 unit tests, 1 ignored integration test
V1 crates keep the wo- prefix (wo-seg, wo-store, …). The new runtime crates dropped it (ql, value, engine, …). docs/runtime/database/07-wo-seg-migration.md is the phased coexistence plan for replacing v1 with the new runtime — abstract behind a trait, dual-write, cut over, decommission.
License & status
Work in progress. Nothing here is stable. Read the language overview in docs/runtime/wo-language.md if you want to know the shape; read the phase docs if you want to see the engineering plan; look in docs/examples/ if you want to see what the end product feels like.