# nhuanld17/dev-forum architecture

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

- Interactive diagram: https://gitdiagram.com/nhuanld17/dev-forum
- Repository: https://github.com/nhuanld17/dev-forum

## Overview

##### High-Level Architecture Components

a) Frontend Layers (Top to Bottom):
- Presentation Layer (UI Components)
- Feature Modules
- Core Services
- API Integration Layer

##### Detailed Component Breakdown

A. Presentation Layer
- App Layout (public facing)
- Candidate Layout
- Employer Layout
- To the UI Components library (src/components/ui)
- Routing structure (src/app/routes)

- Auth Module
- Login/Register
- Password Management
- Authentication State
- Home Module
- Candidate Features
- Employer Features
- Job Management
- Job Posting
- Job Search
- Applications

- API Client (src/lib/api-client.ts)
- React Query Integration (src/lib/react-query.ts)
- Utils (Time, Regex, etc.)

##### Data Flow Representation

- User interaction flow
- API calls flow
- State management flow

##### Technical Stack Indicators

- React + TypeScript
- Vite
- TailwindCSS
- React Query
- Storybook

##### Architectural Patterns to Highlight

Clear separation of:
- Feature-based organization
- Component composition
- Layout system
- Route protection

- The clear separation between candidate and employer features
- The reusable UI component system
- The authentication and authorization flow
- The API integration layer

Key Relationships to Show:
##### How shared components are utilized

Remember to:
- Use consistent styling
- Brief annotations for complex flows
- Clear boundaries between public and private sections

This architecture represents a modern React application with clear separation of concerns, feature-based organization, and robust authentication/authorization mechanisms.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Presentation Layer"
        AppLayout["App Layout"]:::layout
        CandLayout["Candidate Layout"]:::layout
        EmpLayout["Employer Layout"]:::layout
        AuthLayout["Auth Layout"]:::layout
        UILib["UI Component Library"]:::ui
        Router["Router System"]:::router
    end

    subgraph "Feature Modules"
        subgraph "Auth Module"
            AuthCore["Core Auth"]:::auth
            AuthRoutes["Auth Routes"]:::auth
            AuthAPI["Auth API"]:::auth
            AuthForms["Auth Forms"]:::auth
        end

        subgraph "Home Module"
            HomeCore["Home Features"]:::feature
            CandFeatures["Candidate Features"]:::feature
            EmpFeatures["Employer Features"]:::feature
        end
    end

    subgraph "Core Services"
        APIClient["API Client"]:::service
        ReactQuery["React Query"]:::service
        Utils["Utilities"]:::service
    end

    subgraph "UI Components"
        BaseComps["Base Components"]:::ui
        FormComps["Form Components"]:::ui
        Overlay["Overlay System"]:::ui
        Toast["Toast System"]:::ui
    end

    subgraph "Routing"
        MainRouter["Main Router"]:::router
        PublicRoutes["Public Routes"]:::public
        PrivateRoutes["Private Routes"]:::private
    end

    subgraph "API Integration"
        APIFeatures["API Features"]:::api
        APITypes["API Types"]:::api
        Endpoints["Endpoints"]:::api
    end

    %% Relationships
    AppLayout --> UILib
    CandLayout --> UILib
    EmpLayout --> UILib
    AuthLayout --> UILib

    AuthCore --> AuthAPI
    AuthCore --> AuthForms
    AuthRoutes --> AuthCore

    HomeCore --> CandFeatures
    HomeCore --> EmpFeatures

    APIClient --> ReactQuery
    APIClient --> Endpoints

    BaseComps --> FormComps
    BaseComps --> Overlay
    BaseComps --> Toast

    MainRouter --> PublicRoutes
    MainRouter --> PrivateRoutes

    %% Click Events
    click AppLayout "https://github.com/nhuanld17/dev-forum/tree/main/src/components/layouts/app-layout/"
    click CandLayout "https://github.com/nhuanld17/dev-forum/tree/main/src/components/layouts/candidate-layout/"
    click EmpLayout "https://github.com/nhuanld17/dev-forum/tree/main/src/components/layouts/employer-layout/"
    click AuthLayout "https://github.com/nhuanld17/dev-forum/tree/main/src/components/layouts/auth-layout/"
    click AuthCore "https://github.com/nhuanld17/dev-forum/tree/main/src/features/auth/"
    click AuthRoutes "https://github.com/nhuanld17/dev-forum/tree/main/src/app/routes/auth/"
    click AuthAPI "https://github.com/nhuanld17/dev-forum/tree/main/src/features/auth/api/"
    click AuthForms "https://github.com/nhuanld17/dev-forum/tree/main/src/features/auth/components/"
    click HomeCore "https://github.com/nhuanld17/dev-forum/tree/main/src/features/home/"
    click CandFeatures "https://github.com/nhuanld17/dev-forum/tree/main/src/features/home/api/candidate/"
    click EmpFeatures "https://github.com/nhuanld17/dev-forum/tree/main/src/features/home/api/employer/"
    click APIClient "https://github.com/nhuanld17/dev-forum/blob/main/src/lib/api-client.ts"
    click ReactQuery "https://github.com/nhuanld17/dev-forum/blob/main/src/lib/react-query.ts"
    click Utils "https://github.com/nhuanld17/dev-forum/tree/main/src/utils/"
    click BaseComps "https://github.com/nhuanld17/dev-forum/tree/main/src/components/ui/"
    click FormComps "https://github.com/nhuanld17/dev-forum/tree/main/src/components/ui/form/"
    click Overlay "https://github.com/nhuanld17/dev-forum/tree/main/src/components/ui/overlay/"
    click Toast "https://github.com/nhuanld17/dev-forum/tree/main/src/components/ui/toast/"
    click MainRouter "https://github.com/nhuanld17/dev-forum/blob/main/src/app/router.tsx"
    click PublicRoutes "https://github.com/nhuanld17/dev-forum/tree/main/src/app/routes/app/public/"
    click PrivateRoutes "https://github.com/nhuanld17/dev-forum/tree/main/src/app/routes/app/private/"
    click APIFeatures "https://github.com/nhuanld17/dev-forum/tree/main/src/features/api/"
    click APITypes "https://github.com/nhuanld17/dev-forum/tree/main/src/types/"
    click Endpoints "https://github.com/nhuanld17/dev-forum/blob/main/src/utils/endpoint-url.tsx"

    %% Styles
    classDef layout fill:#e1e1e1,stroke:#333
    classDef ui fill:#d4e6f1,stroke:#333
    classDef router fill:#d5f5e3,stroke:#333
    classDef auth fill:#f9e79f,stroke:#333
    classDef feature fill:#d7bde2,stroke:#333
    classDef service fill:#f5cba7,stroke:#333
    classDef api fill:#abebc6,stroke:#333
    classDef public fill:#82e0aa,stroke:#333
    classDef private fill:#85c1e9,stroke:#333
```
