- Extend waiting rooms while players or spectators are active - Make cleanup time configurable for tests and defaults - Tweak lobby layout for smaller screens
Aurora API
Aurora's API is a Bun server that runs inside the same process as the Discord bot. It serves REST routes, the authenticated WebSocket endpoint, static assets, and built panel files.
Runtime model
- Entry point:
api/src/server.ts - Route dispatcher:
api/src/routes/index.ts - Auth: Discord OAuth with signed session cookies
- WebSocket:
/ws - Static assets:
/assets/* - Built panel fallback:
panel/dist
Access model
Public:
GET /api/health/auth/discord/auth/callbackPOST /auth/logoutGET /auth/me
Player-accessible API routes:
GET /api/statsGET /api/healthGET /api/meGET /api/me/inventory
Admin-only API routes:
- everything else under
/api/*
Admin vs player is derived from ADMIN_USER_IDS. A user must already exist in the users table to complete panel login.
Route summary
Auth
GET /auth/discordGET /auth/callbackPOST /auth/logoutGET /auth/me
Dashboard and system
GET /api/healthGET /api/statsGET /api/stats/activityPOST /api/actions/reload-commandsPOST /api/actions/clear-cachePOST /api/actions/maintenance-mode
Settings
GET /api/settingsPOST /api/settingsGET /api/settings/metaGET /api/guilds/:guildId/settingsPUT|PATCH /api/guilds/:guildId/settingsDELETE /api/guilds/:guildId/settings
Users, classes, and inventory
GET /api/meGET /api/me/inventoryGET /api/usersGET /api/users/:idPUT /api/users/:idGET /api/users/:id/inventoryPOST /api/users/:id/inventoryDELETE /api/users/:id/inventory/:itemIdGET /api/classesPOST /api/classesPUT /api/classes/:idDELETE /api/classes/:id
Game content
GET /api/itemsPOST /api/itemsGET /api/items/:idPUT /api/items/:idDELETE /api/items/:idPOST /api/items/:id/iconGET /api/questsPOST /api/questsPUT /api/quests/:idDELETE /api/quests/:idGET /api/lootdropsPOST /api/lootdropsDELETE /api/lootdrops/:messageId
Moderation and economy history
GET /api/moderationPOST /api/moderationGET /api/transactions
WebSocket
/ws requires a valid aurora_session cookie.
Current behavior:
- dashboard clients subscribe to
dashboard - game clients also use lobby and room-scoped traffic through
GameServer PINGfrom the client returnsPONG- dashboard stats are broadcast every 5 seconds while at least one client is connected
- hard limits in
api/src/server.ts:- 200 concurrent connections
- 16 KB max payload
- 60 second idle timeout
Development
Start the backend:
bun run dev
Optional panel dev server:
bun run panel:dev
Panel dev runs on http://localhost:5173 and proxies API/auth/assets/WebSocket requests to http://localhost:3000.