📄️ Overview
Contracts must stay in sync with implementation. If route behavior, context state, emitted/listened socket events, or component props change, update these docs in the same PR.
📄️ Pages and Routes
This app uses the Next.js Pages Router. Client-side navigation is handled with next/router and most pages gate access with authClient.useSession().
📄️ UI Components
This document captures the public contract for reusable UI components that own app-level state, socket behavior, or core UI flows.
📄️ Frontend Context Providers
Context modules live in src/contexts and are responsible for cross-page state and socket lifecycle glue. Global providers are composed in _app.tsx. Game-only providers are created inside the game room page.
📄️ Middleware
Next.js middleware that redirects unauthenticated requests to /login.
📄️ Authentication Module
auth — src/lib/auth.ts
📄️ Prisma Client
Singleton PrismaClient using the native PrismaPg adapter. Shared across all server-side code. Requires DATABASE_URL to be set before first import.
📄️ WebSocket Events
Socket.IO, same origin as Next.js. Client connects with io() (no args). Server defined in server/index.js. Redis-backed for cluster-aware rooms and code/chat/test-case state persistence.
📄️ Execution
registerExecutionHandlers — server/socket/handlers/executionHandlers.js