lmjtfy.git / apps / README.md
1# Chapter 1: apps, a folder with one thing in it
2
3A repository like this one splits into two kinds of code. There is code
4that *does things*: answers HTTP requests, calls Jev, writes to a database,
5waits on the network. And there is code that only *thinks*: given these
6facts, which rule fires; given this answer, what goes on the page. The doing
7kind lives here, in `apps/`. The thinking kind lives in `packages/`
8(chapter 5).
9
10Right now there is exactly one app, the Cloudflare Worker that is the whole
11website. The folder exists anyway, because the split is the point, not the
12count: when an app needs something that does no I/O, it goes in a package
13and gets tested with plain `cargo test`, on your laptop, with no Cloudflare
14anywhere.
15
16```mermaid
17flowchart LR
18  subgraph apps["apps/ (does things)"]
19    W["lmjtfy: the Worker"]
20  end
21  subgraph packages["packages/ (only thinks)"]
22    R[rules] --- A[ask] --- L[llm]
23    AR[archive] --- B[budget] --- C[card] --- T[tree]
24  end
25  W --> packages
26```
27
28> **Aside.** In Nuxt terms, `apps/lmjtfy` is your Nitro server and pages
29> together, and `packages/` is a folder of composables that never touch
30> `fetch`. The difference is that Rust makes the line hard: a package that
31> tried to call the network would not compile, because none of them depend
32> on the Worker's runtime.
33
34## In this folder
35
36| Path | What |
37| --- | --- |
38| [lmjtfy/](lmjtfy/) | The Cloudflare Worker: the site, its two Durable Objects, and the clone proxy. |
39
40← Previous: [Prologue](../) · Up: [lmjtfy](../) · Next: [Chapter 2, the Worker](lmjtfy/) →