Skip to content

[Request]: Declarative persistence: store/collection handler and a file-backed CRUD recipe #253

Closed

Description

@jimhoyd

Tried: persist todos across restarts using only declared URLCode features.
Expected: a declarative store/collection handler, or at minimum a recipe for file-backed CRUD.
Got: neither exists (recipes search "crud store persist" returns nothing; docs list a guest storage broker as unavailable). Both runs hand-wrote a JSON-file store inside a trusted function (queue + atomic rename): about 26-40 lines each, inside 112-116 LOC of custom backend JS. That is why 63-64% of application code stayed imperative.
Suggestion: a store:/collection handler (list/get/create/patch/delete, id + createdAt/updatedAt, file- or SQLite-backed) or an extension, plus a crud-todo recipe. Related: #133 (read-through data binding, closed).
Evidence: an A/B benchmark on URLCode 0.4.1 with Sonnet 5 agents building the same Todo app from the repo docs. Run 1 (benchmark Agent B, no authoring skill, no browser check) and run 2 (session "Todo application with URLCode", authoring skill loaded, tightened prompt) hit this independently. n=1 each; single small app, so treat frequency as anecdotal. The Agent A control (no URLCode) needed 2 shell calls and 0 dependencies for the same app.
Not verified: how much of the custom code a store handler would remove for apps beyond a Todo list.

Activity

  1. added
    enhancement
    on Sep 20, 2026
  2. jimhoyd commented on Sep 20, 2026

    @jimhoyd
    CollaboratorAuthor

    Placement: build this as an extension, not core.

  3. added
    needs-decision
    extension
    examples
    on Sep 20, 2026
  4. jimhoyd commented on Sep 20, 2026

    @jimhoyd
    CollaboratorAuthor

    Decision: confirmed as the placement comment above: build as an operator-installed store extension, not core.

  5. removed
    needs-decision
    on Sep 20, 2026
  6. added
    important
    on Sep 20, 2026
  7. jimhoyd commented on Sep 20, 2026

    @jimhoyd
    CollaboratorAuthor

    Clarification from the maintainer: the data store is built as an operator-installed extension, as decided above. This is not reopened.

    Correction to the earlier note about the retired short-link extension. That comment said to read why urlcode-dynamic-link was retired before building. The reason is now known: it did not belong, and the project started locked down in a sandbox and later moved to trust by default. That change opened up many possibilities and lets core stay smaller and cleaner. So its retirement is not a precedent against a data-storing extension, and no further reading is needed before building.

    Unchanged from the decision: ship urlcode init --with store and a CRUD recipe in the same release, and sequence after #254 (PR #306).

  8. added
    in-progress
    on Sep 20, 2026
  9. jimhoyd commented on Sep 20, 2026

    @jimhoyd
    CollaboratorAuthor

    Progress: an agent has started on this; a PR will be linked here when it opens.

  10. removed
    in-progress
    on Sep 20, 2026
  11. jimhoyd commented on Sep 20, 2026

    @jimhoyd
    CollaboratorAuthor

    Shipped in #315: new workspace package @jimhoyd/urlcode-store (declared collections, file-backed, single-writer lock, per-collection limits), init --with store, and docs/STORE.md. Not done: release wiring (so init --with store does not yet work from npm) and a recipes/ catalog entry. Tracking both as follow-ups; keeping this open until the release wiring lands.

  12. jimhoyd commented on Sep 20, 2026

    @jimhoyd
    CollaboratorAuthor

    Design recommendation after reviewing the shipped store, recipe, release wiring and CRUD composition: keep this as three independently usable layers. Store owns the bounded collection contract and JSON API; UI owns optional presentation; the scaffold can bundle UI, auth and store for a ready CRUD app. Do not make store depend on UI or auth.

    Before the first production data, settle two extension-level seams:

    1. An operator-host storage-driver boundary so a future SQLite backend does not put provider or storage selection in YAML.
    2. An explicit schema-evolution rule. Today incompatible collection changes correctly refuse activation, but operators need a documented migration path or an explicit migration-required contract.

    Security/default recommendation: keep raw store usable for intentional public APIs, but make a writable public collection an explicit scaffold choice. The ready CRUD scaffold should compose auth by default or require an explicit public-access selection.

  13. jimhoyd commented on Sep 20, 2026

    @jimhoyd
    CollaboratorAuthor

    Merged-main alignment audit follow-up: the first store slice is intentionally narrow and should stay that way. The next work now has explicit boundaries:

    The practical sequence is: publish the already-wired store package (#323), settle scaffold access/composition (#337/#338), then ownership and query/backend seams before positioning it for multi-user or production domain records.

  14. jimhoyd commented on Sep 20, 2026

    @jimhoyd
    CollaboratorAuthor

    Done: the store extension shipped in #315 (with the CRUD recipe in #325, the release wiring in #326, the CRUD screen in #328 and the public-write acknowledgement in #343), and @jimhoyd/[email protected] is on npm (verified against the registry). One known gap is tracked in #346: the published store needs a core newer than the published core for the no-auth --allow-public-write path. Per-record ownership is #331, filtering and sorting is #330, and migration/composition with auth and admin is #336.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementexamplesextensionimportant

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions