UCD.js Docs

Store

Architecture notes for apps/store

apps/store is the hosted filesystem-style HTTP surface for mirrored Unicode store content.

Role

  • Exposes a store-shaped read API for lockfiles, snapshots, and versioned files.
  • Provides the HTTP contract consumed by the read-only fs-backend HTTP backend.
  • Bridges Cloudflare storage/bindings and the higher-level ucd-store conventions.

Mental Model

This app is not the main public API. It is a filesystem facade with three route families:

  • /.ucd-store.lock
  • /:version/snapshot.json
  • /:version/:path*

The app mainly exists so remote consumers can treat hosted store data like a read-only filesystem.

Request Flows

Worker startup

route registrarsworker-utils/h3H3worker.tsroute registrarsworker-utils/h3H3worker.tsRuntimeinitialize modulecreate H3 appsetupH3Cors(app)setupH3Ratelimit(app)register lockfile, snapshot, files routesserve(app)Runtime

Lockfile request

SnapshotSchemaR2 bucket/.ucd-store.lockSnapshotSchemaR2 bucket/.ucd-store.lockloop[each manifest snapshot object]ClientGET /.ucd-store.locklist objects under manifest/get snapshot.jsonsnapshot JSONvalidate snapshotfile stats for versionderived Lockfile JSONClient

Snapshot request

SnapshotSchemaR2 bucket/:version/snapshot.jsonSnapshotSchemaR2 bucket/:version/snapshot.jsonalt[invalid snapshot][valid]alt[object missing][object found]ClientGET /16.0.0/snapshot.jsonget manifest/{version}/snapshot.jsonnull404 not foundJSON bodyvalidate snapshot502 bad gatewaysnapshot JSON + cache headersClient

File request

env.UCDJS_API.files()Cloudflare cache/:version/:path*env.UCDJS_API.files()Cloudflare cache/:version/:path*alt[cached response][cache miss]ClientGET /16.0.0/ArabicShaping.txtmatch(cacheKey)responsecached responserequest transformed Unicode pathbody + status + headersstore successful GET responseproxied responseClient

Design Notes

  • The lockfile is derived dynamically from stored snapshots, so the app can serve a store view even when only manifest artifacts are persisted.
  • File requests proxy through the API binding rather than re-implementing Unicode file serving logic.
  • The route shape intentionally matches the expectations of the HTTP filesystem backend.
  • Cache headers matter because this app is read-heavy and mostly immutable by version.

Testing Use

  • route registration and fallback 404 behavior
  • lockfile derivation from snapshot objects
  • snapshot validation failures
  • cache hit/miss behavior for file routes
  • compatibility with the HTTP backend contract

On this page