# dinesh-dk007/codesync architecture

> Architecture diagram of the GitHub repository dinesh-dk007/codesync, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dinesh-dk007/codesync
- Repository: https://github.com/dinesh-dk007/codesync

## Overview

#### Purpose and runtime
CodeSync is a browser-based technical-interview platform: authenticated users schedule or join interview meetings with shared coding, challenge context, and live audio/video. It runs as a Next.js App Router application, deployed for Vercel, with Convex as the realtime backend and Stream for call transport. Core entry points are `src/app/layout.tsx`, `src/app/(root)/(home)/page.tsx`, and `convex/schema.ts`.

#### Application routing and access boundary
The route tree separates general interview workflows from administration. Root pages cover home, scheduling, recordings, and per-meeting sessions; the admin dashboard is isolated under its own route group. Request-level access handling is centralized in `src/middleware.ts`. Key routes: `src/app/(root)/meeting/[id]/page.tsx`, `src/app/(root)/schedule/page.tsx`, and `src/app/(admin)/dashboard/page.tsx`.

#### Client provider composition
The root UI is wrapped by providers that establish cross-cutting client state: Convex plus Clerk identity, Stream client connectivity, and theme state. This is the principal integration boundary between React UI and external services. Paths: `src/app/layout.tsx`, `src/components/providers/ConvexClerkProviders.tsx`, `src/components/providers/StreamClientProvider.tsx`.

#### Meeting lifecycle and call orchestration
Meeting creation, lookup, joining, and termination are represented in UI components and hooks, with Stream server-side/token-related actions supplying call access. The meeting route resolves a call by ID, then renders setup or active-room experiences. Paths: `src/components/MeetingSetup.tsx`, `src/components/MeetingRoom.tsx`, `src/actions/stream.actions.ts`.

#### Collaborative interview workspace
The active room combines Stream communications with the interview-specific workspace: code editing, problem-oriented interaction, and comments. UI components define this collaboration boundary while persisted interview state is managed through Convex. Paths: `src/components/CodeEditor.tsx`, `src/components/CommentDialog.tsx`, `convex/interviews.ts`.

#### Convex domain backend
Convex owns realtime application data and mutations/queries for users, interviews, meeting-code resolution, and comments. Its schema is the durable domain contract; generated bindings connect frontend code to typed backend APIs. HTTP/auth configuration provides backend integration points. Paths: `convex/schema.ts`, `convex/interviews.ts`, `convex/comments.ts`.

#### Scheduling, discovery, and recordings flow
Users schedule interviews, retrieve available calls, and view past recordings through route-level screens backed by call-oriented hooks. These screens consume Convex/Stream-derived meeting data rather than maintaining an independent application server. Paths: `src/app/(root)/schedule/InterviewScheduleUI.tsx`, `src/app/(root)/recordings/page.tsx`, `src/hooks/useGetCalls.ts`.

#### Identity, roles, and external services
Clerk supplies authentication and is connected to Convex through backend auth configuration; user records and roles support interviewer/candidate/admin-oriented behavior. Stream.io provides low-latency calling and recordings, while Convex provides reactive persistence. Paths: `convex/auth.config.ts`, `convex/users.ts`, `src/hooks/useUserRole.ts`.

Main entry points: [`src/app/(root)/(home)/page.tsx`](https://github.com/dinesh-dk007/codesync/blob/main/src/app/(root)/(home)/page.tsx) (Interview routes), [`src/components/providers/ConvexClerkProviders.tsx`](https://github.com/dinesh-dk007/codesync/blob/main/src/components/providers/ConvexClerkProviders.tsx) (Convex + Clerk provider), [`src/components/MeetingRoom.tsx`](https://github.com/dinesh-dk007/codesync/blob/main/src/components/MeetingRoom.tsx) (Meeting setup and room), [`src/components/CodeEditor.tsx`](https://github.com/dinesh-dk007/codesync/blob/main/src/components/CodeEditor.tsx) (Collaborative workspace)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Next.js web app"]
  node_middleware{{"Access middleware<br/>Next.js middleware<br/>[middleware.ts]"}}
  node_routes["Interview routes<br/>App Router screens<br/>[page.tsx]"]
  node_meeting_route["Meeting session route<br/>dynamic route<br/>[page.tsx]"]
  node_schedule_ui["Scheduling UI<br/>route component"]
  node_recordings["Recordings screen<br/>route<br/>[page.tsx]"]
  node_admin["Admin dashboard<br/>isolated route<br/>[page.tsx]"]
  node_providers{{"Client providers<br/>integration boundary<br/>[layout.tsx]"}}
  node_convex_clerk_provider["Convex + Clerk provider<br/>client provider"]
  node_stream_provider["Stream client provider"]
  node_meeting_experience["Meeting setup and room<br/>meeting UI<br/>[MeetingRoom.tsx]"]
  node_workspace["Collaborative workspace<br/>interview UI<br/>[CodeEditor.tsx]"]
  node_calls_hook["Call discovery hook<br/>client hook<br/>[useGetCalls.ts]"]
  node_role_hook["User role hook<br/>client hook<br/>[useUserRole.ts]"]
end

subgraph group_realtime["Convex backend"]
  node_schema[("Domain schema<br/>Convex schema<br/>[schema.ts]")]
  node_interviews["Interview domain API<br/>Convex functions<br/>[interviews.ts]"]
  node_comments["Comment domain API<br/>Convex functions<br/>[comments.ts]"]
  node_users["User domain API<br/>Convex functions<br/>[users.ts]"]
  node_convex_auth{{"Convex auth config<br/>backend auth config<br/>[auth.config.ts]"}}
end

subgraph group_services["External services"]
  node_stream_actions["Stream call actions<br/>server actions<br/>[stream.actions.ts]"]
  node_clerk(("Clerk<br/>identity service"))
  node_stream(("Stream.io<br/>call and recordings service"))
end

node_middleware -->|"guards requests"| node_routes
node_middleware -->|"isolates access"| node_admin
node_providers -->|"composes"| node_convex_clerk_provider
node_providers -->|"composes"| node_stream_provider
node_convex_clerk_provider -->|"authenticates with"| node_clerk
node_convex_clerk_provider -->|"connects identity"| node_convex_auth
node_stream_provider -->|"connects calls"| node_stream
node_routes -->|"scheduling flow"| node_schedule_ui
node_routes -->|"recordings flow"| node_recordings
node_schedule_ui -->|"discovers calls"| node_calls_hook
node_recordings -->|"loads past calls"| node_calls_hook
node_meeting_route -->|"renders setup or room"| node_meeting_experience
node_meeting_experience -->|"gets call access"| node_stream_actions
node_stream_actions -->|"creates and authorizes calls"| node_stream
node_meeting_experience -->|"hosts"| node_workspace
node_workspace -->|"syncs interview state"| node_interviews
node_workspace -->|"persists comments"| node_comments
node_calls_hook -->|"reads meeting data"| node_interviews
node_role_hook -->|"reads role data"| node_users
node_admin -->|"uses authorization role"| node_role_hook
node_interviews -->|"uses"| node_schema
node_comments -->|"uses"| node_schema
node_users -->|"uses"| node_schema

click node_middleware "https://github.com/dinesh-dk007/codesync/blob/main/src/middleware.ts"
click node_routes "https://github.com/dinesh-dk007/codesync/blob/main/src/app/(root)/(home)/page.tsx"
click node_meeting_route "https://github.com/dinesh-dk007/codesync/blob/main/src/app/(root)/meeting/%5Bid%5D/page.tsx"
click node_schedule_ui "https://github.com/dinesh-dk007/codesync/blob/main/src/app/(root)/schedule/InterviewScheduleUI.tsx"
click node_recordings "https://github.com/dinesh-dk007/codesync/blob/main/src/app/(root)/recordings/page.tsx"
click node_admin "https://github.com/dinesh-dk007/codesync/blob/main/src/app/(admin)/dashboard/page.tsx"
click node_providers "https://github.com/dinesh-dk007/codesync/blob/main/src/app/layout.tsx"
click node_convex_clerk_provider "https://github.com/dinesh-dk007/codesync/blob/main/src/components/providers/ConvexClerkProviders.tsx"
click node_stream_provider "https://github.com/dinesh-dk007/codesync/blob/main/src/components/providers/StreamClientProvider.tsx"
click node_meeting_experience "https://github.com/dinesh-dk007/codesync/blob/main/src/components/MeetingRoom.tsx"
click node_workspace "https://github.com/dinesh-dk007/codesync/blob/main/src/components/CodeEditor.tsx"
click node_calls_hook "https://github.com/dinesh-dk007/codesync/blob/main/src/hooks/useGetCalls.ts"
click node_role_hook "https://github.com/dinesh-dk007/codesync/blob/main/src/hooks/useUserRole.ts"
click node_schema "https://github.com/dinesh-dk007/codesync/blob/main/convex/schema.ts"
click node_interviews "https://github.com/dinesh-dk007/codesync/blob/main/convex/interviews.ts"
click node_comments "https://github.com/dinesh-dk007/codesync/blob/main/convex/comments.ts"
click node_users "https://github.com/dinesh-dk007/codesync/blob/main/convex/users.ts"
click node_convex_auth "https://github.com/dinesh-dk007/codesync/blob/main/convex/auth.config.ts"
click node_stream_actions "https://github.com/dinesh-dk007/codesync/blob/main/src/actions/stream.actions.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_middleware,node_routes,node_meeting_route,node_schedule_ui,node_recordings,node_admin,node_providers,node_convex_clerk_provider,node_stream_provider,node_meeting_experience,node_workspace,node_calls_hook,node_role_hook toneBlue
class node_schema,node_interviews,node_comments,node_users,node_convex_auth toneAmber
class node_stream_actions,node_clerk,node_stream toneMint
```

## Components

### Next.js web app

- [Access middleware](https://github.com/dinesh-dk007/codesync/blob/main/src/middleware.ts): Next.js middleware · Centralizes request-level access handling. · `src/middleware.ts`
- [Interview routes](https://github.com/dinesh-dk007/codesync/blob/main/src/app/(root)/(home)/page.tsx): App Router screens · Home, scheduling, recordings, and meeting workflows. · `src/app/(root)/(home)/page.tsx`
- [Meeting session route](https://github.com/dinesh-dk007/codesync/blob/main/src/app/(root)/meeting/%5Bid%5D/page.tsx): dynamic route · Resolves a meeting by call ID. · `src/app/(root)/meeting/[id]/page.tsx`
- [Scheduling UI](https://github.com/dinesh-dk007/codesync/blob/main/src/app/(root)/schedule/InterviewScheduleUI.tsx): route component · `src/app/(root)/schedule/InterviewScheduleUI.tsx`
- [Recordings screen](https://github.com/dinesh-dk007/codesync/blob/main/src/app/(root)/recordings/page.tsx): route · `src/app/(root)/recordings/page.tsx`
- [Admin dashboard](https://github.com/dinesh-dk007/codesync/blob/main/src/app/(admin)/dashboard/page.tsx): isolated route · `src/app/(admin)/dashboard/page.tsx`
- [Client providers](https://github.com/dinesh-dk007/codesync/blob/main/src/app/layout.tsx): integration boundary · Composes identity, realtime, call connectivity, and theme state. · `src/app/layout.tsx`
- [Convex + Clerk provider](https://github.com/dinesh-dk007/codesync/blob/main/src/components/providers/ConvexClerkProviders.tsx): client provider · `src/components/providers/ConvexClerkProviders.tsx`
- [Stream client provider](https://github.com/dinesh-dk007/codesync/blob/main/src/components/providers/StreamClientProvider.tsx): client provider · `src/components/providers/StreamClientProvider.tsx`
- [Meeting setup and room](https://github.com/dinesh-dk007/codesync/blob/main/src/components/MeetingRoom.tsx): meeting UI · Transitions users from call setup into an active room. · `src/components/MeetingRoom.tsx`
- [Collaborative workspace](https://github.com/dinesh-dk007/codesync/blob/main/src/components/CodeEditor.tsx): interview UI · Shared coding and comment interaction inside the active room. · `src/components/CodeEditor.tsx`
- [Call discovery hook](https://github.com/dinesh-dk007/codesync/blob/main/src/hooks/useGetCalls.ts): client hook · Retrieves available and past calls. · `src/hooks/useGetCalls.ts`
- [User role hook](https://github.com/dinesh-dk007/codesync/blob/main/src/hooks/useUserRole.ts): client hook · `src/hooks/useUserRole.ts`

### Convex backend

- [Domain schema](https://github.com/dinesh-dk007/codesync/blob/main/convex/schema.ts): Convex schema · Durable contract for users, interviews, and comments. · `convex/schema.ts`
- [Interview domain API](https://github.com/dinesh-dk007/codesync/blob/main/convex/interviews.ts): Convex functions · Realtime interview state and meeting-code resolution. · `convex/interviews.ts`
- [Comment domain API](https://github.com/dinesh-dk007/codesync/blob/main/convex/comments.ts): Convex functions · `convex/comments.ts`
- [User domain API](https://github.com/dinesh-dk007/codesync/blob/main/convex/users.ts): Convex functions · User records and role-oriented behavior. · `convex/users.ts`
- [Convex auth config](https://github.com/dinesh-dk007/codesync/blob/main/convex/auth.config.ts): backend auth config · Connects Clerk identity to Convex. · `convex/auth.config.ts`

### External services

- [Stream call actions](https://github.com/dinesh-dk007/codesync/blob/main/src/actions/stream.actions.ts): server actions · Supplies call creation and access tokens. · `src/actions/stream.actions.ts`
- **Clerk**: identity service
- **Stream.io**: call and recordings service · Provides live audio/video transport and recordings.

## Connections

- Access middleware → Interview routes: guards requests
- Access middleware → Admin dashboard: isolates access
- Client providers → Convex + Clerk provider: composes
- Client providers → Stream client provider: composes
- Convex + Clerk provider → Clerk: authenticates with
- Convex + Clerk provider → Convex auth config: connects identity
- Stream client provider → Stream.io: connects calls
- Interview routes → Scheduling UI: scheduling flow
- Interview routes → Recordings screen: recordings flow
- Scheduling UI → Call discovery hook: discovers calls
- Recordings screen → Call discovery hook: loads past calls
- Meeting session route → Meeting setup and room: renders setup or room
- Meeting setup and room → Stream call actions: gets call access
- Stream call actions → Stream.io: creates and authorizes calls
- Meeting setup and room → Collaborative workspace: hosts
- Collaborative workspace → Interview domain API: syncs interview state
- Collaborative workspace → Comment domain API: persists comments
- Call discovery hook → Interview domain API: reads meeting data
- User role hook → User domain API: reads role data
- Admin dashboard → User role hook: uses authorization role
- Interview domain API → Domain schema: uses
- Comment domain API → Domain schema: uses
- User domain API → Domain schema: uses
