# prateekp3108/test architecture

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

- Interactive diagram: https://gitdiagram.com/prateekp3108/test
- Repository: https://github.com/prateekp3108/test

## Overview

##### Project type and purpose
- You have a hybrid architecture:
- A full-stack Laravel “monolith” that serves Blade views and Livewire components (the `app/`, `resources/views/`, `public/` folders, etc.).
- A microservices ecosystem (under `services/…`) that handles cross-cutting concerns (authentication, file storage, image processing, notifications, PDF generation, analytics, external integrations, a queue-worker, user profiles).
- A Node-based API Gateway (`api-gateway/`) that routes API calls to the monolith or the individual microservices.
- The README calls this “Freshman CMS,” built on Laravel Breeze + the TALL stack (Tailwind, Alpine, Livewire, Laravel).

##### File structure
- Top-level:
- `app/`, `resources/`, `public/`, `routes/`, `config/`, `database/`, `bootstrap/` → traditional Laravel monolith
- `api-gateway/` → Node.js gateway container
- `services/…` → each subfolder is a standalone microservice with its own Dockerfile, controllers, routes, config
- Notice that each service:
- Exposes a RESTful API (e.g. `routes/api.php`)
- Has its own Dockerfile for containerization
- Encapsulates a single domain function (e.g. `auth-service`, `pdf-service`, `image-service`, etc.)
- The presence of `queue-worker-service` plus Laravel’s job classes in the monolith implies an asynchronous, event-driven pattern.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Clients
    Browser["Web Browser"]:::external
    Mobile["Mobile App"]:::external

    %% API Gateway
    APIGateway["API Gateway (Node.js)"]:::compute

    %% Monolith
    subgraph "Monolith (Laravel + Livewire)" 
        MonolithUI["Blade & Livewire UI"]:::compute
        MonolithAPI["API Controllers"]:::compute
        MonolithJobs["Job Processors"]:::compute
        MonolithDB["MySQL Database"]:::db
        MonolithAssets["Public Assets"]:::compute
        MonolithViews["resources/views/ & livewire"]:::compute
        MonolithApp["app/"]:::compute
        MonolithWebRoutes["routes/web.php"]:::compute
        MonolithAPIRoutes["routes/api.php"]:::compute
    end

    %% Microservices
    subgraph "Microservices Ecosystem"
        AuthService["Auth Service"]:::compute
        FileStorage["File Storage Service"]:::compute
        ImageService["Image Service"]:::compute
        NotificationService["Notification Service"]:::compute
        PDFService["PDF Service"]:::compute
        AnalyticsService["Analytics Service"]:::compute
        ExternalInt["External Integrations Service"]:::compute
        QueueWorker["Queue Worker Service"]:::compute
        UserProfile["User Profile Service"]:::compute

        %% Datastores per service
        AuthDB["Auth DB"]:::db
        FileDB["File Storage DB"]:::db
        ImageDB["Image Service DB"]:::db
        NotificationDB["Notification DB"]:::db
        PDFDB["PDF DB"]:::db
        AnalyticsDB["Analytics DB"]:::db
        ExternalDB["External API Config Store"]:::db
        QueueBroker["Message Broker"]:::queue
        UserProfileDB["User Profile DB"]:::db
    end

    %% Shared Resources
    ObjectStorage["Object Storage (S3)"]:::storage
    CDN["CDN"]:::external
    SMTP["SMTP / SMS Gateways"]:::external
    ThirdPartyAPI["Third-Party APIs"]:::external

    %% Flow: Clients to Gateway
    Browser -->|"HTTP/HTTPS"| APIGateway
    Mobile -->|"HTTP/HTTPS"| APIGateway

    %% Gateway routes to Monolith or Services
    APIGateway -->|"REST API"| MonolithAPI
    APIGateway -->|"REST API"| AuthService
    APIGateway -->|"REST API"| FileStorage
    APIGateway -->|"REST API"| ImageService
    APIGateway -->|"REST API"| NotificationService
    APIGateway -->|"REST API"| PDFService
    APIGateway -->|"REST API"| AnalyticsService
    APIGateway -->|"REST API"| ExternalInt
    APIGateway -->|"REST API"| UserProfile

    %% Monolith components
    MonolithUI --> MonolithAPI
    MonolithAPI --> MonolithDB
    MonolithAPI --> QueueBroker
    MonolithJobs --> QueueBroker

    %% Microservices data
    AuthService --> AuthDB
    FileStorage --> FileDB
    FileStorage --> ObjectStorage
    ImageService --> ImageDB
    ImageService --> ObjectStorage
    ImageService --> CDN
    NotificationService --> NotificationDB
    NotificationService --> SMTP
    PDFService --> PDFDB
    PDFService --> MonolithAPI
    PDFService --> AuthService
    AnalyticsService --> AnalyticsDB
    AnalyticsService --> MonolithAPI
    ExternalInt --> ExternalDB
    ExternalInt --> ThirdPartyAPI
    QueueWorker --> QueueBroker
    QueueWorker --> MonolithAPI
    UserProfile --> UserProfileDB

    %% Events (dashed)
    MonolithAPI -.->|Publishes events| QueueBroker
    AuthService -.->|Publishes events| QueueBroker
    FileStorage -.->|Publishes events| QueueBroker
    ImageService -.->|Publishes events| QueueBroker
    NotificationService -.->|Publishes events| QueueBroker
    PDFService -.->|Publishes events| QueueBroker
    AnalyticsService -.->|Publishes events| QueueBroker
    ExternalInt -.->|Publishes events| QueueBroker
    UserProfile -.->|Publishes events| QueueBroker

    %% Click Events
    click APIGateway "https://github.com/prateekp3108/test/blob/main/api-gateway/index.js"
    click MonolithApp "https://github.com/prateekp3108/test/tree/main/app/"
    click MonolithViews "https://github.com/prateekp3108/test/tree/main/resources/views/"
    click MonolithLivewire "https://github.com/prateekp3108/test/tree/main/resources/views/livewire/"
    click MonolithAssets "https://github.com/prateekp3108/test/tree/main/public/"
    click MonolithWebRoutes "https://github.com/prateekp3108/test/blob/main/routes/web.php"
    click MonolithAPIRoutes "https://github.com/prateekp3108/test/blob/main/routes/api.php"
    click AuthService "https://github.com/prateekp3108/test/tree/main/services/auth-service/"
    click FileStorage "https://github.com/prateekp3108/test/tree/main/services/file-storage-service/"
    click ImageService "https://github.com/prateekp3108/test/tree/main/services/image-service/"
    click NotificationService "https://github.com/prateekp3108/test/tree/main/services/notification-service/"
    click PDFService "https://github.com/prateekp3108/test/tree/main/services/pdf-service/"
    click AnalyticsService "https://github.com/prateekp3108/test/tree/main/services/analytics-service/"
    click ExternalInt "https://github.com/prateekp3108/test/tree/main/services/external-integrations-service/"
    click QueueWorker "https://github.com/prateekp3108/test/tree/main/services/queue-worker-service/"
    click UserProfile "https://github.com/prateekp3108/test/tree/main/services/user-profile-service/"

    %% Styles
    classDef compute fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef db fill:#90EE90,stroke:#000,stroke-width:1px
    classDef storage fill:#F0E68C,stroke:#000,stroke-width:1px
    classDef queue fill:#FFA500,stroke:#000,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#000,stroke-width:1px
```
