# shop — the writeonce program template A small store you can buy from, structured the way a real writeonce web app should be. **Copy this directory to start a new app**; every file has one concern, and the module system (one directory = one module, `pub` = the export line) enforces the separation the layout promises. ## Run it ``` cd docs/examples/shop woc . && WO_DATA=./data ./target/shop 8080 # durable store ./target/shop 8080 # RAM-only (dev) ``` Browse http://127.0.0.1:8080/ — products → product page → buy (stock checked and decremented) → confirmation → /orders. With `WO_DATA`, kill it and restart: the orders are still there (WAL replay). ## The file map (Angular equivalents) | this template | concern | Angular analog | | --- | --- | --- | | `types.wo` | MODEL — `@table` classes ARE the WAL database | `models/*.ts` (+ the entire database) | | `layout/app.wo` | app shell: document, header+footer composition, `ok_html`/`html_error` transport helpers | `app.component.html` | | `layout/header.wo` / `footer.wo` | shared chrome fragments | `header.html` / `footer.html` | | `product_list/view.wo` | VIEW — classes with `fn render() -> Text`, fields = exactly what is displayed | `product-list/view.html` | | `product_list.controller.wo` | CONTROLLER — query the model, fill the view, answer a `Resp` (one file per feature, root module) | component `.ts` + service | | `product_page/`, `orders/` | one view module per feature + its root controller file | feature folders | | `static_files/controller.wo` | `/assets/*` from disk, traversal-safe, typed | `angular.json` assets | | `assets/style.css` | ONE real stylesheet, sectioned per feature | the `.scss` files | | the `render()` bodies | markup-first TODAY: one HTML line per `h = h ..` statement, `${}` holes; story 37 collapses each body to ONE raw literal with `{{ }}` auto-escaped typed holes | Vue `