# hitansh911/smart-counseling-system architecture

> Architecture diagram of the GitHub repository hitansh911/smart-counseling-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hitansh911/smart-counseling-system
- Repository: https://github.com/hitansh911/smart-counseling-system

## Overview

1. **Overall shape**
   - This is a Next.js App Router application organized as a product site plus a logged-in workspace. The root `app/` directory contains the public landing page, authentication routes, and the main authenticated application.

2. **Public vs authenticated boundary**
   - `app/(auth)` holds sign-in and sign-up pages behind an auth-specific layout.
   - `app/(main)` holds the application experience: dashboard, onboarding, resume builder, interview tools, and AI cover letters.
   - `middleware.js` and `lib/checkUser.js` indicate route protection and session/user gating at the edge or request boundary.

3. **Primary product domains**
   - The app is centered on job-search workflow features:
     - `dashboard` for overview/status
     - `resume` for building resumes
     - `interview` for practice quizzes and performance tracking
     - `ai-cover-letter` for generating and managing cover letters
     - `onboarding` for initial user setup
   - Each domain has its own route folder and local components, which keeps feature logic isolated.

4. **Dashboard as the entry workspace**
   - `app/(main)/dashboard` contains a page and a `dashboard-view` component.
   - This is likely the hub that aggregates user progress and links into the other product modules.

5. **Resume workflow**
   - `app/(main)/resume` contains a `resume-builder` and `entry-form`.
   - This suggests a structured form-driven creation flow where users enter resume data and the builder renders the final output.

6. **Interview workflow**
   - `app/(main)/interview` is split into a mock interview page and reusable components such as quiz, quiz list, result view, stats cards, and a performance chart.
   - The presence of both quiz UI and analytics components indicates a loop of practice, scoring, and performance history.

7. **AI cover letter workflow**
   - `app/(main)/ai-cover-letter` includes a list page, a new/create page, a detail page by id, plus generator and preview components.
   - This implies a CRUD-style content flow: create → list → inspect/edit/preview, with generated content stored and revisited later.

8. **Onboarding as a required setup step**
   - `app/(main)/onboarding` contains a dedicated onboarding form.
   - This likely captures user profile or job-search preferences that then influence dashboard content and generated artifacts like resumes or cover letters.

9. **Shared UI and design system**
   - `components/ui/` is a reusable component library built from common primitives such as buttons, dialogs, tabs, inputs, selects, progress, and toasts.
   - `components/header.jsx`, `components/hero.jsx`, and `components/theme-provider.jsx` support the public marketing pages and global app shell.
   - `components.json` suggests these UI primitives were scaffolded with a component system such as shadcn/ui.

10. **Content and marketing layer**
   - The `data/` directory contains static content collections like FAQs, features, how-it-works, industries, and testimonials.
   - These files feed the homepage/marketing experience and keep presentation content separate from route logic.

11. **Backend/data access layer**
   - `lib/prisma.js` and the `prisma/` directory define the database layer.
   - Prisma migrations show the app depends on a relational database with evolving models for users and industry-related data.
   - `app/lib/schema.js` and `app/lib/helper.js` likely hold validation and shared server-side utility logic close to the App Router surface.

12. **Background jobs and event processing**
   - `lib/inngest/client.js`, `lib/inngest/functions.js`, and `app/api/inngest/route.js` show an event-driven background processing path.
   - This is the main asynchronous boundary in the system: the app emits events or jobs, and Inngest handles deferred processing through a Next.js API route.

13. **State, fetching, and UX utilities**
   - `hooks/use-fetch.js` suggests a shared client-side data-fetching hook used by multiple features.
   - `components/ui/sonner.jsx` indicates toast/notification handling for async actions like form submission, generation, or save flows.
   - `lib/utils.js` likely contains formatting or class-name helpers shared across components.

14. **Architectural summary**
   - The core architecture is: authenticated Next.js UI pages on top of a Prisma-backed database, with user access controlled by middleware/auth checks, and background work delegated to Inngest.
   - The main product boundary is feature-based: dashboard, resume, interview, and AI cover letter are separate modules that share a common UI system, auth layer, and persistence layer.

Main entry points: [`app/(main)/layout.js`](https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/layout.js) (Workspace shell), [`app/(main)/resume/page.jsx`](https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/resume/page.jsx) (Resume), [`app/(main)/interview/page.jsx`](https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/interview/page.jsx) (Interview), [`app/(main)/ai-cover-letter/page.jsx`](https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/ai-cover-letter/page.jsx) (Cover letters)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_public["Public site"]
  node_app_page["Home<br/>route<br/>[page.jsx]"]
  node_app_layout["App shell<br/>layout<br/>[layout.js]"]
  node_data_content["Content data<br/>[features.js]"]
end

subgraph group_auth["Auth"]
  node_auth_layout["Auth layout<br/>[layout.js]"]
  node_sign_in["Sign in<br/>route<br/>[page.jsx]"]
  node_sign_up["Sign up<br/>route<br/>[page.jsx]"]
end

subgraph group_main["Workspace"]
  node_main_layout["Workspace shell<br/>layout<br/>[layout.js]"]
  node_dashboard_page["Dashboard<br/>route<br/>[page.jsx]"]
  node_dashboard_view["Dashboard view<br/>[dashboard-view.jsx]"]
  node_onboarding_page["Onboarding<br/>route<br/>[page.jsx]"]
  node_onboarding_form["Onboard form"]
  node_resume_page["Resume<br/>route<br/>[page.jsx]"]
  node_resume_builder["Builder<br/>[resume-builder.jsx]"]
  node_entry_form["Entry form<br/>[entry-form.jsx]"]
  node_interview_page["Interview<br/>route<br/>[page.jsx]"]
  node_mock_interview["Mock interview<br/>route<br/>[page.jsx]"]
  node_quiz["Quiz<br/>[quiz.jsx]"]
  node_interview_stats["Stats<br/>[stats-cards.jsx]"]
  node_cover_page["Cover letters<br/>route<br/>[page.jsx]"]
  node_cover_new["New letter<br/>route<br/>[page.jsx]"]
  node_cover_detail["Letter detail<br/>route<br/>[page.jsx]"]
  node_cover_generator["Generator"]
  node_cover_preview["Preview"]
end

subgraph group_shared["Shared UI"]
  node_ui_library["UI kit<br/>design-system<br/>[button.jsx]"]
  node_site_components["Site comps<br/>ui-components<br/>[header.jsx]"]
  node_fetch_hook["Fetch hook<br/>client-util<br/>[use-fetch.js]"]
end

subgraph group_backend["Backend"]
  node_user_gate["User gate<br/>auth-gate<br/>[checkUser.js]"]
  node_middleware["Middleware<br/>edge-auth<br/>[middleware.js]"]
  node_prisma_client["Prisma client<br/>db-access<br/>[prisma.js]"]
  node_schema["Schema<br/>validation<br/>[schema.js]"]
  node_inngest_api["Inngest API<br/>route<br/>[route.js]"]
  node_inngest_client["Inngest client<br/>events<br/>[client.js]"]
  node_inngest_functions["Job handlers<br/>jobs<br/>[functions.js]"]
  node_app_actions["Actions<br/>[dashboard.js]"]
end

node_app_page -->|"renders"| node_site_components
node_app_page -->|"consumes"| node_data_content
node_app_layout -->|"wraps"| node_ui_library
node_auth_layout -->|"hosts"| node_sign_in
node_auth_layout -->|"hosts"| node_sign_up
node_main_layout -->|"routes to"| node_dashboard_page
node_main_layout -->|"routes to"| node_onboarding_page
node_main_layout -->|"routes to"| node_resume_page
node_main_layout -->|"routes to"| node_interview_page
node_main_layout -->|"routes to"| node_cover_page
node_middleware -->|"delegates"| node_user_gate
node_dashboard_page -->|"uses"| node_dashboard_view
node_onboarding_page -->|"uses"| node_onboarding_form
node_resume_page -->|"uses"| node_entry_form
node_resume_page -->|"uses"| node_resume_builder
node_interview_page -->|"uses"| node_quiz
node_interview_page -->|"uses"| node_interview_stats
node_mock_interview -->|"reuses"| node_quiz
node_cover_page -->|"uses"| node_cover_generator
node_cover_page -->|"uses"| node_cover_preview
node_cover_new -->|"uses"| node_cover_generator
node_cover_detail -->|"uses"| node_cover_preview
node_ui_library -->|"supports"| node_site_components
node_fetch_hook -->|"supports"| node_dashboard_view
node_fetch_hook -->|"supports"| node_cover_generator
node_prisma_client -->|"supports"| node_app_actions
node_schema -->|"validates"| node_app_actions
node_inngest_api -->|"ingests"| node_inngest_client
node_inngest_client -->|"dispatches"| node_inngest_functions
node_app_actions -->|"emits"| node_inngest_client
node_prisma_client -->|"feeds"| node_dashboard_view

click node_app_page "https://github.com/hitansh911/smart-counseling-system/blob/master/app/page.jsx"
click node_app_layout "https://github.com/hitansh911/smart-counseling-system/blob/master/app/layout.js"
click node_auth_layout "https://github.com/hitansh911/smart-counseling-system/blob/master/app/(auth)/layout.js"
click node_sign_in "https://github.com/hitansh911/smart-counseling-system/blob/master/app/(auth)/sign-in/[[...sign-in]]/page.jsx"
click node_sign_up "https://github.com/hitansh911/smart-counseling-system/blob/master/app/(auth)/sign-up/[[...sign-up]]/page.jsx"
click node_main_layout "https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/layout.js"
click node_dashboard_page "https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/dashboard/page.jsx"
click node_dashboard_view "https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/dashboard/_component/dashboard-view.jsx"
click node_onboarding_page "https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/onboarding/page.jsx"
click node_onboarding_form "https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/onboarding/_components/onboarding-form.jsx"
click node_resume_page "https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/resume/page.jsx"
click node_resume_builder "https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/resume/_components/resume-builder.jsx"
click node_entry_form "https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/resume/_components/entry-form.jsx"
click node_interview_page "https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/interview/page.jsx"
click node_mock_interview "https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/interview/mock/page.jsx"
click node_quiz "https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/interview/_components/quiz.jsx"
click node_interview_stats "https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/interview/_components/stats-cards.jsx"
click node_cover_page "https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/ai-cover-letter/page.jsx"
click node_cover_new "https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/ai-cover-letter/new/page.jsx"
click node_cover_detail "https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/ai-cover-letter/[id]/page.jsx"
click node_cover_generator "https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/ai-cover-letter/_components/cover-letter-generator.jsx"
click node_cover_preview "https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/ai-cover-letter/_components/cover-letter-preview.jsx"
click node_ui_library "https://github.com/hitansh911/smart-counseling-system/blob/master/components/ui/button.jsx"
click node_site_components "https://github.com/hitansh911/smart-counseling-system/blob/master/components/header.jsx"
click node_fetch_hook "https://github.com/hitansh911/smart-counseling-system/blob/master/hooks/use-fetch.js"
click node_user_gate "https://github.com/hitansh911/smart-counseling-system/blob/master/lib/checkUser.js"
click node_middleware "https://github.com/hitansh911/smart-counseling-system/blob/master/middleware.js"
click node_prisma_client "https://github.com/hitansh911/smart-counseling-system/blob/master/lib/prisma.js"
click node_schema "https://github.com/hitansh911/smart-counseling-system/blob/master/app/lib/schema.js"
click node_inngest_api "https://github.com/hitansh911/smart-counseling-system/blob/master/app/api/inngest/route.js"
click node_inngest_client "https://github.com/hitansh911/smart-counseling-system/blob/master/lib/inngest/client.js"
click node_inngest_functions "https://github.com/hitansh911/smart-counseling-system/blob/master/lib/inngest/functions.js"
click node_app_actions "https://github.com/hitansh911/smart-counseling-system/blob/master/actions/dashboard.js"
click node_data_content "https://github.com/hitansh911/smart-counseling-system/blob/master/data/features.js"

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_app_page,node_app_layout,node_data_content toneBlue
class node_auth_layout,node_sign_in,node_sign_up toneAmber
class node_main_layout,node_dashboard_page,node_dashboard_view,node_onboarding_page,node_onboarding_form,node_resume_page,node_resume_builder,node_entry_form,node_interview_page,node_mock_interview,node_quiz,node_interview_stats,node_cover_page,node_cover_new,node_cover_detail,node_cover_generator,node_cover_preview toneMint
class node_ui_library,node_site_components,node_fetch_hook toneRose
class node_user_gate,node_middleware,node_prisma_client,node_schema,node_inngest_api,node_inngest_client,node_inngest_functions,node_app_actions toneIndigo
```

## Components

### Public site

Marketing and unauthenticated entry points

- [Home](https://github.com/hitansh911/smart-counseling-system/blob/master/app/page.jsx): route · Public landing page entry · `app/page.jsx`
- [App shell](https://github.com/hitansh911/smart-counseling-system/blob/master/app/layout.js): layout · Global application layout · `app/layout.js`
- [Content data](https://github.com/hitansh911/smart-counseling-system/blob/master/data/features.js): content · Marketing copy and feature data · `data/features.js`

### Auth

Sign-in and sign-up flows

- [Auth layout](https://github.com/hitansh911/smart-counseling-system/blob/master/app/(auth)/layout.js): layout · Dedicated layout for sign-in and sign-up · `app/(auth)/layout.js`
- [Sign in](https://github.com/hitansh911/smart-counseling-system/blob/master/app/(auth)/sign-in/[[...sign-in]]/page.jsx): route · Authentication entry page · `app/(auth)/sign-in/[[...sign-in]]/page.jsx`
- [Sign up](https://github.com/hitansh911/smart-counseling-system/blob/master/app/(auth)/sign-up/[[...sign-up]]/page.jsx): route · Account creation page · `app/(auth)/sign-up/[[...sign-up]]/page.jsx`

### Workspace

Authenticated product experience

- [Workspace shell](https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/layout.js): layout · Authenticated app layout · `app/(main)/layout.js`
- [Dashboard](https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/dashboard/page.jsx): route · Workspace overview entry · `app/(main)/dashboard/page.jsx`
- [Dashboard view](https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/dashboard/_component/dashboard-view.jsx): Dashboard composition and status panels · `app/(main)/dashboard/_component/dashboard-view.jsx`
- [Onboarding](https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/onboarding/page.jsx): route · Initial setup entry · `app/(main)/onboarding/page.jsx`
- [Onboard form](https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/onboarding/_components/onboarding-form.jsx): Captures profile and preferences · `app/(main)/onboarding/_components/onboarding-form.jsx`
- [Resume](https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/resume/page.jsx): route · Resume workflow entry · `app/(main)/resume/page.jsx`
- [Builder](https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/resume/_components/resume-builder.jsx): Renders the resume output · `app/(main)/resume/_components/resume-builder.jsx`
- [Entry form](https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/resume/_components/entry-form.jsx): Collects resume data · `app/(main)/resume/_components/entry-form.jsx`
- [Interview](https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/interview/page.jsx): route · Interview practice entry · `app/(main)/interview/page.jsx`
- [Mock interview](https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/interview/mock/page.jsx): route · Practice session page · `app/(main)/interview/mock/page.jsx`
- [Quiz](https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/interview/_components/quiz.jsx): Question and answer flow · `app/(main)/interview/_components/quiz.jsx`
- [Stats](https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/interview/_components/stats-cards.jsx): Performance summaries and charts · `app/(main)/interview/_components/stats-cards.jsx`
- [Cover letters](https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/ai-cover-letter/page.jsx): route · AI cover letter workspace entry · `app/(main)/ai-cover-letter/page.jsx`
- [New letter](https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/ai-cover-letter/new/page.jsx): route · Create cover letter flow · `app/(main)/ai-cover-letter/new/page.jsx`
- [Letter detail](https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/ai-cover-letter/[id]/page.jsx): route · Saved cover letter detail view · `app/(main)/ai-cover-letter/[id]/page.jsx`
- [Generator](https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/ai-cover-letter/_components/cover-letter-generator.jsx): Produces cover letter content · `app/(main)/ai-cover-letter/_components/cover-letter-generator.jsx`
- [Preview](https://github.com/hitansh911/smart-counseling-system/blob/master/app/(main)/ai-cover-letter/_components/cover-letter-preview.jsx): Reviews generated output · `app/(main)/ai-cover-letter/_components/cover-letter-preview.jsx`

### Shared UI

Reusable components and client utilities

- [UI kit](https://github.com/hitansh911/smart-counseling-system/blob/master/components/ui/button.jsx): design-system · Reusable UI primitives and controls · `components/ui/button.jsx`
- [Site comps](https://github.com/hitansh911/smart-counseling-system/blob/master/components/header.jsx): ui-components · Header, hero, and theme provider · `components/header.jsx`
- [Fetch hook](https://github.com/hitansh911/smart-counseling-system/blob/master/hooks/use-fetch.js): client-util · Shared client-side data fetching · `hooks/use-fetch.js`

### Backend

Database, auth gating, and background processing

- [User gate](https://github.com/hitansh911/smart-counseling-system/blob/master/lib/checkUser.js): auth-gate · Session and user access helper · `lib/checkUser.js`
- [Middleware](https://github.com/hitansh911/smart-counseling-system/blob/master/middleware.js): edge-auth · Route protection at the request boundary · `middleware.js`
- [Prisma client](https://github.com/hitansh911/smart-counseling-system/blob/master/lib/prisma.js): db-access · Database client setup · `lib/prisma.js`
- [Schema](https://github.com/hitansh911/smart-counseling-system/blob/master/app/lib/schema.js): validation · Shared validation and helper schema · `app/lib/schema.js`
- [Inngest API](https://github.com/hitansh911/smart-counseling-system/blob/master/app/api/inngest/route.js): route · Webhook and event intake endpoint · `app/api/inngest/route.js`
- [Inngest client](https://github.com/hitansh911/smart-counseling-system/blob/master/lib/inngest/client.js): events · Background job client · `lib/inngest/client.js`
- [Job handlers](https://github.com/hitansh911/smart-counseling-system/blob/master/lib/inngest/functions.js): jobs · Deferred background processing functions · `lib/inngest/functions.js`
- [Actions](https://github.com/hitansh911/smart-counseling-system/blob/master/actions/dashboard.js): server-actions · Feature-specific server mutations · `actions/dashboard.js`

## Connections

- Home → Site comps: renders · Homepage uses shared site UI
- Home → Content data: consumes · Homepage pulls marketing content
- App shell → UI kit: wraps · Global shell depends on shared primitives
- Auth layout → Sign in: hosts · Auth layout frames sign-in
- Auth layout → Sign up: hosts · Auth layout frames sign-up
- Workspace shell → Dashboard: routes to · Workspace layout serves dashboard area
- Workspace shell → Onboarding: routes to · Workspace layout serves onboarding
- Workspace shell → Resume: routes to · Workspace layout serves resume flow
- Workspace shell → Interview: routes to · Workspace layout serves interview tools
- Workspace shell → Cover letters: routes to · Workspace layout serves cover letters
- Middleware → User gate: delegates · Request protection relies on user/session checks
- Dashboard → Dashboard view: uses · Page composes the dashboard view
- Onboarding → Onboard form: uses · Onboarding page renders the setup form
- Resume → Entry form: uses · Resume page captures input data
- Resume → Builder: uses · Resume page renders the builder
- Interview → Quiz: uses · Interview page runs the quiz experience
- Interview → Stats: uses · Interview page shows performance tracking
- Mock interview → Quiz: reuses · Mock interview reuses quiz flow
- Cover letters → Generator: uses · List/workspace entry leads into generation
- Cover letters → Preview: uses · Workspace shows generated previews
- New letter → Generator: uses · New flow is centered on generation
- Letter detail → Preview: uses · Detail page previews a saved letter
- UI kit → Site comps: supports · Shared UI primitives underpin site components
- Fetch hook → Dashboard view: supports · Dashboard may fetch data through shared hook
- Fetch hook → Generator: supports · Generator flow may use shared fetching
- Prisma client → Actions: supports · Server actions persist and query data
- Schema → Actions: validates · Shared schema constrains server input
- Inngest API → Inngest client: ingests · API route connects app to job client
- Inngest client → Job handlers: dispatches · Client triggers async handlers
- Actions → Inngest client: emits · Mutations can enqueue background work
- Prisma client → Dashboard view: feeds · Dashboard data originates from database
