toiljs 0.0.102 → 0.0.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/build/compiler/.tsbuildinfo +1 -1
- package/build/compiler/toil-docs.generated.js +8 -8
- package/docs/introduction/README.md +15 -13
- package/docs/introduction/design-principles.md +58 -34
- package/docs/introduction/distributed.md +13 -4
- package/docs/introduction/how-it-works.md +81 -34
- package/docs/introduction/hyperscale.md +36 -17
- package/docs/introduction/modern-stack.md +63 -18
- package/docs/introduction/vs-other-frameworks.md +44 -28
- package/docs/introduction/why-toil.md +20 -12
- package/package.json +1 -1
- package/src/compiler/toil-docs.generated.ts +8 -8
|
@@ -1,48 +1,64 @@
|
|
|
1
1
|
# toil versus other stacks
|
|
2
2
|
|
|
3
|
-
An honest look at where
|
|
3
|
+
An honest, axis-by-axis look at where toil trades differently from the stacks you already use. Every tool below is genuinely good at what it was built for, so the goal is not to crown a winner but to be concrete about what you gain and what you give up. toil is also younger than all of them, and that shows up in a few rows.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
The short story: toil trades a large, mature ecosystem for one owned framework that distributes writes and ships the fast, safe defaults for free. Whether that trade fits your project is the honest question this page tries to answer.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## The comparison at a glance
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
| Axis | A typical modern stack | toil |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| Pieces on the critical path | A dozen rented vendors (host, functions, database, auth, email, queue, cache, analytics, realtime), each its own account, bill, and SDK | One framework you write in; the core services are toil's own, so nothing third-party sits on the critical path |
|
|
12
|
+
| Where writes land | One primary region: reads go global, writes crawl back to that box | Every key has one home region that orders its writes, while data replicates outward for fast local reads (built to distribute; live multi-cell is configuration-gated) |
|
|
13
|
+
| Server runtime | A Node process, container, or VM per app | A small sandboxed WebAssembly module; one edge box safely runs many apps (multi-tenant), which is what makes running near everyone affordable |
|
|
14
|
+
| Client-to-server calls | Hand-written fetch/REST, types drift until something breaks in production | A generated, fully typed `Server` client with no raw fetch: change a field on the server and the frontend stops compiling until you fix it |
|
|
15
|
+
| Auth | Bolt on a provider or roll your own | Post-quantum login (ML-DSA + ML-KEM) built in, enabled in about one line |
|
|
16
|
+
| Getting to production | Assemble CDN, cache, regions, hardened auth, and CI yourself | Zero config: the good version is the default version |
|
|
17
|
+
| Toolchain | A decade of bundler configs, transpiler shims, CommonJS-versus-ESM interop, and `node_modules` churn | Built on modern web tech (React + Vite client, one CLI), far less legacy to fight |
|
|
18
|
+
| Database | Mature SQL: joins, ad-hoc queries, huge tooling | Seven purpose-built families (Documents, Unique, Counter, Events, Membership, Capacity, View): fast and distributed, but not relational |
|
|
19
|
+
| Package ecosystem | The full npm and Node universe | A strict TypeScript subset with built-in globals; no arbitrary npm packages or Node APIs on the server |
|
|
20
|
+
| Integration catalog | Large, mature, well documented | Smaller and younger |
|
|
21
|
+
| Single-region app | Dead simple, nothing to distribute | Distribution you may not need |
|
|
10
22
|
|
|
11
|
-
|
|
12
|
-
| --- | --- | --- | --- |
|
|
13
|
-
| **Next.js / Vercel** | DX, React, global edge reads | data path | Global reads, single-region writes: a sudden write-heavy spike concentrates on one DB box that edge caches and read replicas cannot relieve, while serverless cold starts add latency and per-invocation billing climbs exactly when load peaks |
|
|
14
|
-
| **Rails / Django** | Maturity, batteries included | topology / availability / data | Centralized single-region monolith: one place to be near, one place to fail, and one primary every write must reach |
|
|
15
|
-
| **Serverless functions** (Lambda, Cloud Functions) | Elastic stateless compute | data path | Distributes compute, not state; the central DB stays the write bottleneck, and a cold-start burst adds latency and cost right when traffic surges |
|
|
16
|
-
| **Edge runtimes** (Workers, Deno Deploy) | Code at the edge, near users | data path | Distributes compute beautifully, but the DB you attach is usually single-region (Durable Objects / D1 excepted, below) |
|
|
17
|
-
| **BaaS** (Supabase, Firebase) | Fastest to start | dependencies + data path | You rent a managed service you cannot inspect or fix, and writes resolve against a primary |
|
|
18
|
-
| **toil** | Owned stack, distributed writes | aims for no single binder | Every key has one home region that serializes its writes; auth, DB, email, and jobs are owned, so the usual caps are designed out (latency and client axes are still yours to earn) |
|
|
23
|
+
The top rows lean toil's way, the bottom rows lean the incumbents' way, and that split is the whole story. toil is designed to win the structural axes (one owned stack, distributed writes, a multi-tenant sandbox, end-to-end types, built-in modern auth) and it concedes the ecosystem axes (SQL, the Node universe, catalog size) that maturity buys.
|
|
19
24
|
|
|
20
|
-
##
|
|
25
|
+
## Where each stack fits
|
|
21
26
|
|
|
22
|
-
|
|
23
|
-
- **Rails / Django:** mature and productive, capped by its single-region shape; you can add replicas and standbys to climb, but distributed *writes* are not in the default model.
|
|
24
|
-
- **Serverless functions:** great elastic compute, but it is stateless compute in front of a central database, so a write burst still bottlenecks on that store and each cold invocation bills separately.
|
|
25
|
-
- **Edge runtimes:** the closest in spirit to toil's compute model, yet edge compute in front of a central database is just a faster front door to the same bottleneck.
|
|
26
|
-
- **Cloudflare Durable Objects / D1:** the closest mainstream analog to toil's idea, and credit is due. A Durable Object gives one object a single-writer home that serializes its writes, the same shape as ToilDB's per-key home. The difference is packaging: with the edge-runtime approach you assemble the pieces yourself (runtime, object or DB product, auth, email), whereas toil ships distributed writes, the seven database families, auth, email, streaming, and jobs as one integrated owned stack. Which you prefer is a genuine trade-off.
|
|
27
|
-
- **BaaS (Supabase, Firebase):** fastest to start, but the convenience is a managed service on your critical path, and writes still resolve against a primary, so it is **dependency-bound and data-bound**.
|
|
27
|
+
**Next.js / Vercel.** Superb React DX and global edge reads. The ceiling is the write path: pages cache worldwide, but a write (a comment, an order, a flash-sale click) still resolves against one primary region, and serverless cold starts add latency and per-invocation cost exactly when a spike hits. toil keeps a React-first client and moves the write to a home region near the data.
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
**Rails / Django.** Mature, productive, batteries included, an enormous ecosystem and a deep hiring pool. If you are happy in one region this is a great and boring choice. The default shape is a single-region monolith with one primary that every write must reach; you can add replicas and standbys to climb, but distributed writes are not in the model.
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
**Serverless functions (Lambda, Cloud Functions).** Elastic, stateless compute that scales to zero. But it is stateless compute in front of a central database, so a write burst still bottlenecks on that store, and each cold invocation bills and lags on its own.
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
**Edge runtimes (Workers, Deno Deploy).** The closest in spirit to toil's compute model: your code runs near users. The catch is that the database you attach is usually single-region, so edge compute becomes a faster front door to the same central write bottleneck.
|
|
34
|
+
|
|
35
|
+
Cloudflare Durable Objects and D1 are the closest mainstream analog to toil's idea, and credit is due: a Durable Object gives one object a single-writer home that orders its writes, the same shape as ToilDB's per-key home. The difference is packaging. With the edge-runtime approach you assemble the pieces yourself (runtime, object or database product, auth, email, realtime); toil ships distributed writes, the seven database families, auth, email, streaming, and background jobs as one owned stack. Which you prefer is a real trade-off.
|
|
36
|
+
|
|
37
|
+
**Backend-as-a-service (Supabase, Firebase).** The fastest thing to start with, and often the right call for a prototype. The convenience is a managed service on your critical path that you cannot inspect or patch, and writes still resolve against a primary.
|
|
38
|
+
|
|
39
|
+
## Where the incumbents still win
|
|
40
|
+
|
|
41
|
+
toil does not win every axis, and some gaps are real today. Be honest about them:
|
|
42
|
+
|
|
43
|
+
- **Mature ecosystems.** More tutorials, more answered questions, more hosting options, and more people who already know the tool.
|
|
44
|
+
- **SQL and joins.** If your data is relational and you live in ad-hoc queries and joins, a SQL database is the right tool. ToilDB is seven purpose-built families, not a relational engine (see the [database overview](../database/README.md)).
|
|
45
|
+
- **The Node package universe.** The toil server is a strict TypeScript subset compiled to WebAssembly: no arbitrary npm packages or Node APIs, built-in globals instead. That is the price of the small, fast, multi-tenant sandbox.
|
|
46
|
+
- **Bigger integration catalogs.** toil is younger, so the catalog of ready-made integrations is smaller. If your project is defined by a large existing integration catalog, that gap matters.
|
|
47
|
+
- **Single-region simplicity.** If one region already fits your users, toil's distribution is effort you do not need.
|
|
48
|
+
|
|
49
|
+
None of these are permanent, and the right tool is the one that fits the job in front of you.
|
|
37
50
|
|
|
38
51
|
## toil's bet
|
|
39
52
|
|
|
40
|
-
|
|
53
|
+
Most stacks cap in nearly the same place: the write path is one box in one region, or the critical path leans on services you rent and cannot fix. toil's bet is to refuse both at once, own the whole stack and distribute the writes, so the structural caps are designed out and the limits left are the ones your own code sets.
|
|
54
|
+
|
|
55
|
+
Keep the mechanism honest. The home-region model and its core logic are real and tested, but live multi-region deployment (the WAN routing and the ScyllaDB backing) is configuration-gated rather than on by default, and the local dev database is a single in-process store. Compute works the same way: your code runs at the edge on every request, while the regional, continental, and global-daemon tiers are opt-in. So the accurate claim is "toil is built to distribute writes worldwide, and the mechanism is real," not "every app is already running a live global write cluster today."
|
|
41
56
|
|
|
42
|
-
Whether that
|
|
57
|
+
Whether that trade fits your project is the checklist in [Why toil](./why-toil.md).
|
|
43
58
|
|
|
44
59
|
## Related
|
|
45
60
|
|
|
46
61
|
- [Why toil? Who is it for?](./why-toil.md): the problem toil solves and the honest cases where you should not use it.
|
|
62
|
+
- [The modern stack](./modern-stack.md): the full, verified catalog of what is built in.
|
|
47
63
|
- [How toil is distributed](./distributed.md): the mechanism behind distributed writes (every key's single home region).
|
|
48
|
-
- [Why toil is built this way
|
|
64
|
+
- [Why toil is built this way](./design-principles.md): the bar toil grades itself against.
|
|
@@ -2,27 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
toil is a full-stack framework: you write a React frontend and a TypeScript backend in one project, and toil runs both (plus a database) close to every user, worldwide.
|
|
4
4
|
|
|
5
|
-
The thesis in one line: toil is the modern full-stack tech a developer would actually want, AAA-grade from the very first line, and hyper-scalable at the same time. Even a simple pizza site gets top-tier infrastructure with zero setup. Distributed writes are one pillar of that
|
|
5
|
+
The thesis in one line: toil is the modern full-stack tech a developer would actually want, AAA-grade from the very first line, and hyper-scalable at the same time. Even a simple pizza site gets top-tier infrastructure with zero setup. Distributed writes are one pillar of that; the modern stack that just works is the heart.
|
|
6
6
|
|
|
7
7
|
## The problem with today's stacks
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Shipping a good app today means fighting your own infrastructure. Five ways it fights back.
|
|
10
10
|
|
|
11
|
-
**
|
|
11
|
+
**Reads go global, writes go to one region.** Your pages load fast from caches worldwide, but a *write* (a comment, a like, an order) crawls back to a single database in a single region. A user in Sydney writing to Virginia pays for the whole round trip, and that one region is a single point of failure for everyone.
|
|
12
12
|
|
|
13
|
-
**
|
|
13
|
+
**You became a systems integrator by accident.** A production stack is a dozen rented services stitched together: a frontend host, serverless functions, a managed database, auth, email, a queue, a cache, analytics, realtime. Each is its own account, bill, SDK, and outage. And every one on your *critical path* (what must work for a request to succeed) is a black box you cannot inspect, patch, or secure: when it is slow you are slow, when it is breached part of you is breached.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
**It runs on yesterday's tooling.** The typical stack sits on a decade of accumulated legacy: bundler configs, transpiler shims, CommonJS-versus-ESM interop, framework churn, and a `node_modules` folder heavier than the app itself. You fight the toolchain and chase version bumps instead of building. The modern web platform moved on; the stack did not.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
**Overhead at every layer.** Heavy runtimes, slow builds, serverless cold starts, oversized JavaScript shipped to the browser, and a network hop between every service. Each layer piles on latency and cost that the user feels and you debug.
|
|
18
|
+
|
|
19
|
+
**Fast and safe are opt-in, never the default.** Good performance and real security are things you assemble by hand: a CDN here, a cache there, careful data fetching, region tuning, hardened auth, current cryptography. Miss a piece and you are slow or exposed. The good version is always the extra work, so most people ship the lesser one.
|
|
20
|
+
|
|
21
|
+
The result: a solo builder and a funded startup hit the *same* wall. Top-tier infrastructure means assembling and babysitting a lot of parts, so most settle for less.
|
|
18
22
|
|
|
19
23
|
## What toil does instead
|
|
20
24
|
|
|
21
|
-
|
|
25
|
+
Every design decision in toil serves one goal: AAA-grade infrastructure as the *default*, not the thing you assemble by hand. All of it in one framework, not ten rented vendors. Zero configuration, and no distributed-systems or networking expertise required. It just works out of the box, quantum-proof login included, on a stack built for modern tech instead of a decade of legacy tooling.
|
|
26
|
+
|
|
27
|
+
Four pillars.
|
|
22
28
|
|
|
23
29
|
### 1. AAA-grade from the first line
|
|
24
30
|
|
|
25
|
-
Top-tier infrastructure on day one, on the smallest project, with zero setup: edge compute (your code runs near users worldwide),
|
|
31
|
+
Top-tier infrastructure on day one, on the smallest project, with zero setup: edge compute (your code runs near users worldwide), a global database already there, automatic tamper-proofing of every shipped asset (SHA-384 Subresource Integrity), and quantum-proof login in about one line.
|
|
32
|
+
|
|
33
|
+
That login is real post-quantum cryptography. Your password is stretched into a signing key on your device and never reaches the server in a usable form, and the handshake uses ML-DSA and ML-KEM, the NIST-standardized algorithms meant to survive a quantum computer. Most stacks bolt current crypto on by hand, if at all; here it is the default.
|
|
26
34
|
|
|
27
35
|
A pizza site and a planet-scale app start from the same baseline. "AAA-grade" is the actual bar toil grades itself against; see [design principles](./design-principles.md).
|
|
28
36
|
|
|
@@ -56,15 +64,15 @@ Honest boundary: "owned" means the *core* of a working app is toil's, not that o
|
|
|
56
64
|
|
|
57
65
|
### 3. A modern DX that just works
|
|
58
66
|
|
|
59
|
-
TypeScript end to end, one repo, one deploy, wired by types
|
|
67
|
+
Built on today's web platform, not a decade of accumulated legacy: TypeScript end to end, one repo, one deploy, wired by types. Change a field on the server and the frontend stops compiling until you fix it (a compile error at your desk, not a production bug).
|
|
60
68
|
|
|
61
69
|
The toolchain is set up for you: ESLint, Prettier (with a plugin for toil's decorators), an editor plugin, one CLI, and a `doctor` that fixes common problems in place. The docs are even LLM-friendly, so an AI assistant reads your current conventions instead of guessing. More in [The modern stack](./modern-stack.md).
|
|
62
70
|
|
|
63
|
-
### 4. Hyper-scalable and distributed
|
|
71
|
+
### 4. Hyper-scalable and distributed
|
|
64
72
|
|
|
65
|
-
Your backend compiles to a tiny sandboxed **WebAssembly** module (a compact, locked-down binary that runs at near-native speed), so one edge box safely runs many apps
|
|
73
|
+
Your backend compiles to a tiny sandboxed **WebAssembly** module (a compact, locked-down binary that runs at near-native speed), modern tech rather than a heavyweight legacy runtime, so one edge box safely runs many apps and running near everyone stays affordable.
|
|
66
74
|
|
|
67
|
-
And the database, **ToilDB**, distributes the *writes*, not just the reads: every key has one **home** region that orders its writes, while data replicates outward for fast local reads. Distributing writes is the hard part almost nobody does.
|
|
75
|
+
And the database, **ToilDB**, distributes the *writes*, not just the reads: every key has one **home** region that orders its writes, while data replicates outward for fast local reads. Distributing writes is the hard part almost nobody does. toil is built to do it worldwide and the mechanism is real and tested; live multi-region deployment is configuration-gated rather than on by default, and once it is on, a far read can lag a few milliseconds (the eventual-consistency trade). See [How toil works](./how-it-works.md) and [How toil is distributed](./distributed.md).
|
|
68
76
|
|
|
69
77
|
## Who it is for
|
|
70
78
|
|
package/package.json
CHANGED