# purelyricky/avashift_com architecture

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

- Interactive diagram: https://gitdiagram.com/purelyricky/avashift_com
- Repository: https://github.com/purelyricky/avashift_com

## Overview

##### Main Components

a) Frontend Layer:
- Application into 5 main user interfaces based on roles:
- Admin Portal (/app/(admin))
- Client Portal (/app/(client))
- Gatemen Portal (/app/(gatemen))
- Leaders Portal (/app/(leaders))
- Students Portal (/app/(students))
- Authentication Layer (/app/(auth))
- Shared Components (/components)
- UI Component Library (/components/ui)

b) Backend Layer:
- API Routes (/app/api)
- Action Handlers (/lib/actions)
- Email Service (/app/api/emails)
- Database Interface (indicated by databases.md)

c) External Services:
- Appwrite Integration (shown by /lib/actions/appwrite.ts)
- Email Service Provider
- Authentication Service

**┌─────────────────────────────────────────────────────┐**
- Client Layer                       │
- ┌─────────┐ ┌────────┐ ┌───────┐ ┌───────┐ ┌────┐ │
- Admin  │ │ Client │ │Gatemen│ │Leaders│ │User│ │
- ┘ └────────┘ └───────┘ └───────┘ └────┘ │
- ┤
- Application Layer                  │
- ┌─────────────┐ ┌──────────────┐ ┌──────────────┐ │
- Next.js Pages│ │API Routes    │ │Action Handlers│ │
- ┘ └──────────────┘ └──────────────┘ │
- ┤
- Service Layer                      │
- ┌─────────────┐ ┌──────────────┐ ┌──────────────┐ │
- Email Service│ │Auth Service  │ │Appwrite      │ │
- ┘ └──────────────┘ └──────────────┘ │
- ┘

##### Key Relationships to Highlight

- Authentication flow between auth pages and auth service
- Data flow between actions and API routes
- Demonstrate email notification system's integration
- Relationship between different user portals and shared components
- Database interactions through Appwrite

##### Important Details

- Role-based access control flow
- Email notification system architecture
- Project management workflow
- Attendance tracking system
- Reporting system architecture

##### Specific Features to Emphasize

- Dashboard systems for each user type
- Project creation and management flow
- Attendance tracking mechanism
- Shift management system
- Reporting and analytics features

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client["Client Layer"]
        direction TB
        Admin["Admin Portal"]
        Client["Client Portal"]
        Gatemen["Gatemen Portal"]
        Leaders["Leaders Portal"]
        Students["Students Portal"]
    end

    subgraph Auth["Authentication Layer"]
        direction TB
        SignIn["Sign In"]:::auth
        SignUp["Sign Up"]:::auth
    end

    subgraph App["Application Layer"]
        direction TB
        subgraph AdminPortal["Admin Features"]
            direction TB
            ADash["Dashboard"]:::admin
            AProj["Projects"]:::admin
            AReport["Reports"]:::admin
            AAttend["Attendance"]:::admin
        end

        subgraph ClientPortal["Client Features"]
            direction TB
            CDash["Dashboard"]:::client
            CProj["Projects"]:::client
            CReport["Reports"]:::client
            CShift["Shifts"]:::client
        end

        subgraph GatemenPortal["Gatemen Features"]
            direction TB
            GDash["Dashboard"]:::gatemen
            GReport["Reports"]:::gatemen
        end

        subgraph LeadersPortal["Leaders Features"]
            direction TB
            LDash["Dashboard"]:::leaders
            LReport["Reports"]:::leaders
        end

        subgraph StudentsPortal["Students Features"]
            direction TB
            SDash["Dashboard"]:::students
            SReport["Reports"]:::students
        end
    end

    subgraph Services["Service Layer"]
        direction TB
        EmailService["Email Service"]:::service
        AppWrite["Appwrite Integration"]:::service
        Actions["Action Handlers"]:::service
    end

    subgraph Components["Shared Components"]
        direction TB
        UI["UI Library"]:::component
        Charts["Charts"]:::component
        Forms["Forms"]:::component
        Nav["Navigation"]:::component
    end

    Admin --> AdminPortal
    Client --> ClientPortal
    Gatemen --> GatemenPortal
    Leaders --> LeadersPortal
    Students --> StudentsPortal

    AdminPortal & ClientPortal & GatemenPortal & LeadersPortal & StudentsPortal --> Actions
    Actions --> AppWrite
    Actions --> EmailService

    Client & Admin & Gatemen & Leaders & Students --> Auth
    Auth --> AppWrite

    AdminPortal & ClientPortal & GatemenPortal & LeadersPortal & StudentsPortal --> Components

    %% Click Events
    click Admin "https://github.com/purelyricky/avashift_com/tree/main//app/(admin)"
    click ADash "https://github.com/purelyricky/avashift_com/tree/main//app/(admin)/a-dash"
    click AProj "https://github.com/purelyricky/avashift_com/tree/main//app/(admin)/a-projects"
    click AReport "https://github.com/purelyricky/avashift_com/tree/main//app/(admin)/a-reports"
    click AAttend "https://github.com/purelyricky/avashift_com/tree/main//app/(admin)/a-attendance"
    
    click Client "https://github.com/purelyricky/avashift_com/tree/main//app/(client)"
    click CDash "https://github.com/purelyricky/avashift_com/tree/main//app/(client)/c-dash"
    click CProj "https://github.com/purelyricky/avashift_com/tree/main//app/(client)/c-projects"
    click CReport "https://github.com/purelyricky/avashift_com/tree/main//app/(client)/c-reports"
    click CShift "https://github.com/purelyricky/avashift_com/tree/main//app/(client)/c-shifts"
    
    click Gatemen "https://github.com/purelyricky/avashift_com/tree/main//app/(gatemen)"
    click GDash "https://github.com/purelyricky/avashift_com/tree/main//app/(gatemen)/g-dash"
    click GReport "https://github.com/purelyricky/avashift_com/tree/main//app/(gatemen)/g-report"
    
    click Leaders "https://github.com/purelyricky/avashift_com/tree/main//app/(leaders)"
    click LDash "https://github.com/purelyricky/avashift_com/tree/main//app/(leaders)/l-dash"
    click LReport "https://github.com/purelyricky/avashift_com/tree/main//app/(leaders)/l-report"
    
    click Students "https://github.com/purelyricky/avashift_com/tree/main//app/(students)"
    click SDash "https://github.com/purelyricky/avashift_com/tree/main//app/(students)/s-dash"
    click SReport "https://github.com/purelyricky/avashift_com/tree/main//app/(students)/s-report"
    
    click SignIn "https://github.com/purelyricky/avashift_com/tree/main//app/(auth)/sign-in"
    click SignUp "https://github.com/purelyricky/avashift_com/tree/main//app/(auth)/sign-up"
    
    click EmailService "https://github.com/purelyricky/avashift_com/tree/main//app/api/emails"
    click AppWrite "https://github.com/purelyricky/avashift_com/blob/main//lib/actions/appwrite.ts"
    click Actions "https://github.com/purelyricky/avashift_com/tree/main//lib/actions"
    
    click UI "https://github.com/purelyricky/avashift_com/tree/main//components/ui"
    click Charts "https://github.com/purelyricky/avashift_com/blob/main//components/DoughnutChart.tsx"
    click Forms "https://github.com/purelyricky/avashift_com/blob/main//components/CreateProjectWrapper.tsx"
    click Nav "https://github.com/purelyricky/avashift_com/blob/main//components/SidebarAdmin.tsx"

    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef admin fill:#e6f3ff,stroke:#333
    classDef client fill:#e6ffe6,stroke:#333
    classDef gatemen fill:#fff2e6,stroke:#333
    classDef leaders fill:#f3e6ff,stroke:#333
    classDef students fill:#ffe6e6,stroke:#333
    classDef auth fill:#d4d4ff,stroke:#333
    classDef service fill:#ffd4d4,stroke:#333
    classDef component fill:#d4ffd4,stroke:#333
```
