# andystmc/track-your-attendance architecture

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

- Interactive diagram: https://gitdiagram.com/andystmc/track-your-attendance
- Repository: https://github.com/andystmc/track-your-attendance

## Overview

##### Main Components

A. Frontend Layer:
- Client-Side Components (/app/ui/*)
- Main App Component
- Admin Interface
- User Interface (Schedule, Sessions, Identity components)
- Common Components (AppBar, SocialBar)

B. Application Layer:
- Next.js Server Components
- API Routes (/app/api/*)
- Redux State Management
- Admin Store
- User Store

C. Backend Services:
- Authentication System
- Key Verification
- Password Verification
- Admin Services
- Holiday Management
- Properties Management
- Special Working Days
- Data Scraping Service
- Database Layer (indicated by db.ts and models.ts)

**[Client Layer]**
- ↕
**[Application Layer]**
- ↕
**[Data Layer]**

##### Component Relationships

- User interactions → Frontend Components
- Frontend → API Routes
- API Routes → Backend Services
- Backend Services → Database
- Redux Store ↔ Frontend Components

##### Detailed Component Breakdown

Frontend:
**[App Shell]**
- AppBar
- Main Content Area
- Schedule View
- Sessions View
- Collection Interface
- Stats Display
- Admin Panel
- Holiday Management
- Properties Control
- Special Working Days

Backend:
**[API Layer]**
- Admin Routes
- Data Management
- Holiday Control
- Properties API
- Authentication
- Key Verification
- Password Verification
- Data Services
- Scraping Service
- Verification Service

##### Additional Elements

- Google Analytics integration
- Middleware placement and flow
- Utils functions distribution
- Database operations flow
- External service connections

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        App["Main App Component"]:::frontend
        AppBar["AppBar"]:::frontend
        SocialBar["SocialBar"]:::frontend
        GA["Google Analytics"]:::frontend
        
        subgraph UserInterface
            Schedule["Schedule View"]:::frontend
            Sessions["Sessions View"]:::frontend
            Identity["Identity Component"]:::frontend
        end
        
        subgraph AdminUI
            AdminControl["Admin Control Panel"]:::frontend
        end
    end
    
    subgraph ApplicationLayer
        subgraph StateManagement
            Store["Redux Store"]:::state
            AdminSlice["Admin Slice"]:::state
            UserSlice["User Slice"]:::state
        end
        
        subgraph APIRoutes
            AdminAPI["Admin API Routes"]:::api
            AuthAPI["Auth API Routes"]:::api
            DataAPI["Data API Routes"]:::api
        end
    end
    
    subgraph BackendServices
        subgraph AuthSystem
            KeyVerify["Key Verification"]:::auth
            PassVerify["Password Verification"]:::auth
            AdminMiddleware["Admin Middleware"]:::auth
        end
        
        subgraph AdminServices
            Holidays["Holiday Management"]:::admin
            Properties["Properties Management"]:::admin
            SWDays["Special Working Days"]:::admin
        end
        
        subgraph DataServices
            Scraping["Scraping Service"]:::data
            Verification["Verification Service"]:::data
        end
    end
    
    subgraph DataLayer
        DB["Database Config"]:::database
        Models["Data Models"]:::database
        DBOps["Database Operations"]:::database
    end
    
    subgraph Utils
        BackendUtils["Backend Utils"]:::util
        FrontendUtils["Frontend Utils"]:::util
        HybridUtils["Hybrid Utils"]:::util
    end
    
    %% Relationships
    App --> AppBar
    App --> SocialBar
    App --> GA
    App --> UserInterface
    App --> AdminUI
    
    Store --> AdminSlice
    Store --> UserSlice
    
    AdminUI --> AdminAPI
    UserInterface --> DataAPI
    
    AdminAPI --> AuthSystem
    AdminAPI --> AdminServices
    
    AuthSystem --> DB
    AdminServices --> DB
    DataServices --> DB
    
    %% Click Events
    click App "https://github.com/AndysTMC/Track-Your-Attendance/blob/main/app/ui/App.tsx"
    click AdminControl "https://github.com/AndysTMC/Track-Your-Attendance/blob/main/app/admin/ui/AdminControl.tsx"
    click Schedule "https://github.com/AndysTMC/Track-Your-Attendance/blob/main/app/ui/Schedule.tsx"
    click Sessions "https://github.com/AndysTMC/Track-Your-Attendance/blob/main/app/ui/Sessions.tsx"
    click Identity "https://github.com/AndysTMC/Track-Your-Attendance/blob/main/app/ui/Identity.tsx"
    click AppBar "https://github.com/AndysTMC/Track-Your-Attendance/blob/main/app/ui/AppBar.tsx"
    click SocialBar "https://github.com/AndysTMC/Track-Your-Attendance/blob/main/app/ui/SocialBar.tsx"
    click Store "https://github.com/AndysTMC/Track-Your-Attendance/blob/main/app/redux/store.ts"
    click AdminSlice "https://github.com/AndysTMC/Track-Your-Attendance/blob/main/app/redux/adminSlice.ts"
    click UserSlice "https://github.com/AndysTMC/Track-Your-Attendance/blob/main/app/redux/userSlice.ts"
    click KeyVerify "https://github.com/AndysTMC/Track-Your-Attendance/blob/main/app/api/admin/key-verify/route.ts"
    click PassVerify "https://github.com/AndysTMC/Track-Your-Attendance/blob/main/app/api/admin/pass-verify/route.ts"
    click AdminMiddleware "https://github.com/AndysTMC/Track-Your-Attendance/blob/main/app/api/admin/middleware.ts"
    click Holidays "https://github.com/AndysTMC/Track-Your-Attendance/blob/main/app/api/admin/holidays/route.ts"
    click Properties "https://github.com/AndysTMC/Track-Your-Attendance/blob/main/app/api/admin/properties/route.ts"
    click SWDays "https://github.com/AndysTMC/Track-Your-Attendance/blob/main/app/api/admin/swdays/route.ts"
    click Scraping "https://github.com/AndysTMC/Track-Your-Attendance/blob/main/app/api/scrape/route.ts"
    click Verification "https://github.com/AndysTMC/Track-Your-Attendance/blob/main/app/api/verify/route.ts"
    click DB "https://github.com/AndysTMC/Track-Your-Attendance/blob/main/app/configs/db.ts"
    click Models "https://github.com/AndysTMC/Track-Your-Attendance/blob/main/app/configs/models.ts"
    click DBOps "https://github.com/AndysTMC/Track-Your-Attendance/blob/main/app/utils/db_ops.ts"
    click GA "https://github.com/AndysTMC/Track-Your-Attendance/blob/main/app/GoogleAnalytics.tsx"
    click BackendUtils "https://github.com/AndysTMC/Track-Your-Attendance/blob/main/app/utils/backend.ts"
    click FrontendUtils "https://github.com/AndysTMC/Track-Your-Attendance/blob/main/app/utils/frontend.ts"
    click HybridUtils "https://github.com/AndysTMC/Track-Your-Attendance/blob/main/app/utils/hybrid.ts"
    
    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef api fill:#2ecc71,stroke:#27ae60,color:white
    classDef auth fill:#f1c40f,stroke:#f39c12,color:black
    classDef admin fill:#9b59b6,stroke:#8e44ad,color:white
    classDef database fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef data fill:#e74c3c,stroke:#c0392b,color:white
    classDef state fill:#1abc9c,stroke:#16a085,color:white
    classDef util fill:#34495e,stroke:#2c3e50,color:white
```
