# chrisbolosan/learning-wrapped architecture

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

- Interactive diagram: https://gitdiagram.com/chrisbolosan/learning-wrapped
- Repository: https://github.com/chrisbolosan/learning-wrapped

## Overview

##### Main Components
- Frontend/UI Layer: Represented by the Next.js “app” directory under /src/app. This includes primary pages (e.g., the landing page, dashboard, chatbot, courses, spaces) and reusable components found under /src/app/components and layouts under /src/app/layouts. Use clear labels for elements like “Dashboard”, “Chatbot”, “Courses”, etc.
- API Layer: Shown in /pages/api with endpoints such as chat (pages/api/chat.js) that serve as the backend interface for specific functionalities.
- Utility & Service Libraries: Include the “libs” directory which houses Firebase integrations (libs/firebase) and other utilities (libs/util) such as prompts and scripts for file sanitization and validations.
- External Integrations & Dependencies: Capture external services (Firebase, Next/font, Geist font resource, Vercel deployment) to show external system dependencies.

##### Out Relationships and Interactions
- Utility libraries with both UI and API components to show shared functionality like prompt management, file validations, or script execution.
- External dependencies that support development (e.g., Next/font optimization and Vercel’s deployment pipeline).

##### Architectural Patterns and Design Principles
- Separation of concerns: the distinct layers for frontend (presentation), API (business logic), and services (Firebase, utilities).
- Use of Next.js’s App Router, which supports a modular, file-system-based routing paradigm (as indicated by directories like /src/app and /pages).
- Licensing, build configurations, and coding style tools (e.g., Tailwind CSS configurations, ESLint) that support the development process.

##### Final Composition
- Every component is included, and their interactions (API calls, Firebase usage, utility script operations) are well depicted.
- Remember to include configuration components or development tooling if relevant (tailwind.config, next.config) as part of the overall environment even though they’re not core to runtime architecture.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend/UI Layer
    subgraph "Frontend/UI Layer"
        A1["Main App Directory"]
        A2["Dashboard Page"]
        A3["Chatbot Page"]
        A4["Courses Pages"]
        A5["Courses Data"]
        A6["Spaces Page"]
        A7["Spaces Data"]
        A8["Reusable Components"]
        A9["Main Layout"]
        A10["Course Layout"]
    end

    %% API Layer
    subgraph "API Layer"
        B1["Chat API Endpoint"]
    end

    %% Utility & Service Libraries
    subgraph "Utility & Service Libraries"
        C1["Firebase Integrations"]
        C2["Firebase Config"]
        C3["Firebase Setup"]
        C4["Prompts Utility"]
        C5["File Sanitization Script"]
        C6["Validations Script"]
    end

    %% External Integrations
    subgraph "External Integrations"
        E1["next.config.ts"]
        E2["tailwind.config.ts"]
        E3["package.json"]
    end

    %% Relationships and Data Flows
    A3 -->|"calls_API"| B1
    B1 -->|"uses_Firebase"| C1
    C1 -->|"loads"| C2
    C1 -->|"initializes"| C3
    A4 -->|"provides_data"| A5
    A6 -->|"provides_data"| A7
    A1 -->|"includes"| A8
    A1 -->|"sets_layout"| A9
    A9 -->|"supports"| A10
    A3 -->|"uses_prompts"| C4
    B1 -->|"executes"| C5
    B1 -->|"executes"| C6
    E1 -->|"configures_UI"| A1
    E1 -->|"deploys_API"| B1

    %% Styles
    classDef frontend fill:#add8e6,stroke:#000,stroke-width:2px;
    classDef api fill:#98FB98,stroke:#000,stroke-width:2px;
    classDef util fill:#ffdab9,stroke:#000,stroke-width:2px;
    classDef external fill:#dda0dd,stroke:#000,stroke-width:2px;

    class A1,A2,A3,A4,A5,A6,A7,A8,A9,A10 frontend;
    class B1 api;
    class C1,C2,C3,C4,C5,C6 util;
    class E1,E2,E3 external;

    %% Click Events for Frontend/UI Layer
    click A1 "https://github.com/chrisbolosan/learning-wrapped/tree/main/src/app"
    click A2 "https://github.com/chrisbolosan/learning-wrapped/blob/main/src/app/dashboard/page.tsx"
    click A3 "https://github.com/chrisbolosan/learning-wrapped/blob/main/src/app/chatbot/page.tsx"
    click A4 "https://github.com/chrisbolosan/learning-wrapped/tree/main/src/app/courses"
    click A5 "https://github.com/chrisbolosan/learning-wrapped/blob/main/src/app/courses/data.tsx"
    click A6 "https://github.com/chrisbolosan/learning-wrapped/blob/main/src/app/spaces/page.js"
    click A7 "https://github.com/chrisbolosan/learning-wrapped/blob/main/src/app/spaces/data.tsx"
    click A8 "https://github.com/chrisbolosan/learning-wrapped/tree/main/src/app/components"
    click A9 "https://github.com/chrisbolosan/learning-wrapped/blob/main/src/app/layout.tsx"
    click A10 "https://github.com/chrisbolosan/learning-wrapped/blob/main/src/app/layouts/Course.tsx"

    %% Click Event for API Layer
    click B1 "https://github.com/chrisbolosan/learning-wrapped/blob/main/pages/api/chat.js"

    %% Click Events for Utility & Service Libraries
    click C1 "https://github.com/chrisbolosan/learning-wrapped/tree/main/libs/firebase"
    click C2 "https://github.com/chrisbolosan/learning-wrapped/blob/main/libs/firebase/config.js"
    click C3 "https://github.com/chrisbolosan/learning-wrapped/blob/main/libs/firebase/firebaseSetup.tsx"
    click C4 "https://github.com/chrisbolosan/learning-wrapped/blob/main/libs/util/prompts/Prompts.tsx"
    click C5 "https://github.com/chrisbolosan/learning-wrapped/blob/main/libs/util/scripts/SanitizeFile.tsx"
    click C6 "https://github.com/chrisbolosan/learning-wrapped/blob/main/libs/util/scripts/Validations.tsx"

    %% Click Events for External Integrations
    click E1 "https://github.com/chrisbolosan/learning-wrapped/blob/main/next.config.ts"
    click E2 "https://github.com/chrisbolosan/learning-wrapped/blob/main/tailwind.config.ts"
    click E3 "https://github.com/chrisbolosan/learning-wrapped/blob/main/package.json"
```
