How terra-online/bayes works
OEM Backend is a Cloudflare Workers/Hono API for Open Endfield Map. Clients enter through the Worker and mounted routes to authenticate, bind game accounts or locate positions, sync normal and archive progress, and submit or read UGC; moderation, notifications, profile, and reporting are supporting product capabilities. Progress routes visibly dispatch per-user work to Durable Objects, while the tree documents the wider domain services. The supplied excerpts do not show all route-to-service or scheduled/queue wiring, so those connections are omitted where ownership is uncertain.
Main entry points: app.ts Hono app · createProgressRoutes.ts Progress API · createAuthRoutes.ts Auth routes · submitImage.ts Upload services
Components 25
API routing
- Worker entry
src/index.ts - Hono app
src/app.ts
Identity and binding
- Auth routes
src/routes/auth/createAuthRoutes.ts - Auth services
src/lib/auth/createAuth.ts - User accounts
src/repositories/users.ts - Account binding
src/routes/binding/createBindingRoutes.ts - Game API client
src/lib/endfieldClient/authClient.ts - Position locator
src/routes/binding/createLocatorRoutes.ts
Progress sync
- Progress API
src/routes/progress/createProgressRoutes.ts - Progress services
src/services/progress/manifest.ts - User progress DO
src/services/progress/userDo.ts - Progress stats DO
src/services/progress/statsDo.ts
UGC and moderation
- Upload routes
src/routes/uploads.ts - Upload services
src/services/upload/submitImage.ts - Image transcoder
containers/oem_imgTrans/server.js - UGC object store
- Moderation
src/services/moderation/core.ts - Moderation routes
src/routes/moderation.ts
User services
- Profile and contributions
src/routes/me.ts - Admin reports
src/routes/admin-reports.ts - Notifications
src/routes/notify.ts
Other components
- API client
- D1 database
- Work queues
- Redis
Connections 26
- API client → Worker entry: sends requests
- Worker entry → Hono app: serves
- Hono app → Auth routes: mounts routes
- Hono app → Account binding: mounts routes
- Hono app → Position locator: mounts routes
- Hono app → Progress API: mounts routes
- Hono app → Upload routes: mounts routes
- Hono app → Moderation routes: mounts routes
- Hono app → Profile and contributions: mounts routes
- Hono app → Admin reports: mounts routes
- Hono app → Notifications: mounts routes
- Auth routes → Auth services: uses auth
- Auth routes → User accounts: updates profiles
- Account binding → Game API client: calls game API
- Progress API → User progress DO: dispatches state/sync
- Progress API → Progress services: saves manifests
- Progress API → Progress stats DO: reads public stats
- Progress services → D1 database: persists manifests
- Upload routes → Upload services: handles uploads
- Upload services → Image transcoder: prepares images
- Upload services → UGC object store: stores assets
- Moderation routes → Moderation: runs moderation
- Moderation → Work queues: dispatches work
- Profile and contributions → User accounts: reads account data
- Admin reports → D1 database: queries reports
- Notifications → Redis: uses Redis