# ujjwaltyagi10/prepdoc architecture

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

- Interactive diagram: https://gitdiagram.com/ujjwaltyagi10/prepdoc
- Repository: https://github.com/ujjwaltyagi10/prepdoc

## Overview

#### Purpose and runtime
This is a Vite-built React/TypeScript single-page application for MAANGCo-style interview preparation: dashboards and question content for DSA, system design, and frontend topics, with authentication, progress tracking, and premium subscription gating. Browser entry is `index.html`, which mounts `src/main.tsx`; `src/App.tsx` is the top-level application composition. Deployment is configured for Vercel in `vercel.json`.

#### Application shell and routing
`src/components/app-shell.tsx` provides the authenticated application chrome and hosts feature panels. Route selection is centralized in `src/routes/app-router.tsx`, separating public and private route sets through `src/routes/public-routes.tsx` and `src/routes/private-routes.tsx`. Stable path definitions belong in `src/routes/route-paths.ts`, forming the boundary between navigation/UI and page access policy.

#### Public acquisition and account access
The unauthenticated experience includes a landing surface, dashboard preview, and policy/contact pages: `src/components/landing-page.tsx`, `src/components/public-dashboard-preview.tsx`, and `src/components/auth-screen.tsx`. `src/components/auth-gate-modal.tsx` can interrupt protected actions and direct users into authentication. `src/hooks/useGoogleOneTap.ts` indicates Google One Tap is an external identity integration; backend-facing authentication calls are isolated in `src/lib/auth-api.ts`.

#### Learning content and feature panels
Three major content domains are represented by dedicated panels: `src/components/dsa-panel.tsx`, `src/components/system-design-panel.tsx`, and `src/components/frontend-panel.tsx`. Their bundled/content-model sources are `src/data/dsa.ts`, `src/data/system-design.ts`, and `src/data/frontend.ts`. This permits core question/catalog rendering to work from client-side data while API modules handle user-specific state.

#### User dashboard and progress
`src/components/dashboard-panel.tsx` is the signed-in progress-oriented home surface. Question retrieval/state and user completion persistence cross API boundaries through `src/lib/questions-api.ts` and `src/lib/progress-api.ts`; shared domain shapes are in `src/types/maangco.ts`. Local browser persistence is encapsulated by `src/hooks/use-local-storage.ts`, likely supporting session/UI state without coupling panels directly to storage.

#### Subscription and entitlement boundary
Premium access is represented as a distinct entitlement layer rather than embedded in topic panels. `src/components/premium-gate-modal.tsx` blocks restricted actions, while `src/components/premium-modal.tsx` presents upgrade flow. Plan discovery and subscription lifecycle calls are separated into `src/lib/plans-api.ts` and `src/lib/subscription-api.ts`. `src/types/razorpay.d.ts` identifies Razorpay as the payment-checkout integration boundary.

#### Assets, PWA, and presentation
Topic visuals and instructional media are bundled under `src/assets/Video` and `src/assets`, while reusable UI primitives live in `src/components/ui/button.tsx` and `src/components/ui/shimmer.tsx`. PWA/browser metadata is supplied by `public/site.webmanifest`; generated service-worker artifacts exist in `dev-dist/sw.js`, enabling offline/cache behavior in that distribution output.

Main entry points: [`src/routes/private-routes.tsx`](https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/routes/private-routes.tsx) (Public and private routes), [`src/components/app-shell.tsx`](https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/components/app-shell.tsx) (Authenticated shell), [`src/components/dsa-panel.tsx`](https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/components/dsa-panel.tsx) (Topic panels), [`src/lib/progress-api.ts`](https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/lib/progress-api.ts) (Questions and progress APIs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Application Runtime"]
  node_browser{{"Browser / Vite<br/>runtime<br/>[index.html]"}}
  node_main["React bootstrap<br/>entry<br/>[main.tsx]"]
  node_app["App composition<br/>app root<br/>[App.tsx]"]
  node_pwa["PWA offline assets<br/>browser delivery<br/>[site.webmanifest]"]
end

subgraph group_routes["Routing &amp; Access"]
  node_router["App router<br/>[app-router.tsx]"]
  node_route_sets["Public and private routes<br/>route policy<br/>[private-routes.tsx]"]
  node_route_paths["Route paths<br/>route contract<br/>[route-paths.ts]"]
  node_shell["Authenticated shell<br/>app shell<br/>[app-shell.tsx]"]
  node_public_surfaces["Landing and account UI<br/>public UI<br/>[landing-page.tsx]"]
  node_auth_gate["Auth gate modal<br/>access gate"]
end

subgraph group_learning["Learning Experience"]
  node_dashboard["Progress dashboard<br/>feature panel"]
  node_topic_panels["Topic panels<br/>feature panels<br/>[dsa-panel.tsx]"]
  node_content_catalogs["Bundled catalogs<br/>content data<br/>[dsa.ts]"]
  node_shared_types["Learning domain types<br/>TypeScript types<br/>[maangco.ts]"]
end

subgraph group_services["User State &amp; Commerce"]
  node_auth_api["Authentication API<br/>API client<br/>[auth-api.ts]"]
  node_google_onetap{{"Google One Tap<br/>identity integration<br/>[useGoogleOneTap.ts]"}}
  node_question_progress_api["Questions and progress APIs<br/>API clients<br/>[progress-api.ts]"]
  node_local_storage[("Local storage hook<br/>browser persistence")]
  node_premium_gate["Premium access flow<br/>entitlement UI"]
  node_subscription_apis["Plans and subscriptions<br/>commerce API clients<br/>[plans-api.ts]"]
  node_razorpay{{"Razorpay checkout<br/>payment integration<br/>[razorpay.d.ts]"}}
end

node_browser -->|"loads"| node_main
node_main -->|"mounts"| node_app
node_app -->|"renders"| node_router
node_router -->|"selects access set"| node_route_sets
node_route_sets -->|"uses paths"| node_route_paths
node_route_sets -->|"authenticated routes"| node_shell
node_route_sets -->|"public routes"| node_public_surfaces
node_public_surfaces -.->|"prompts protected users"| node_auth_gate
node_auth_gate -->|"starts sign-in"| node_auth_api
node_google_onetap -->|"authenticates through"| node_auth_api
node_shell -->|"hosts"| node_dashboard
node_shell -->|"hosts"| node_topic_panels
node_topic_panels -->|"renders catalog data"| node_content_catalogs
node_dashboard -->|"loads and saves progress"| node_question_progress_api
node_topic_panels -->|"gets question state"| node_question_progress_api
node_question_progress_api -.->|"uses"| node_shared_types
node_shell -.->|"persists UI state"| node_local_storage
node_topic_panels -->|"requests restricted access"| node_premium_gate
node_premium_gate -->|"checks and upgrades"| node_subscription_apis
node_subscription_apis -->|"opens checkout"| node_razorpay
node_browser -.->|"uses manifest and cache"| node_pwa

click node_browser "https://github.com/ujjwaltyagi10/prepdoc/blob/main/index.html"
click node_main "https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/main.tsx"
click node_app "https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/App.tsx"
click node_router "https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/routes/app-router.tsx"
click node_route_sets "https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/routes/private-routes.tsx"
click node_route_paths "https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/routes/route-paths.ts"
click node_shell "https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/components/app-shell.tsx"
click node_public_surfaces "https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/components/landing-page.tsx"
click node_auth_gate "https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/components/auth-gate-modal.tsx"
click node_dashboard "https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/components/dashboard-panel.tsx"
click node_topic_panels "https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/components/dsa-panel.tsx"
click node_content_catalogs "https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/data/dsa.ts"
click node_shared_types "https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/types/maangco.ts"
click node_auth_api "https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/lib/auth-api.ts"
click node_google_onetap "https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/hooks/useGoogleOneTap.ts"
click node_question_progress_api "https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/lib/progress-api.ts"
click node_local_storage "https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/hooks/use-local-storage.ts"
click node_premium_gate "https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/components/premium-gate-modal.tsx"
click node_subscription_apis "https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/lib/plans-api.ts"
click node_razorpay "https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/types/razorpay.d.ts"
click node_pwa "https://github.com/ujjwaltyagi10/prepdoc/blob/main/public/site.webmanifest"

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_browser,node_main,node_app,node_pwa toneBlue
class node_router,node_route_sets,node_route_paths,node_shell,node_public_surfaces,node_auth_gate toneAmber
class node_dashboard,node_topic_panels,node_content_catalogs,node_shared_types toneMint
class node_auth_api,node_google_onetap,node_question_progress_api,node_local_storage,node_premium_gate,node_subscription_apis,node_razorpay toneRose
```

## Components

### Application Runtime

- [Browser / Vite](https://github.com/ujjwaltyagi10/prepdoc/blob/main/index.html): runtime · SPA entry and browser execution. · `index.html`
- [React bootstrap](https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/main.tsx): entry · `src/main.tsx`
- [App composition](https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/App.tsx): app root · `src/App.tsx`
- [PWA offline assets](https://github.com/ujjwaltyagi10/prepdoc/blob/main/public/site.webmanifest): browser delivery · Manifest and generated service worker support offline caching. · `public/site.webmanifest`

### Routing & Access

- [App router](https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/routes/app-router.tsx): router · `src/routes/app-router.tsx`
- [Public and private routes](https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/routes/private-routes.tsx): route policy · Separates unauthenticated and authenticated page access. · `src/routes/private-routes.tsx`
- [Route paths](https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/routes/route-paths.ts): route contract · `src/routes/route-paths.ts`
- [Authenticated shell](https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/components/app-shell.tsx): app shell · Hosts signed-in feature panels. · `src/components/app-shell.tsx`
- [Landing and account UI](https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/components/landing-page.tsx): public UI · Landing, preview, and authentication surfaces. · `src/components/landing-page.tsx`
- [Auth gate modal](https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/components/auth-gate-modal.tsx): access gate · `src/components/auth-gate-modal.tsx`

### Learning Experience

- [Progress dashboard](https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/components/dashboard-panel.tsx): feature panel · `src/components/dashboard-panel.tsx`
- [Topic panels](https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/components/dsa-panel.tsx): feature panels · DSA, system-design, and frontend learning views. · `src/components/dsa-panel.tsx`
- [Bundled catalogs](https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/data/dsa.ts): content data · Client-side DSA, system-design, and frontend question content. · `src/data/dsa.ts`
- [Learning domain types](https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/types/maangco.ts): TypeScript types · `src/types/maangco.ts`

### User State & Commerce

- [Authentication API](https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/lib/auth-api.ts): API client · `src/lib/auth-api.ts`
- [Google One Tap](https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/hooks/useGoogleOneTap.ts): identity integration · `src/hooks/useGoogleOneTap.ts`
- [Questions and progress APIs](https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/lib/progress-api.ts): API clients · Retrieves question state and persists completion. · `src/lib/progress-api.ts`
- [Local storage hook](https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/hooks/use-local-storage.ts): browser persistence · Encapsulates local session and UI persistence. · `src/hooks/use-local-storage.ts`
- [Premium access flow](https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/components/premium-gate-modal.tsx): entitlement UI · Gates restricted actions and presents upgrades. · `src/components/premium-gate-modal.tsx`
- [Plans and subscriptions](https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/lib/plans-api.ts): commerce API clients · Discovers plans and manages subscription lifecycle. · `src/lib/plans-api.ts`
- [Razorpay checkout](https://github.com/ujjwaltyagi10/prepdoc/blob/main/src/types/razorpay.d.ts): payment integration · `src/types/razorpay.d.ts`

## Connections

- Browser / Vite → React bootstrap: loads
- React bootstrap → App composition: mounts
- App composition → App router: renders
- App router → Public and private routes: selects access set
- Public and private routes → Route paths: uses paths
- Public and private routes → Authenticated shell: authenticated routes
- Public and private routes → Landing and account UI: public routes
- Landing and account UI → Auth gate modal: prompts protected users
- Auth gate modal → Authentication API: starts sign-in
- Google One Tap → Authentication API: authenticates through
- Authenticated shell → Progress dashboard: hosts
- Authenticated shell → Topic panels: hosts
- Topic panels → Bundled catalogs: renders catalog data
- Progress dashboard → Questions and progress APIs: loads and saves progress
- Topic panels → Questions and progress APIs: gets question state
- Questions and progress APIs → Learning domain types: uses
- Authenticated shell → Local storage hook: persists UI state
- Topic panels → Premium access flow: requests restricted access
- Premium access flow → Plans and subscriptions: checks and upgrades
- Plans and subscriptions → Razorpay checkout: opens checkout
- Browser / Vite → PWA offline assets: uses manifest and cache
