# mdiqbalhossan/safevax architecture

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

- Interactive diagram: https://gitdiagram.com/mdiqbalhossan/safevax
- Repository: https://github.com/mdiqbalhossan/safevax

## Overview

##### Main System Components

a) Presentation Layer
- Web Interface (Blade Views)
- Public Assets (CSS/JS)

b) Application Layer
- Controllers (Member, Search)
- Events & Listeners
- Mail System
- Console Commands

c) Domain Layer
- Models (Member, Schedule, VaccineCenter, User)

d) Infrastructure Layer
- Database
- Email Service
- File Storage
- Cache System

##### Component Relationships

a) User Flow:
**Web Browser -> Routes -> Controllers -> Models -> Database**

b) Notification Flow:
**Console Commands -> Events -> Listeners -> Mail System -> External Email Service**

##### Specific Implementation Details

- Blue: User-facing components (views, public assets)
- Green: Business logic (controllers, events, listeners)
- Yellow: Data layer (models, database)
- Purple: Infrastructure services (mail, cache, storage)

##### Key Components

a) Frontend Components:
- Registration View (resources/views/register.blade.php)
- Search View (resources/views/search.blade.php)
- Success View (resources/views/success.blade.php)
- Layout Components (resources/views/layout)

b) Backend Components:
- MemberController
- SearchController
- ScheduleVaccine Event
- ScheduleVaccination Listener
- VaccinationReminder Mail

c) Data Models:
- Member
- Schedule
- VaccineCenter
- User

d) Infrastructure Services:
- Database (SQLite/MySQL)
- Email Service
- Cache System
- Storage System

**Cron Job -> SendVaccinationReminders Command -> Mail System**

##### Architectural Patterns to Highlight

- MVC Pattern (Controllers, Models, Views)
- Event-Driven Architecture (Events & Listeners)
- Repository Pattern (Data Access)
- Service Layer (Mail, Notifications)

##### Additional Notes

Annotations for:
- Cron job configuration
- Email service configuration
- Database migration flow
- Testing coverage

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef controller fill:#2ecc71,stroke:#27ae60,color:white
    classDef model fill:#f1c40f,stroke:#f39c12,color:black
    classDef infrastructure fill:#9b59b6,stroke:#8e44ad,color:white
    classDef event fill:#e74c3c,stroke:#c0392b,color:white
    classDef config fill:#95a5a6,stroke:#7f8c8d,color:white

    %% User Entry Point
    Browser["Web Browser"]

    %% Frontend Layer
    subgraph Frontend
        RegView["Registration View"]
        SearchView["Search View"]
        SuccessView["Success View"]
        Layout["Layout Template"]
        Assets["Public Assets"]
    end

    %% Controller Layer
    subgraph Controllers
        MemberCtrl["Member Controller"]
        SearchCtrl["Search Controller"]
    end

    %% Event System
    subgraph EventSystem
        SchedEvent["Schedule Vaccine Event"]
        SchedListener["Schedule Vaccination Listener"]
    end

    %% Mail System
    subgraph MailSystem
        VaccReminder["Vaccination Reminder"]
        EmailTemplate["Email Template"]
        MailService["Mail Service"]
    end

    %% Models
    subgraph Models
        Member["Member Model"]
        Schedule["Schedule Model"]
        VaccineCenter["Vaccine Center Model"]
        User["User Model"]
    end

    %% Infrastructure
    subgraph Infrastructure
        DB[(Database)]
        Cache[(Cache)]
        Storage[(File Storage)]
    end

    %% Configuration
    subgraph Config
        DBConfig["Database Config"]
        MailConfig["Mail Config"]
        CacheConfig["Cache Config"]
        StorageConfig["Storage Config"]
    end

    %% Automated Processes
    subgraph AutomatedTasks
        CronJob["Cron Job"]
        ReminderCmd["Send Vaccination Reminders"]
    end

    %% Testing
    subgraph Tests
        RegTest["Registration Test"]
        SearchTest["Search Test"]
    end

    %% Relationships
    Browser --> RegView & SearchView & SuccessView
    RegView & SearchView & SuccessView --> Layout
    RegView --> MemberCtrl
    SearchView --> SearchCtrl
    MemberCtrl --> SchedEvent
    SchedEvent --> SchedListener
    SchedListener --> VaccReminder
    VaccReminder --> EmailTemplate
    EmailTemplate --> MailService
    MemberCtrl & SearchCtrl --> Member & Schedule & VaccineCenter
    Member & Schedule & VaccineCenter --> DB
    CronJob --> ReminderCmd
    ReminderCmd --> VaccReminder

    %% Click Events
    click RegView "https://github.com/mdiqbalhossan/SafeVax/blob/main/resources/views/register.blade.php"
    click SearchView "https://github.com/mdiqbalhossan/SafeVax/blob/main/resources/views/search.blade.php"
    click SuccessView "https://github.com/mdiqbalhossan/SafeVax/blob/main/resources/views/success.blade.php"
    click Layout "https://github.com/mdiqbalhossan/SafeVax/blob/main/resources/views/layout/app.blade.php"
    click MemberCtrl "https://github.com/mdiqbalhossan/SafeVax/blob/main/app/Http/Controllers/MemberController.php"
    click SearchCtrl "https://github.com/mdiqbalhossan/SafeVax/blob/main/app/Http/Controllers/SearchController.php"
    click SchedEvent "https://github.com/mdiqbalhossan/SafeVax/blob/main/app/Events/ScheduleVaccine.php"
    click SchedListener "https://github.com/mdiqbalhossan/SafeVax/blob/main/app/Listeners/ScheduleVaccination.php"
    click VaccReminder "https://github.com/mdiqbalhossan/SafeVax/blob/main/app/Mail/VaccinationReminder.php"
    click EmailTemplate "https://github.com/mdiqbalhossan/SafeVax/blob/main/resources/views/mail/vaccination_reminder.blade.php"
    click Member "https://github.com/mdiqbalhossan/SafeVax/blob/main/app/Models/Member.php"
    click Schedule "https://github.com/mdiqbalhossan/SafeVax/blob/main/app/Models/Schedule.php"
    click VaccineCenter "https://github.com/mdiqbalhossan/SafeVax/blob/main/app/Models/VaccineCenter.php"
    click User "https://github.com/mdiqbalhossan/SafeVax/blob/main/app/Models/User.php"
    click DBConfig "https://github.com/mdiqbalhossan/SafeVax/blob/main/config/database.php"
    click MailConfig "https://github.com/mdiqbalhossan/SafeVax/blob/main/config/mail.php"
    click CacheConfig "https://github.com/mdiqbalhossan/SafeVax/blob/main/config/cache.php"
    click StorageConfig "https://github.com/mdiqbalhossan/SafeVax/blob/main/config/filesystems.php"
    click ReminderCmd "https://github.com/mdiqbalhossan/SafeVax/blob/main/app/Console/Commands/SendVaccinationReminders.php"
    click Assets "https://github.com/mdiqbalhossan/SafeVax/blob/main/resources/css/app.css"
    click RegTest "https://github.com/mdiqbalhossan/SafeVax/blob/main/tests/Feature/RegistrationTest.php"
    click SearchTest "https://github.com/mdiqbalhossan/SafeVax/blob/main/tests/Feature/SearchTest.php"

    %% Style Applications
    class RegView,SearchView,SuccessView,Layout,Assets frontend
    class MemberCtrl,SearchCtrl controller
    class Member,Schedule,VaccineCenter,User model
    class DB,Cache,Storage,MailService infrastructure
    class SchedEvent,SchedListener event
    class DBConfig,MailConfig,CacheConfig,StorageConfig config
```
