# c-gamble/living-room-tutors architecture

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

- Interactive diagram: https://gitdiagram.com/c-gamble/living-room-tutors
- Repository: https://github.com/c-gamble/living-room-tutors

## Overview

##### And Mark the Main Components
- Frontend Client – This is under the “src” folder. It includes a large set of React components (pages such as LandingPage, LoginPage, TuteesPage, TutorsPage, MatchPage, AdminNavBar, etc.), Redux store and reducers, and sagas for asynchronous actions. Group these components into relevant sections – for example, separate areas for end user pages (tutoring requests) and admin panels (manage tutors/tutees and match records).
- Backend Server – This is contained in the “server” directory. Mark the main entry point (server/server.js) and then detail the role of its subdirectories and files:
- Routes: Separate endpoints (mail, matches, template, test, tutees, tutors, user) handling various API requests.
- Modules: Middleware for authentication, session handling, encryption, and connection pooling.
- Strategies: Indicates the use of things like Passport strategies (user.strategy.js) for authentication.
- External Services – Include components such as:
- Email service (using Nodemailer and integration with GoogleAPIs to send confirmation and template emails),
- Possibly deployment platforms (Heroku as noted in Built With).

##### Relationships and Data Flow
- Server-Side Processing: Show how the routes call the underlying modules (authentication, encryption, session middleware) and then interact with the database via a connection pool.

##### Architectural Patterns and Principles
- Separation of Concerns: Display clear separation between the client (UI components) and business logic (API endpoints) of the server.
- Modular Design: Emphasize that the routes, middleware, modules, and strategies help keep concerns separated (e.g., authentication is isolated in its own middleware and strategy files).
- State Management: Note the use of Redux for managing application state on the frontend.

##### Relevant Technologies and Their Positions
- Frontend: React, Redux, JavaScript, CSS, and HTML (with components organized by feature).
- Backend: Node.js, Express, PostgreSQL, Passport (authentication strategies), Nodemailer.
- Deployment/Integration Tools: Heroku (deployment), Postman collections (for route testing), and environment-specific tools like npm and nodemon.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend (React/Redux)"
        F1["Frontend Application"]
        F2["React Components"]
        F3["Redux: Store, Reducers & Sagas"]
    end

    %% Backend Layer
    subgraph "Backend (Express/Node.js)"
        B1["Server Entry Point (server.js)"]
        B2["API Routes"]
        B3["Middleware & Utilities"]
        B4["Auth Strategy"]
        B5["Mail Router"]
    end

    %% Database
    subgraph "Database"
        DB["PostgreSQL Database"]
    end

    %% External Services
    subgraph "External Services"
        ES["Email & Google APIs Integration"]
    end

    %% Connections for Frontend
    F1 -->|"APICall"| B1
    F3 -->|"ManageState"| F2

    %% Connections for Backend
    B1 -->|"RouteRequest"| B2
    B2 -->|"InvokeMiddleware"| B3
    B2 -->|"Authenticate"| B4
    B2 -->|"EmailRequest"| B5
    B3 -->|"DBQuery"| DB
    B5 -->|"TriggerEmail"| ES

    %% Click Events
    click F1 "https://github.com/c-gamble/living-room-tutors/tree/master//src"
    click F2 "https://github.com/c-gamble/living-room-tutors/tree/master//src/components"
    click F3 "https://github.com/c-gamble/living-room-tutors/tree/master//src/redux"
    click B1 "https://github.com/c-gamble/living-room-tutors/blob/master//server/server.js"
    click B2 "https://github.com/c-gamble/living-room-tutors/tree/master//server/routes"
    click B3 "https://github.com/c-gamble/living-room-tutors/tree/master//server/modules"
    click B4 "https://github.com/c-gamble/living-room-tutors/blob/master//server/strategies/user.strategy.js"
    click B5 "https://github.com/c-gamble/living-room-tutors/blob/master//server/routes/mail.router.js"
    click DB "https://github.com/c-gamble/living-room-tutors/blob/master//database.sql"

    %% Styles
    classDef frontend fill:#E0F7FA,stroke:#006064,stroke-width:2px;
    classDef backend fill:#FFF3E0,stroke:#E65100,stroke-width:2px;
    classDef database fill:#E8F5E9,stroke:#1B5E20,stroke-width:2px;
    classDef external fill:#F3E5F5,stroke:#6A1B9A,stroke-width:2px;

    class F1,F2,F3 frontend;
    class B1,B2,B3,B4,B5 backend;
    class DB database;
    class ES external;
```
