How northland-studio/xbed works
XBed is a BedWars tournament and player-record platform. Players browse seasons, matches, rankings, teams and profiles, and can register, submit evidence or appeal; administrators manage seasons and review matches. The documented competition lifecycle runs from signed game-server submissions through immutable raw records, review, settlement and published statistics. The graph shows that lifecycle alongside the web/API boundary and authentication. Some business modules are unsampled, so their documented roles are included without guessing internal call chains.
Main entry points: api.ts HTTP client · app.ts Express API · ingest.ts Signed match ingest · App.tsx Public and admin routes
Components 33
Web application
- Public and admin routes
apps/web/src/App.tsx - Public pages
apps/web/src/pages - Admin pages
apps/web/src/pages/admin - HTTP client
apps/web/src/lib/api.ts - Session UI
apps/web/src/lib/auth.tsx - Shared UI
apps/web/src/components/ui.tsx - Display formatting
apps/web/src/lib/format.ts - Display labels
apps/web/src/lib/labels.ts - UI event bus
apps/web/src/lib/bus.ts
Identity and access
- Express API
apps/api/src/app.ts - OAuth and login routes
apps/api/src/routes/auth.ts - OAuth client
apps/api/src/lib/oauth.ts - Session middleware
apps/api/src/middleware/auth.ts
Tournament operations
- Season and registration
apps/api/src/routes/admin/seasons.ts - Public records API
apps/api/src/routes/public.ts - Player and team API
apps/api/src/routes/me.ts - Points settlement
apps/api/src/lib/settlement.ts - Rankings and tiers
apps/api/src/lib/leaderboard.ts
Match integrity
- Signed match ingest
apps/api/src/routes/ingest.ts - Match evidence
apps/api/src/routes/evidence.ts - Match review
apps/api/src/routes/admin/matches.ts - Match appeals
apps/api/src/routes/appeals.ts
Persistence and services
- Append-only audit
apps/api/src/lib/audit.ts - Signature and encryption
apps/api/src/lib/crypto.ts - API serialization
apps/api/src/lib/serialize.ts - Domain data models
apps/api/src/db/models.ts - SQLite database
apps/api/src/db/index.ts - Runtime configuration
apps/api/src/config.ts - Time utilities
apps/api/src/lib/time.ts
Other components
- Player or visitor
- Administrator
- BedWars server plugin
- Xuanjian OAuth
Connections 38
- Player or visitor → Public and admin routes: browses
README.md - Administrator → Public and admin routes: manages
README.md - Public and admin routes → Public pages: routes to
apps/web/src/App.tsx - Public and admin routes → Admin pages: routes to
apps/web/src/App.tsx - Public pages → HTTP client: requests data
apps/web/src/pages/admin/MatchReview.tsx - Admin pages → HTTP client: requests data
apps/web/src/pages/admin/MatchReview.tsx - HTTP client → Express API: calls API
- Session UI → HTTP client: fetches session
apps/web/src/lib/auth.tsx - HTTP client → UI event bus: emits unauthorized
apps/web/src/lib/api.ts - Session UI → UI event bus: handles unauthorized
apps/web/src/lib/auth.tsx - Shared UI → HTTP client: formats errors
apps/web/src/components/ui.tsx - Shared UI → Display formatting: formats values
apps/web/src/components/ui.tsx - Shared UI → Display labels: uses labels
apps/web/src/components/ui.tsx - Xuanjian OAuth → OAuth client: OAuth exchange
README.md - Express API → OAuth and login routes: mounts routes
apps/api/src/app.ts - OAuth and login routes → OAuth client: uses client
apps/api/src/routes/auth.ts - Express API → Session middleware: installs middleware
apps/api/src/app.ts - Session middleware → SQLite database: looks up session
apps/api/src/middleware/auth.ts - BedWars server plugin → Signed match ingest: submits match
README.md - Signed match ingest → Signature and encryption: verifies signature
apps/api/src/routes/ingest.ts - Signed match ingest → SQLite database: stores raw submission
README.md - Signed match ingest → Append-only audit: records events
apps/api/src/routes/ingest.ts - Signed match ingest → Match review: awaits review
README.md - Player or visitor → Match evidence: submits evidence
README.md - Administrator → Match review: reviews matches
README.md - Match review → Points settlement: settles approved results
README.md - Points settlement → Rankings and tiers: updates rankings
README.md - Player or visitor → Match appeals: appeals result
README.md - Administrator → Season and registration: configures seasons
- Player or visitor → Season and registration: registers
README.md - Player or visitor → Public records API: views records
README.md - Player or visitor → Player and team API: views profile
README.md - Express API → SQLite database: checks health
apps/api/src/app.ts - Append-only audit → SQLite database: writes audit log
apps/api/src/lib/audit.ts - API serialization → Domain data models: serializes records
apps/api/src/lib/serialize.ts - OAuth client → Signature and encryption: uses cryptography
apps/api/src/lib/oauth.ts - Express API → Runtime configuration: configures app
apps/api/src/app.ts - OAuth client → Time utilities: uses time helpers
apps/api/src/lib/oauth.ts