# to-heeb/nigerians-at-faang architecture

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

- Interactive diagram: https://gitdiagram.com/to-heeb/nigerians-at-faang
- Repository: https://github.com/to-heeb/nigerians-at-faang

## Overview

##### Project type and purpose
- This is a full-stack web application (“Nigerians @ FAANG”) built with Laravel 12 (PHP 8.2), Blade (server-side templates), Livewire (reactive components), and Filament 4 (admin dashboard).
- Purpose: public site for browsing profiles and blogs of Nigerians at Big Tech, plus an admin panel to manage content.

##### Main components
a. Clients
- Public users (browser/mobile)
- Admin users (browser/mobile, access Filament at /admin)
b. Edge & Delivery
- Web Server (Apache or Nginx + PHP-FPM) serving public assets and routing all HTTP/HTTPS requests to Laravel’s index.php
- CDN or static asset server (optional) serving compiled CSS/JS/images from /public
c. Application Tier (Laravel monolith)
- HTTP Kernel → Routing → Controllers (AboutController, BlogController, etc.)
- Livewire components (Blogs, Companies, Profiles, Tags)
- Filament admin panel resources (BlogResource, CompanyResource, etc.)
- Console Commands & Scheduled Jobs (e.g., BuildSitemap)
- Job Dispatch (e.g., IncrementViews job) into a queue
d. Data & State
- Primary database (MySQL) for all Eloquent models (users, blogs, companies, etc.)
- Cache/Session store (Redis or file)
- Queue backend (Redis, database, or other)
- File storage (local /storage or external S3‐compatible) for uploaded media
e. External Services
- SMTP provider (Mailgun, SES, SMTP) for notifications (contact us, subscriber verification, welcome email)
- Analytics (Google Analytics via config/analytics.php)
- Optional third-party integrations via config/services.php
f. CI/CD Pipeline
- GitHub repo with Actions workflows (“test-deploy_staging.yaml” & “test-deploy_production.yaml”)
- Build steps: composer install, npm install & npm run dev, phpunit tests, deployment scripts
- Environment management: encrypted .env.staging and .env.production

##### Relationships and interactions
- Controllers call Eloquent → MySQL
- Livewire requests return JSON + HTML snippets
- Filament routes → admin CRUD interfaces

##### Architectural patterns & principles
- MVC for public interface (Controllers, Views, Models)
- Server-driven UI with Livewire for interactivity without a separate SPA
- CRUD admin panel via Filament (resource-based scaffolding)
- Asynchronous jobs for non-blocking tasks (email, view counters, sitemap build)
- Environment segregation (local, staging, production) with encrypted .env files and CI gating

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Clients Tier
    subgraph "Clients" 
        direction TB
        Public["Public User\n(Browser/Mobile)"]:::external
        Admin["Admin User\n(/admin)"]:::external
    end

    %% Edge & Delivery
    WebServer["Web Server\n(Apache/Nginx + PHP-FPM)"]:::internal
    CDN["CDN / Static Asset Server"]:::external

    %% Application Container
    subgraph "Laravel App Container" 
        direction TB
        Kernel["HTTP Kernel\nBootstrapping"]:::internal
        Routing["Routing Config"]:::internal
        Controllers["Controllers\n(app/Http/Controllers/)"]:::internal
        Livewire["Livewire Components\n(app/Livewire/)"]:::internal
        Filament["Filament Admin Resources\n(app/Filament/Resources/)"]:::internal
        ConsoleCmds["Console Commands\n&amp; Jobs Dispatch"]:::internal
        JobsDispatch["Job Dispatch\n(app/Jobs/)"]:::internal
    end

    %% Workers
    subgraph "Worker Processes" 
        direction TB
        WorkerQueue["Queue Worker"]:::internal
        IncrementViews["IncrementViews Job"]:::internal
        GenerateSitemap["GenerateSitemap Cmd"]:::internal
        BuildSitemap["BuildSitemap Action"]:::internal
    end

    %% Data & State
    subgraph "Data & State Layer"
        direction TB
        MySQL["MySQL Database"]:::internal
        Redis["Redis (Cache/Session/Queue)"]:::internal
        FileStore["File Storage\n(storage/app/)"]:::internal
    end

    %% External Services
    subgraph "External Services"
        direction TB
        SMTP["SMTP Provider"]:::external
        Analytics["Analytics"]:::external
    end

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline" 
        direction TB
        GitHub["GitHub Repo"]:::ci
        Actions["GitHub Actions\nBuild & Test"]:::ci
        Deploy["Deploy to Staging/Production"]:::ci
    end

    %% Connections
    Public -->|"HTTP/HTTPS"| WebServer
    Admin -->|"HTTP/HTTPS"| WebServer
    WebServer -->|"index.php"| Kernel
    WebServer --> CDN

    Kernel --> Routing
    Routing --> Controllers
    Routing --> Livewire
    Routing --> Filament

    Controllers -->|"Eloquent"| MySQL
    Livewire -->|"AJAX JSON+HTML"| Controllers
    Filament --> Controllers

    Controllers --> JobsDispatch
    JobsDispatch --> Redis

    Redis --> WorkerQueue
    WorkerQueue --> IncrementViews
    WorkerQueue --> GenerateSitemap
    WorkerQueue --> BuildSitemap

    WorkerQueue -->|"DB reads/writes"| MySQL
    WorkerQueue --> SMTP
    Controllers --> SMTP

    Controllers --> Redis
    Kernel --> Redis

    Controllers --> FileStore
    FileStore --> FileStore

    Controllers --> Analytics

    GitHub --> Actions
    Actions --> Deploy

    %% Click Events
    click Kernel "https://github.com/to-heeb/nigerians-at-faang/blob/master/bootstrap/app.php"
    click Routing "https://github.com/to-heeb/nigerians-at-faang/blob/master/routes/web.php"
    click Controllers "https://github.com/to-heeb/nigerians-at-faang/tree/master/app/Http/Controllers/"
    click Livewire "https://github.com/to-heeb/nigerians-at-faang/tree/master/app/Livewire/"
    click Filament "https://github.com/to-heeb/nigerians-at-faang/tree/master/app/Filament/Resources/"
    click GenerateSitemap "https://github.com/to-heeb/nigerians-at-faang/blob/master/app/Console/Commands/GenerateSitemap.php"
    click BuildSitemap "https://github.com/to-heeb/nigerians-at-faang/blob/master/app/Actions/BuildSitemap.php"
    click IncrementViews "https://github.com/to-heeb/nigerians-at-faang/blob/master/app/Jobs/IncrementViews.php"
    click Controllers "https://github.com/to-heeb/nigerians-at-faang/tree/master/app/Models/"
    click Routing "https://github.com/to-heeb/nigerians-at-faang/tree/master/database/migrations/"
    click Redis "https://github.com/to-heeb/nigerians-at-faang/blob/master/config/cache.php"
    click Redis "https://github.com/to-heeb/nigerians-at-faang/tree/master/storage/framework/"
    click Redis "https://github.com/to-heeb/nigerians-at-faang/blob/master/config/queue.php"
    click FileStore "https://github.com/to-heeb/nigerians-at-faang/blob/master/config/filesystems.php"
    click FileStore "https://github.com/to-heeb/nigerians-at-faang/tree/master/storage/app/"
    click Controllers "https://github.com/to-heeb/nigerians-at-faang/blob/master/config/mail.php"
    click Controllers "https://github.com/to-heeb/nigerians-at-faang/blob/master/config/services.php"
    click Analytics "https://github.com/to-heeb/nigerians-at-faang/blob/master/config/analytics.php"
    click GitHub "https://github.com/to-heeb/nigerians-at-faang/blob/master/.github/workflows/test-deploy_staging.yaml"
    click GitHub "https://github.com/to-heeb/nigerians-at-faang/blob/master/.github/workflows/test-deploy_production.yaml"

    %% Styles
    classDef internal fill:#daeaff,stroke:#333,stroke-width:1px
    classDef external fill:#d4f8d4,stroke:#333,stroke-width:1px
    classDef ci fill:#ffe49c,stroke:#333,stroke-width:1px
```
