How lithiumox-codam/transcendence works
Project type and purpose
• This is a turborepo-based full-stack real-time multiplayer “Transcendence” application.
• The frontend is a SvelteKit app (apps/frontend) providing UI, internationalization, routing, and TRPC client hooks.
• The backend is a Node/TypeScript server (apps/backend) using tRPC routers, matchmaking, event emitters, game logic, and a relational database via Drizzle ORM.
• Shared packages implement cross-cutting concerns: authentication, database schema/ORM, game logic, and tRPC utilities.
File structure
• Top-level directories:
• apps/frontend – SvelteKit code, components, routes, TRPC client, i18n
• apps/backend – tRPC server entrypoint, router mounting
• packages/auth – OAuth flows, session management
• packages/database – Drizzle configuration, schemas, types, data access utilities
• packages/game – core game logic, rules, state transitions
• packages/trpc – tRPC router definitions (auth, chat, game, stats, GDPR, friends, user), typed emitter, matchmaking, root router
• packages/tsconfig – shared TypeScript configs
• turbo.json, pnpm-workspace.yaml – monorepo build orchestrators
• Configuration files for build, linting, formatting, VSCode workspace all live at the root.
README
• Confirms a turborepo starter with two SvelteKit apps and shared libraries.
Main components
a. Frontend
• SvelteKit App (apps/frontend)
• TRPC client layer (HTTP + WebSocket transport)
• UI components (Chat, Game board, Stats, Authentication flows)
• i18n subsystem
b. Backend
• Node.js tRPC server (apps/backend packages/trpc)
• tRPC routers (auth, chat, game, friends, stats, GDPR, user)
• Event emitter / matchmaking engine (packages/trpc/src/events, matchmaking.ts)
• Game logic module (packages/game)
• Auth module (packages/auth)
• Database access layer (Drizzle ORM in packages/database)
c. Infrastructure
• Relational Database (e.g., PostgreSQL via Drizzle)
• External OAuth providers (Google, etc.)
• Monorepo toolchain (pnpm, Turborepo)
d. CI/CD and Dev Tools
• GitHub workflows (.github)
• VS Code workspace config
• Build orchestrator (turbo.json)
Relationships and interactions
• The SvelteKit frontend issues TRPC calls over HTTP/WebSockets to the Node tRPC server.
• tRPC resolvers invoke:
• Auth module for sign-in, JWT/session management, OAuth callback flows
• Database module for CRUD operations, schema enforcement
• Game module for game state updates, match creation
• Event emitter for broadcasting chat messages, game events to subscribed clients
• The backend persists data to the database and integrates with external OAuth endpoints.
• Shared packages are imported by both frontend (tsconfig, types) and backend (business logic).
Architectural patterns and principles
• Monorepo with modular packages for separation of concerns and code reuse.
• Client-server separation with strong typing via tRPC.
• Event-driven design for real-time features using typed emitters and WebSockets.
• Layered architecture: API layer (tRPC) → domain layer (game, auth, chat) → data layer (Drizzle).
• Feature-based routing in SvelteKit for auth, protected routes, demos, privacy pages.