package file→ .shtukbase/packages/lenses/kit/server/README.md
kit/server/README.md
38 lines, 1.9 KB.
- # kit-backend: an experiment, not a tool
- A 37-line local backend for HTML pages of a Shtukbase project, written to check one idea of the
- research `shtuks/research/html-pages-types-and-backend-2026-11-26.md`: a page opened through a
- local server can read records and change them, and a foreign page cannot.
- - `serve.ts` serves a base folder on `127.0.0.1` and answers `POST /_api` with three actions:
- `records`, `read`, `patch`.
- - `queue.html` is the page under test: it lists open questions, answers the first one, reads a
- Markdown file, and tries a path outside the base and a dot path.
- - `foreign.html` is a page from disk that tries to write through the same address.
- ## Run it again
- ```sh
- mkdir -p base/questions base/notes base/apps
- printf -- '---\ntype: "Question"\ntitle: "First"\nstatus: "open"\n---\nText.\n' > base/questions/q1.md
- printf -- '---\ntype: "Question"\ntitle: "Second"\nstatus: "open"\n---\nText.\n' > base/questions/q2.md
- echo "a note" > base/notes/readme.md
- cp queue.html base/apps/
- bun serve.ts base 8791 &
- # open http://127.0.0.1:8791/apps/queue.html, then open foreign.html from disk
- ```
- ## Observed on 2026-11-26 (Bun 1.3.12, headless Chrome)
- - The page read the records, changed `status` and added `answer` in one of them on disk, and read
- the `.md` file with a plain `fetch`.
- - A path above the base and a path with a dot step were refused.
- - The foreign page was blocked and the record stayed as it was; `curl` without the server's cookie
- got 403.
- ## What became of it
- Open. On 2026-11-26 the owner decided that a backend is optional (a page works without one) and
- that a page in the Shtukbase app window must reach the Shtukbase node. Whether `shtukbase-cli`
- also gets a server of its own, like this one, is not decided: both options are considered. Until
- then this folder stays as the record of the experiment and of the refusals a backend needs.