# alandeabhijeet/course architecture

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

- Interactive diagram: https://gitdiagram.com/alandeabhijeet/course
- Repository: https://github.com/alandeabhijeet/course

## Overview

##### Main Components
- Frontend Client: Built using React.js and Tailwind CSS.
- Auth Microservice (backend/auth): Handles user registration, login, token management (JWT), and user-related operations such as verifying course ownership or purchase.
- Course Microservice (backend/course): Manages course creation, listing, editing, deletion, and retrieval of courses based on ownership or purchase.
- Database: A central MongoDB Atlas instance that both backend services connect to via Mongoose.

##### Separate the Backend Microservices
- Since the instruction specifies “backend also separate please”, explicitly represent the Auth and Course microservices as distinct components.
- That each microservice has its own internal structure including its respective routes, controllers, models, and configuration files.

##### Relationships and Interactions
- That both Auth and Course microservices communicate with the central MongoDB Atlas database.

##### Architectural Patterns and Design Principles
- RESTful API Communication: Clearly mark the use of REST endpoints.
- Separation of Concerns: Emphasize that authentication and course management functionalities are handled by dedicated services.
- Common middleware practices in the Auth service (e.g., JWT-based token validation) as part of its architectural design.

##### Technologies and Dependencies
- For the Auth Microservice: Note the use of Node.js, Express.js, JWT for authentication, and Mongoose for MongoDB interactions.
- For the Course Microservice: Highlight the use of Node.js, Express.js, and Mongoose.
- For the Frontend: Specify React.js and Tailwind CSS.
- Database: Represent MongoDB Atlas as the persistent data store for both services.

## Diagram (Mermaid)

```mermaid
flowchart TD
    FE["Frontend (React + Tailwind)"]:::frontend

    subgraph "Auth Microservice"
        A_App["app.js"]:::backend
        A_Config["config/"]:::backend
        A_Routes["routes/authRoutes.js (/api/auth)"]:::backend
        A_Controllers["controllers/authControllers.js"]:::backend
        A_Models["models/User.js"]:::backend
        A_Config --- A_App
        A_App --> A_Routes
        A_Routes --> A_Controllers
        A_Controllers --> A_Models
    end

    subgraph "Course Microservice"
        C_App["app.js"]:::backend
        C_Config["config/"]:::backend
        C_Routes["routes/courseRoutes.js (/api/courses)"]:::backend
        C_Controllers["controllers/courseControllers.js"]:::backend
        C_Models["models/course.js"]:::backend
        C_Config --- C_App
        C_App --> C_Routes
        C_Routes --> C_Controllers
        C_Controllers --> C_Models
    end

    DB[(MongoDB Atlas)]:::database

    FE -->|"callsAPI"| A_Routes
    FE -->|"callsAPI"| C_Routes
    A_App -->|"connectsTo"| DB
    C_App -->|"connectsTo"| DB

    click FE "https://github.com/alandeabhijeet/course/tree/main/frontend/"
    click A_App "https://github.com/alandeabhijeet/course/blob/main/backend/auth/app.js"
    click A_Config "https://github.com/alandeabhijeet/course/tree/main/backend/auth/config/"
    click A_Routes "https://github.com/alandeabhijeet/course/blob/main/backend/auth/routes/authRoutes.js"
    click A_Controllers "https://github.com/alandeabhijeet/course/blob/main/backend/auth/controllers/authControllers.js"
    click A_Models "https://github.com/alandeabhijeet/course/blob/main/backend/auth/models/User.js"
    click C_App "https://github.com/alandeabhijeet/course/blob/main/backend/course/app.js"
    click C_Config "https://github.com/alandeabhijeet/course/tree/main/backend/course/config/"
    click C_Routes "https://github.com/alandeabhijeet/course/blob/main/backend/course/routes/courseRoutes.js"
    click C_Controllers "https://github.com/alandeabhijeet/course/blob/main/backend/course/controllers/courseControllers.js"
    click C_Models "https://github.com/alandeabhijeet/course/blob/main/backend/course/models/course.js"

    classDef frontend fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef backend fill:#ffeeba,stroke:#856404,stroke-width:2px;
    classDef database fill:#d4edda,stroke:#155724,stroke-width:2px,stroke-dasharray: 5 5;
```
