# macewancs/w25_b3_repo architecture

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

- Interactive diagram: https://gitdiagram.com/macewancs/w25_b3_repo
- Repository: https://github.com/macewancs/w25_b3_repo

## Overview

##### Main Components
- Backend Service:
– Implemented in Java 21 using Gradle with the Javalin API framework.
– Contains core functionalities (e.g., authentication, database access, email notifications, CDN management, reporting/statistics, and utility services) as indicated by the packages and service classes (e.g., AuthManager, DatabaseManager, EmailManager, CdnManager, Statistics).
– Also provides static web content for the administrative interface (files like admin/index.html, reports.html, etc.) which indicates a backend web admin panel.
- Frontend Application:
– A Node/NPM project using Typescript and Expo, which implies a mobile (and possibly web) client focused on tutoring.
– Organized with distinct directories for student and tutor experiences. For example, there are separate layouts, chat lists, settings, and user account management pages for each user type.
– Contains shared assets, components, hooks, and utilities to support the user interface and business logic.

##### Relationships and Interactions
- The Frontend communicates with the Backend’s API endpoints to handle operations such as authentication, messaging (chat features), user data retrieval, and setting preferences.
- The Backend, in turn, interacts with internal modules such as the DatabaseManager (to fetch or persist information) and external services (as needed by EmailManager and CdnManager).
- There is also a clear distinction between the administrative interface (served by static resources in the Backend) and the user interfaces within the Frontend (separated for tutors and students).

##### Architectural Patterns and Design Principles
- Separation of Concerns: The project is split into two major tiers—API backend and client frontend—with well-defined responsibilities.
- Modular Design: The backend leverages service components (e.g., AuthManager, Statistics) that encapsulate specific functionalities, and the frontend separates content by user role with dedicated routes and layout files.
- Use of Frameworks: Javalin for lightweight and efficient REST APIs, and Expo for streamlined cross-platform mobile development.
- Clear Routing and UI Components: The frontend is organized around Next.js-like routing (using folders such as (student) and (tutor) with layouts and nested routes) and has reusable UI components with test coverage.

##### Final Touches
- Every component has a clear label.

## Diagram (Mermaid)

```mermaid
flowchart TD 
    subgraph "Backend Service"
        BE_API["API Endpoints (Javalin)\n(Java 21 | Gradle)"]:::backend
        subgraph "Core Services"
            BE_Core["API & Core Services"]:::backend
            BE_Auth["AuthManager"]:::backend
            BE_DB["DatabaseManager"]:::backend
            BE_Email["EmailManager"]:::backend
            BE_Cdn["CdnManager"]:::backend
            BE_Stats["Statistics"]:::backend
        end
        BE_API --> BE_Auth
        BE_API --> BE_DB
        BE_API --> BE_Email
        BE_API --> BE_Cdn
        BE_API --> BE_Stats
        subgraph "Web Administration Module"
            BE_Admin["Admin Static Resources"]:::backend
            subgraph "Admin Files"
                admin_index["index.html"]:::backend
                admin_reports["reports.html"]:::backend
                admin_stats["stats.js"]:::backend
                admin_styles["styles.css"]:::backend
                admin_tutors["tutors.html"]:::backend
            end
            BE_Admin --> admin_index
            BE_Admin --> admin_reports
            BE_Admin --> admin_stats
            BE_Admin --> admin_styles
            BE_Admin --> admin_tutors
        end
    end

    subgraph "Frontend Application"
        subgraph "Student Interface"
            FE_Student_Layout["Layout & Home"]:::frontend
            FE_Student_Chat["Chat Features"]:::frontend
            FE_Student_User["User Management"]:::frontend
            FE_Student_Extra["Additional Pages"]:::frontend
        end
        subgraph "Tutor Interface"
            FE_Tutor_Layout["Layout & Home"]:::frontend
            FE_Tutor_Chat["Chat Features"]:::frontend
            FE_Tutor_Account["Tutor Account Management"]:::frontend
            FE_Tutor_Extra["Additional Pages"]:::frontend
        end
        FE_Shared["Shared Components & Utilities"]:::frontend
    end

    %% Data Flow: Frontend to Backend
    FE_Student_Layout -->|"RESTAPICalls"| BE_API
    FE_Student_Chat -->|"RESTAPICalls"| BE_API
    FE_Student_User -->|"RESTAPICalls"| BE_API
    FE_Tutor_Layout -->|"RESTAPICalls"| BE_API
    FE_Tutor_Chat -->|"RESTAPICalls"| BE_API
    FE_Tutor_Account -->|"RESTAPICalls"| BE_API
    FE_Shared -->|"Helper"| FE_Student_Layout
    FE_Shared -->|"Helper"| FE_Tutor_Layout

    %% Click Events for Backend Service Components
    click BE_Core "https://github.com/macewancs/w25_b3_repo/tree/master/backend/src/main/java/com/lyrne/backend/services"
    click BE_Auth "https://github.com/macewancs/w25_b3_repo/blob/master/backend/src/main/java/com/lyrne/backend/services/AuthManager.java"
    click BE_DB "https://github.com/macewancs/w25_b3_repo/blob/master/backend/src/main/java/com/lyrne/backend/services/DatabaseManager.java"
    click BE_Email "https://github.com/macewancs/w25_b3_repo/blob/master/backend/src/main/java/com/lyrne/backend/services/EmailManager.java"
    click BE_Cdn "https://github.com/macewancs/w25_b3_repo/blob/master/backend/src/main/java/com/lyrne/backend/services/CdnManager.java"
    click BE_Stats "https://github.com/macewancs/w25_b3_repo/blob/master/backend/src/main/java/com/lyrne/backend/services/Statistics.java"
    click BE_Admin "https://github.com/macewancs/w25_b3_repo/tree/master/backend/src/main/resources/web/admin"
    click admin_index "https://github.com/macewancs/w25_b3_repo/blob/master/backend/src/main/resources/web/admin/index.html"
    click admin_reports "https://github.com/macewancs/w25_b3_repo/blob/master/backend/src/main/resources/web/admin/reports.html"
    click admin_stats "https://github.com/macewancs/w25_b3_repo/blob/master/backend/src/main/resources/web/admin/stats.js"
    click admin_styles "https://github.com/macewancs/w25_b3_repo/blob/master/backend/src/main/resources/web/admin/styles.css"
    click admin_tutors "https://github.com/macewancs/w25_b3_repo/blob/master/backend/src/main/resources/web/admin/tutors.html"

    %% Click Events for Frontend Student Interface
    click FE_Student_Layout "https://github.com/macewancs/w25_b3_repo/blob/master/frontend/app/(student)/_layout.tsx"
    click FE_Student_Layout "https://github.com/macewancs/w25_b3_repo/blob/master/frontend/app/(student)/index.tsx"
    click FE_Student_Chat "https://github.com/macewancs/w25_b3_repo/blob/master/frontend/app/(student)/chat_list.tsx"
    click FE_Student_Chat "https://github.com/macewancs/w25_b3_repo/blob/master/frontend/app/(student)/chats/[chatId]/index.tsx"
    click FE_Student_User "https://github.com/macewancs/w25_b3_repo/blob/master/frontend/app/(student)/user/account.tsx"
    click FE_Student_User "https://github.com/macewancs/w25_b3_repo/blob/master/frontend/app/(student)/availability.tsx"
    click FE_Student_User "https://github.com/macewancs/w25_b3_repo/blob/master/frontend/app/(student)/courses.tsx"
    click FE_Student_User "https://github.com/macewancs/w25_b3_repo/blob/master/frontend/app/(student)/notifications.tsx"
    click FE_Student_User "https://github.com/macewancs/w25_b3_repo/blob/master/frontend/app/(student)/privacy.tsx"
    click FE_Student_User "https://github.com/macewancs/w25_b3_repo/blob/master/frontend/app/(student)/security.tsx"
    click FE_Student_Extra "https://github.com/macewancs/w25_b3_repo/blob/master/frontend/app/(student)/search.tsx"
    click FE_Student_Extra "https://github.com/macewancs/w25_b3_repo/blob/master/frontend/app/(student)/settings.tsx"

    %% Click Events for Frontend Tutor Interface
    click FE_Tutor_Layout "https://github.com/macewancs/w25_b3_repo/blob/master/frontend/app/(tutor)/_layout.tsx"
    click FE_Tutor_Layout "https://github.com/macewancs/w25_b3_repo/blob/master/frontend/app/(tutor)/index.tsx"
    click FE_Tutor_Chat "https://github.com/macewancs/w25_b3_repo/blob/master/frontend/app/(tutor)/chat_list.tsx"
    click FE_Tutor_Chat "https://github.com/macewancs/w25_b3_repo/blob/master/frontend/app/(tutor)/chats/[chatId]/index.tsx"
    click FE_Tutor_Account "https://github.com/macewancs/w25_b3_repo/blob/master/frontend/app/(tutor)/tutor/account.tsx"
    click FE_Tutor_Account "https://github.com/macewancs/w25_b3_repo/blob/master/frontend/app/(tutor)/availability.tsx"
    click FE_Tutor_Account "https://github.com/macewancs/w25_b3_repo/blob/master/frontend/app/(tutor)/certifications.tsx"
    click FE_Tutor_Account "https://github.com/macewancs/w25_b3_repo/blob/master/frontend/app/(tutor)/notifications.tsx"
    click FE_Tutor_Account "https://github.com/macewancs/w25_b3_repo/blob/master/frontend/app/(tutor)/privacy.tsx"
    click FE_Tutor_Account "https://github.com/macewancs/w25_b3_repo/blob/master/frontend/app/(tutor)/security.tsx"
    click FE_Tutor_Account "https://github.com/macewancs/w25_b3_repo/blob/master/frontend/app/(tutor)/sign-out.tsx"
    click FE_Tutor_Extra "https://github.com/macewancs/w25_b3_repo/blob/master/frontend/app/(tutor)/finances.tsx"
    click FE_Tutor_Extra "https://github.com/macewancs/w25_b3_repo/blob/master/frontend/app/(tutor)/students.tsx"
    click FE_Tutor_Extra "https://github.com/macewancs/w25_b3_repo/blob/master/frontend/app/(tutor)/settings.tsx"

    %% Click Events for Shared Frontend Components and Utilities
    click FE_Shared "https://github.com/macewancs/w25_b3_repo/tree/master/frontend/components"
    click FE_Shared "https://github.com/macewancs/w25_b3_repo/tree/master/frontend/components/ui"
    click FE_Shared "https://github.com/macewancs/w25_b3_repo/tree/master/frontend/constants"
    click FE_Shared "https://github.com/macewancs/w25_b3_repo/tree/master/frontend/hooks"
    click FE_Shared "https://github.com/macewancs/w25_b3_repo/tree/master/frontend/util"

    %% Styles
    classDef backend fill:#8FBC8F,stroke:#333,stroke-width:2px;
    classDef frontend fill:#87CEEB,stroke:#333,stroke-width:2px;
    classDef external fill:#F4A460,stroke:#333,stroke-width:2px;
```
