How louvorja/api-workers works
LouvorJA API is a Cloudflare Worker replacing the legacy PHP API. Apps read catalog snapshots and media from R2; the administration panel authenticates and edits catalog data in D1, while separate jobs publish snapshots and media for app delivery. The graph includes the documented import, media, Delphi, and video-maintenance branches. Some job internals were not sampled, so those relationships are shown only where the README documents them.
Main entry points: index.ts Worker router · auth.ts Authentication · admin.ts Catalog admin · publish.ts Catalog publication
Components 31
Worker API
- Worker router
src/index.ts
Public delivery
- Public handlers
src/features/db.ts - JSON snapshots
src/features/json-db.ts - REST catalog
src/features/rest.ts - File delivery
src/features/files.ts - Media URL mapping
src/lib/media-urls.ts - Online videos
src/features/online-videos.ts
Administration
- Authentication
src/features/auth.ts - Session and tokens
src/lib/auth/session.ts - JWT signing
src/lib/auth/jwt.ts - Catalog admin
src/features/admin.ts - Admin listings
src/lib/admin/listing.ts - Audit logging
src/lib/admin/audit.ts
Catalog operations
- Legacy ingestion
scripts/ingest.ts - REST ingestion
scripts/ingest-rest.ts - Catalog publication
scripts/publish.ts - Catalog transforms
scripts/lib/catalog.ts - Media normalization
scripts/media-normalize.ts - Media processing
scripts/lib/media.ts - File reconciliation
scripts/reconcile-files.ts - Slide import
scripts/import-slides.ts - Video refresh
scripts/refresh-online-videos.ts - Delphi database export
scripts/delphi-db.ts - Delphi version sync
scripts/delphi-version.ts - Legacy data helpers
scripts/lib/legacy.ts - R2 job helpers
scripts/lib/r2.ts
Storage and integrations
- D1 catalog
- R2 objects
Other components
- Apps
- Admin panel
- GitHub Actions
Connections 42
- Apps → Worker router: requests
- Admin panel → Worker router: calls API
- GitHub Actions → Catalog publication: runs jobs
- Worker router → Public handlers: routes
src/index.ts - Worker router → JSON snapshots: routes
src/index.ts - Worker router → REST catalog: routes
src/index.ts - Worker router → File delivery: routes
src/index.ts - Worker router → Online videos: routes
src/index.ts - Worker router → Authentication: routes
src/index.ts - Worker router → Catalog admin: routes
src/index.ts - Public handlers → R2 objects: reads snapshots
src/features/db.ts - JSON snapshots → R2 objects: reads snapshots
src/features/json-db.ts - File delivery → R2 objects: serves files
src/features/files.ts - REST catalog → D1 catalog: queries catalog
src/features/rest.ts - Public handlers → Media URL mapping: rewrites URLs
src/features/db.ts - JSON snapshots → Media URL mapping: rewrites URLs
src/features/json-db.ts - File delivery → Media URL mapping: resolves media
src/features/files.ts - Authentication → Session and tokens: issues sessions
src/features/auth.ts - Session and tokens → JWT signing: signs and verifies
src/lib/auth/session.ts - Session and tokens → D1 catalog: checks users
src/lib/auth/session.ts - Catalog admin → Admin listings: paginates listings
src/features/admin.ts - Catalog admin → D1 catalog: reads and writes
src/features/admin.ts - Catalog admin → Audit logging: records changes
src/features/admin.ts - Authentication → D1 catalog: reads and updates
src/features/auth.ts - Authentication → Audit logging: logs changes
src/features/auth.ts - Legacy ingestion → Legacy data helpers: loads legacy data
scripts/ingest.ts - Legacy ingestion → R2 job helpers: uploads data
scripts/ingest.ts - REST ingestion → Legacy data helpers: uses legacy data
scripts/ingest-rest.ts - REST ingestion → R2 job helpers: uploads data
scripts/ingest-rest.ts - Legacy ingestion → R2 objects: stores snapshots
- REST ingestion → R2 objects: stores REST data
- Catalog publication → D1 catalog: exports catalog
- Catalog publication → Catalog transforms: generates files
- Catalog publication → R2 objects: publishes snapshots
- Media normalization → Media processing: converts media
- Media normalization → R2 objects: stores variants
- File reconciliation → R2 objects: reconciles files
- Slide import → R2 objects: stores audio
- Video refresh → R2 objects: refreshes video data
- Delphi database export → D1 catalog: exports database
- Delphi database export → R2 objects: publishes databases
- Delphi version sync → GitHub Actions: checks releases