How naman22a/leetcode works
Project type and purpose
• This is a full-stack web application: a “LeetCode clone” for coding practice with real-time code execution.
• Frontend: React + TypeScript + Monaco Editor
• Backend: NestJS monolith with modular structure, Prisma ORM, PostgreSQL, Redis, and Docker for sandboxed code execution
File structure
• Top-level directories:
• assets (images)
• client (React/Vite app)
• server (NestJS API server)
• Client highlights:
• /src/pages – top-level page routes (Auth, Home, ProblemDetails, Profile)
• /src/components – reusable UI (Shadcn UI primitives, Header, Submissions list)
• /src/api – typed API adapters for auth, problems, submissions, users
• React Query + Monaco Editor for code editing/execution UI
• Server highlights:
• /src/modules – domain modules (auth, problems, submissions) each with controller, service, tests
• /src/shared/users – shared user-management module
• /src/prisma – PrismaModule + migrations + seed script
• /src/common – guards, pipes, constants, Redis client helper
• Docker invoked at runtime to run user‐submitted code
README for additional insights
• Confirms tech stack and that code runs in isolated Docker containers
• Mentions Redis (likely for caching JWT/session data or queueing execution tasks)
Detailed callouts
• Inside the NestJS block, cluster sub-components: AuthModule, ProblemsModule, SubmissionsModule, SharedUsersModule, PrismaModule, Common utilities
• That Prisma migrations and seed scripts initialize the DB schema
• “Code Execution Service” as a separate process invoked by SubmissionsModule
• That React Query handles client-side caching and state for API calls