# evondev/ucademy-app architecture

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

- Interactive diagram: https://gitdiagram.com/evondev/ucademy-app
- Repository: https://github.com/evondev/ucademy-app

## Overview

##### Main System Components

a) Frontend Layer:
- Next.js App Router Structure
- Dashboard Interface
- Course Management Interface
- User Authentication Interface
- Admin Management Interface

b) Core Modules Layer:
- Course Module
- User Module
- Order Module
- Rating Module
- Comment Module
- Coupon Module
- Lecture/Lesson Module
- History Module

c) Shared Infrastructure Layer:
- Components Library
- UI Components
- Common Utilities
- Types/Schemas
- Contexts/Store

d) Backend Layer:
- API Routes
- Database (MongoDB with Mongoose)
- External Services (Clerk for auth, Uploadthing)

##### Component Relationships

**[Client Browser] ←→ [Next.js Frontend]**
- ↓
**[App Router (src/app/*)]**
- ↓
**[Module Pages] ←→ [Shared Components]**
- ↓
**[Module Actions] ←→ [API Routes]**
- ↓
**[Database Layer]**

##### Specific Implementation Details

**[Module: Course]**
- Actions
- Components
- Pages
- Schemas
- Types

**[Shared Infrastructure]**
- UI Components
- Common Components
- Helpers
- Constants
- Types

##### Key Technical Elements to Highlight

- Next.js 13+ App Router architecture
- MongoDB with Mongoose integration
- Authentication system
- File upload system
- State management
- API routes structure

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Web Browser"]
    end

    subgraph "Frontend Layer"
        NextApp["Next.js App"]:::frontend
        DashboardUI["Dashboard Interface"]:::frontend
        AuthUI["Auth Interface"]:::frontend
        CourseUI["Course Management"]:::frontend
        AdminUI["Admin Interface"]:::frontend
    end

    subgraph "Core Modules"
        CourseModule["Course Module"]:::module
        UserModule["User Module"]:::module
        OrderModule["Order Module"]:::module
        RatingModule["Rating Module"]:::module
        CommentModule["Comment Module"]:::module
        CouponModule["Coupon Module"]:::module
        LectureModule["Lecture Module"]:::module
        LessonModule["Lesson Module"]:::module
        HistoryModule["History Module"]:::module
    end

    subgraph "Shared Infrastructure"
        UIComponents["UI Components"]:::shared
        CommonComponents["Common Components"]:::shared
        Types["Types/Schemas"]:::shared
        Constants["Constants"]:::shared
        Contexts["Contexts"]:::shared
        Utils["Utilities"]:::shared
        Store["Store"]:::shared
    end

    subgraph "Backend Layer"
        APIRoutes["API Routes"]:::backend
        DB[(MongoDB)]:::database
        FileUpload["File Upload Service"]:::backend
        DBConnection["Database Connection"]:::backend
    end

    subgraph "External Services"
        Auth["Clerk Auth"]:::external
        UploadThing["UploadThing"]:::external
    end

    Browser --> NextApp
    NextApp --> DashboardUI & AuthUI & CourseUI & AdminUI

    DashboardUI & AuthUI & CourseUI & AdminUI --> |Uses| UIComponents
    DashboardUI & AuthUI & CourseUI & AdminUI --> |Uses| CommonComponents

    CourseModule & UserModule & OrderModule & RatingModule & CommentModule & CouponModule & LectureModule & LessonModule & HistoryModule --> |Uses| Types
    CourseModule & UserModule & OrderModule & RatingModule & CommentModule & CouponModule & LectureModule & LessonModule & HistoryModule --> |Uses| Constants
    CourseModule & UserModule & OrderModule & RatingModule & CommentModule & CouponModule & LectureModule & LessonModule & HistoryModule --> |Uses| Utils

    CourseModule & UserModule & OrderModule & RatingModule & CommentModule & CouponModule & LectureModule & LessonModule & HistoryModule --> |API Calls| APIRoutes

    APIRoutes --> DBConnection
    DBConnection --> DB
    APIRoutes --> Auth
    APIRoutes --> FileUpload
    FileUpload --> UploadThing

    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef module fill:#2ecc71,stroke:#27ae60,color:white
    classDef shared fill:#f1c40f,stroke:#f39c12,color:black
    classDef backend fill:#9b59b6,stroke:#8e44ad,color:white
    classDef database fill:#34495e,stroke:#2c3e50,color:white
    classDef external fill:#e67e22,stroke:#d35400,color:white

    click NextApp "https://github.com/evondev/ucademy-app/tree/master/src/app/(dashboard)"
    click DashboardUI "https://github.com/evondev/ucademy-app/blob/master/src/app/(dashboard)/page.tsx"
    click AuthUI "https://github.com/evondev/ucademy-app/tree/master/src/app/sign-in"
    click CourseUI "https://github.com/evondev/ucademy-app/tree/master/src/app/(dashboard)/manage/course"
    click CourseModule "https://github.com/evondev/ucademy-app/tree/master/src/modules/course"
    click UserModule "https://github.com/evondev/ucademy-app/tree/master/src/modules/user"
    click OrderModule "https://github.com/evondev/ucademy-app/tree/master/src/modules/order"
    click RatingModule "https://github.com/evondev/ucademy-app/tree/master/src/modules/rating"
    click CommentModule "https://github.com/evondev/ucademy-app/tree/master/src/modules/comment"
    click CouponModule "https://github.com/evondev/ucademy-app/tree/master/src/modules/coupon"
    click LectureModule "https://github.com/evondev/ucademy-app/tree/master/src/modules/lecture"
    click LessonModule "https://github.com/evondev/ucademy-app/tree/master/src/modules/lesson"
    click HistoryModule "https://github.com/evondev/ucademy-app/tree/master/src/modules/history"
    click UIComponents "https://github.com/evondev/ucademy-app/tree/master/src/shared/components/ui"
    click CommonComponents "https://github.com/evondev/ucademy-app/tree/master/src/shared/components/common"
    click Types "https://github.com/evondev/ucademy-app/tree/master/src/shared/types"
    click Constants "https://github.com/evondev/ucademy-app/tree/master/src/shared/constants"
    click Contexts "https://github.com/evondev/ucademy-app/tree/master/src/shared/contexts"
    click Utils "https://github.com/evondev/ucademy-app/tree/master/src/shared/utils"
    click Store "https://github.com/evondev/ucademy-app/tree/master/src/shared/store"
    click APIRoutes "https://github.com/evondev/ucademy-app/tree/master/src/app/api"
    click DBConnection "https://github.com/evondev/ucademy-app/blob/master/src/shared/lib/mongoose.ts"
    click FileUpload "https://github.com/evondev/ucademy-app/tree/master/src/app/api/uploadthing"
```
