# adams-x0/team3github architecture

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

- Interactive diagram: https://gitdiagram.com/adams-x0/team3github
- Repository: https://github.com/adams-x0/team3github

## Overview

##### Project type and purpose
- This is a full-stack web application built with a React (Vite) frontend and a Flask-based Python backend.
- The backend implements user types (Admin, Parent, Student, Therapist), appointment management, and authentication endpoints.
- The frontend uses Redux slices for state management and provides views & dashboards for each user role.

##### File-structure analysis
– Top-level directories:
- backend/ – Flask app and domain models
- frontend/ – React application scaffolded with Vite
– backend/
- app.py – Flask app entrypoint, routes, configurations
- *.py (Admin, Therapist, Student, Parent, Appointment, User) – domain classes or ORM models
- add_admin.py – a utility script for seeding an Admin user
– frontend/
- index.html, index.jsx – application bootstrap
- components/ – all the React view components (LoginView, RegisterView, dashboards, navbars)
- Slices/ – Redux slices for fetching and setting data, plus authSlice
- store.js – Redux store configuration
- css/ – styling assets
- vite.config.js – build configuration

##### Diagramming guidance
1. Client/Web Browser – loads the React app
2. React Frontend (SPA)
– Redux Store (GetSlice, SetSlice, authSlice)
– UI Components (Login, Register, Dashboards, Navbars)
3. Network/API Layer – HTTP/REST calls over Axios or fetch
4. Flask Backend
– app.py (routing & controllers)
– Domain Models & Business Logic (User, Admin, Parent, Student, Therapist, Appointment)
5. Persistence Layer – database (e.g., PostgreSQL, MySQL or SQLite – whichever is configured in Flask)
6. External Services (e.g., email service for password reset, analytics) if any
b. Relationships & data flows:
– Browser → React UI: user actions (click, form submit)
– React UI → Redux Store: dispatch actions, update state
– Redux Store → React UI: state changes trigger re-render
– React UI → Flask API: HTTP POST/GET/PUT/DELETE
– Flask API → Domain Models: controllers invoke model methods
– Domain Models → Database: ORM queries / raw SQL
– Database → Domain Models → Flask API → React UI: responses returned
c. Important architectural patterns:
– SPA (Single-Page Application) on the frontend
– Redux for unidirectional data flow
– RESTful API in Flask (Controller → Model → Persistence)
– Layered architecture: presentation (React), business (Flask models/controllers), data (DB)
d. Technologies & frameworks:
– React 18+ with Vite
– Redux Toolkit (slices)
– Flask (Werkzeug, Jinja if needed)
– Python 3.13, virtualenv for isolated dependencies
– Styling: CSS modules in frontend/src/css
– Build tools: npm/yarn, Vite, pip requirements.txt

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend (Browser & React)" 
        direction TB
        Browser["Client/Web Browser"]:::external
        ReactApp["React Frontend (SPA)"]:::frontend
        ReduxStore["Redux Store"]:::frontend

        subgraph "Redux Slices"
            direction TB
            GetSlice["GetSlice"]:::frontend
            SetSlice["SetSlice"]:::frontend
            AuthSlice["authSlice"]:::frontend
        end

        subgraph "UI Components"
            direction TB
            LoginView["LoginView"]:::frontend
            RegisterView["RegisterView"]:::frontend
            ForgotPasswordView["ForgotPasswordView"]:::frontend
            GuardianRegisterChildView["GuardianRegisterChildView"]:::frontend
            AdminDashboard["AdminDashboard"]:::frontend
            ParentDashboard["ParentDashboard"]:::frontend
            StudentDashboard["StudentDashboard"]:::frontend
            TherapistDashboard["TherapistDashboard"]:::frontend
            AdminNavbar["adminNavbar"]:::frontend
            ParentNavbar["parentNavbar"]:::frontend
            StudentNavbar["studentNavbar"]:::frontend
            TherapistNavbar["therapistNavbar"]:::frontend
        end

        subgraph "Styling & Config"
            direction TB
            AppCSS["App.css"]:::frontend
            IndexCSS["index.css"]:::frontend
            LoginCSS["login.css"]:::frontend
            RegisterCSS["register.css"]:::frontend
            ForgotPasswordCSS["Forgot-Password.css"]:::frontend
            ViteConfig["vite.config.js"]:::frontend
            PackageJSON_FE["package.json"]:::frontend
            ESLintConfig["eslint.config.js"]:::frontend
        end
    end

    %% Networking/API Layer
    API["HTTP/REST API"]:::api

    %% Backend Layer
    subgraph "Backend (Flask)"
        direction TB
        AppPy["app.py (Routing & Controllers)"]:::backend
        AddAdmin["add_admin.py"]:::backend

        subgraph "Domain Models & Business Logic"
            direction TB
            UserModel["User"]:::backend
            AdminModel["Admin"]:::backend
            ParentModel["Parent"]:::backend
            StudentModel["Student"]:::backend
            TherapistModel["Therapist"]:::backend
            AppointmentModel["Appointment"]:::backend
        end
    end

    %% Persistence
    DB[(Database)]:::db

    %% External Services
    EmailService["Email Service"]:::external

    %% Connections
    Browser -->|loads SPA| ReactApp
    ReactApp -->|dispatch actions| ReduxStore
    ReduxStore -->|state updates| ReactApp
    ReactApp -->|calls API| API
    API -->|forwards requests| AppPy
    AppPy -->|invokes methods| UserModel
    AppPy -->|invokes methods| AdminModel
    AppPy -->|invokes methods| ParentModel
    AppPy -->|invokes methods| StudentModel
    AppPy -->|invokes methods| TherapistModel
    AppPy -->|invokes methods| AppointmentModel
    UserModel -->|queries| DB
    AdminModel -->|queries| DB
    ParentModel -->|queries| DB
    StudentModel -->|queries| DB
    TherapistModel -->|queries| DB
    AppointmentModel -->|queries| DB
    AppPy -->|uses for emails| EmailService

    %% Click Events - Frontend
    click Browser "https://github.com/adams-x0/team3github/blob/main/frontend/index.html"
    click ReactApp "https://github.com/adams-x0/team3github/blob/main/frontend/src/App.jsx"
    click ReduxStore "https://github.com/adams-x0/team3github/blob/main/frontend/src/store.js"
    click GetSlice "https://github.com/adams-x0/team3github/blob/main/frontend/src/Slices/GetSlice.jsx"
    click SetSlice "https://github.com/adams-x0/team3github/blob/main/frontend/src/Slices/SetSlice.jsx"
    click AuthSlice "https://github.com/adams-x0/team3github/blob/main/frontend/src/Slices/authSlice.jsx"
    click LoginView "https://github.com/adams-x0/team3github/blob/main/frontend/src/components/LoginView.jsx"
    click RegisterView "https://github.com/adams-x0/team3github/blob/main/frontend/src/components/RegisterView.jsx"
    click ForgotPasswordView "https://github.com/adams-x0/team3github/blob/main/frontend/src/components/ForgotPasswordView.jsx"
    click GuardianRegisterChildView "https://github.com/adams-x0/team3github/blob/main/frontend/src/components/GuardianRegisterChildView.jsx"
    click AdminDashboard "https://github.com/adams-x0/team3github/blob/main/frontend/src/components/AdminDashboard.jsx"
    click ParentDashboard "https://github.com/adams-x0/team3github/blob/main/frontend/src/components/ParentDashboard.jsx"
    click StudentDashboard "https://github.com/adams-x0/team3github/blob/main/frontend/src/components/StudentDashboard.jsx"
    click TherapistDashboard "https://github.com/adams-x0/team3github/blob/main/frontend/src/components/TherapistDashboard.jsx"
    click AdminNavbar "https://github.com/adams-x0/team3github/blob/main/frontend/src/components/adminNavbar.jsx"
    click ParentNavbar "https://github.com/adams-x0/team3github/blob/main/frontend/src/components/parentNavbar.jsx"
    click StudentNavbar "https://github.com/adams-x0/team3github/blob/main/frontend/src/components/studentNavbar.jsx"
    click TherapistNavbar "https://github.com/adams-x0/team3github/blob/main/frontend/src/components/therapistNavbar.jsx"
    click AppCSS "https://github.com/adams-x0/team3github/blob/main/frontend/src/css/App.css"
    click IndexCSS "https://github.com/adams-x0/team3github/blob/main/frontend/src/css/index.css"
    click LoginCSS "https://github.com/adams-x0/team3github/blob/main/frontend/src/css/login.css"
    click RegisterCSS "https://github.com/adams-x0/team3github/blob/main/frontend/src/css/register.css"
    click ForgotPasswordCSS "https://github.com/adams-x0/team3github/blob/main/frontend/src/css/Forgot-Password.css"
    click ViteConfig "https://github.com/adams-x0/team3github/blob/main/frontend/vite.config.js"
    click PackageJSON_FE "https://github.com/adams-x0/team3github/blob/main/frontend/package.json"
    click ESLintConfig "https://github.com/adams-x0/team3github/blob/main/frontend/eslint.config.js"

    %% Click Events - Backend & Docs
    click AppPy "https://github.com/adams-x0/team3github/blob/main/backend/app.py"
    click AddAdmin "https://github.com/adams-x0/team3github/blob/main/backend/add_admin.py"
    click UserModel "https://github.com/adams-x0/team3github/blob/main/backend/User.py"
    click AdminModel "https://github.com/adams-x0/team3github/blob/main/backend/Admin.py"
    click ParentModel "https://github.com/adams-x0/team3github/blob/main/backend/Parent.py"
    click StudentModel "https://github.com/adams-x0/team3github/blob/main/backend/Student.py"
    click TherapistModel "https://github.com/adams-x0/team3github/blob/main/backend/Therapist.py"
    click AppointmentModel "https://github.com/adams-x0/team3github/blob/main/backend/Appointment.py"
    click README["README.md"] "README.md"
    click RequirementsPY["requirements.txt"] "requirements.txt"
    click RequirementsNPM["npm_requirements.txt"] "npm_requirements.txt"
    click PackageJSON_ROOT["package.json"] "package.json"
    click PackageLock["package-lock.json"] "package-lock.json"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#3399ff,stroke-width:1px
    classDef backend fill:#d4edda,stroke:#28a745,stroke-width:1px
    classDef db fill:#ffeeba,stroke:#ffc107,stroke-width:1px
    classDef external fill:#f8d7da,stroke:#dc3545,stroke-width:1px
    classDef api fill:#e2e3e5,stroke:#6c757d,stroke-width:1px
```
