How barmanji/leetcode-clone works
CodeLeet is a browser-based coding practice platform. Users browse problems, open a workspace, edit code, run it against test cases or submit it, then review execution results and submission history; accepted submissions update solved status. Separate capabilities support Clerk authentication and onboarding, admin problem creation, playlists, and user profiles. The graph distinguishes workspace UI, server actions, persistence, and Judge0 execution. Some subsystem links use README descriptions because their implementation files were not sampled; uncertain details are omitted.
Main entry points: actions/index.ts Problem actions · page.tsx Problem workspace · actions/index.ts User onboarding · db.ts PostgreSQL data
Components 21
Identity and navigation
- Sign-in UI
app/(auth)/sign-in/[[...sign-in]]/page.tsx - User onboarding
modules/auth/actions/index.ts - Navigation
modules/home/components/navbar.tsx
Problem experience
- Problem catalog
app/(root)/problems/page.tsx - Problem workspace
app/problem/[id]/page.tsx - Code editor panel
modules/problems/components/problem-page-specific-utility/code-editor-panel.tsx - Results and history
modules/problems/components/problem-page-specific-utility/result-panel.tsx - Editor workflow
modules/problems/hooks/use-editor.ts - Submission history
modules/problems/components/problem-page-specific-utility/submission-history.tsx - Problem authoring
modules/problems/components/create-problem-form/index.tsx
Execution and persistence
- Problem actions
modules/problems/actions/index.ts - Judge0 service
lib/judge0.ts - PostgreSQL data
lib/db.ts - Problem creation API
app/api/create-problem/route.ts
Profiles and playlists
- Playlist APIs
app/api/playlist - Playlist management
modules/playlists/components/playlist-list.tsx - User profile
app/(root)/profile/page.tsx
Shared domain
- Sample problem data
modules/problems/constant/sample-problem.ts - Problem domain types
modules/types/problem.ts - Action and result types
modules/types/actions.ts
Other components
- Browser user
Connections 27
- Browser user → Sign-in UI: authenticates
- Sign-in UI → User onboarding: returns session
- Browser user → Problem catalog: browses
- Problem catalog → Problem actions: loads problems
app/(root)/problems/page.tsx - Browser user → Problem workspace: opens problem
- Problem workspace → Code editor panel: renders
app/problem/[id]/page.tsx - Problem workspace → Results and history: renders
app/problem/[id]/page.tsx - Problem workspace → Editor workflow: uses workflow
app/problem/[id]/page.tsx - Editor workflow → Problem actions: runs or submits
- Problem actions → Judge0 service: executes batches
modules/problems/actions/index.ts - Problem actions → PostgreSQL data: reads and writes
modules/problems/actions/index.ts - Problem actions → User onboarding: gets current user
modules/problems/actions/index.ts - Problem actions → Results and history: returns execution results
- Problem actions → Submission history: loads submissions
- Browser user → Problem authoring: creates problem
- Problem authoring → Problem creation API: posts problem
- Problem creation API → Judge0 service: validates test cases
app/api/create-problem/route.ts - Problem creation API → PostgreSQL data: saves problem
app/api/create-problem/route.ts - Browser user → Playlist management: manages playlists
- Playlist management → Playlist APIs: uses playlist APIs
- Playlist APIs → PostgreSQL data: reads and writes
app/api/playlist/get-and-create-playlist/route.ts - Browser user → User profile: views profile
- User profile → User onboarding: loads user data
app/(root)/profile/page.tsx - User onboarding → PostgreSQL data: upserts and queries
modules/auth/actions/index.ts - Problem actions → Action and result types: uses result types
modules/problems/actions/index.ts - Problem actions → Problem domain types: uses domain types
modules/problems/actions/index.ts - Problem authoring → Sample problem data: uses defaults