ShtukbaseStandard
package file→ .shtukbase/packages/lenses/kit/server/README.md

kit/server/README.md

38 lines, 1.9 KB.

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