# mayank-maurya/audible_clone architecture

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

- Interactive diagram: https://gitdiagram.com/mayank-maurya/audible_clone
- Repository: https://github.com/mayank-maurya/audible_clone

## Overview

##### Main Components Identification

The system consists of the following major components:
- Frontend (Angular Application)
- Backend Microservices:
- Gateway Service
- Customer Service
- AudioBook Service
- Cart Service
- Payment Service
- Service Discovery (Consul)

##### Detailed Component Breakdown

Frontend (Angular):
- Main modules: Authentication, Home, Library, Cart, Audio Player
- Services layer: AudioBook, Cart, Auth, Storage services

Backend Microservices:
- Customer Service:
- JWT authentication
- User management
- Security configurations

- AudioBook Service:
- Book management
- Audio file handling
- Filtering capabilities

- Cart Service:
- Cart management
- Cart items handling

- Payment Service:
- Transaction processing
- Payment status management

- Gateway Service:
- Route configurations
- Load balancing
- Request filtering

##### Additional Elements

Supporting components:
- Service Registry (Consul)
- Security layer (JWT)
- Static resource storage for audio files
- Cross-cutting concerns (logging, monitoring)

##### Technical Details

Annotations showing:
- Spring Boot framework
- Angular framework version
- Communication protocols (REST)
- Security mechanisms (JWT)
- Database types used
- Service discovery mechanism (Consul)

##### Data Flow Indicators

- Authentication flows (thick lines)

##### Notes Section

A notes section explaining:
- Scalability considerations
- Security implementations
- Deployment requirements
- Service discovery mechanism
- Load balancing strategy

- Grouping related services together
- Using consistent spacing
- Adding clear labels
- Including a title and version number
- Adding a brief description of the system's purpose

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef client fill:#fff,stroke:#333
    classDef frontend fill:#f96,stroke:#333
    classDef gateway fill:#9f6,stroke:#333
    classDef service fill:#69f,stroke:#333
    classDef database fill:#999,stroke:#333
    classDef discovery fill:#c9f,stroke:#333

    %% Client Layer
    Client((Web Browser)):::client

    %% Frontend Layer
    subgraph Frontend
        Angular["Angular Application"]
        AuthModule["Authentication Module"]
        HomeModule["Home Module"]
        LibModule["Library Module"]
        CartModule["Cart Module"]
        PlayerModule["Audio Player Module"]
        
        CoreServices{"Core Services"}
        AudioBookSvc["AudioBook Service"]
        CartSvc["Cart Service"]
        AuthSvc["Auth Service"]
        StorageSvc["Storage Service"]
    end

    %% Gateway Layer
    Gateway[("API Gateway")]:::gateway

    %% Service Discovery
    ServiceDiscovery[("Consul Registry")]:::discovery

    %% Microservices Layer
    subgraph Microservices
        CustomerMS["Customer Service"]
        AudioBookMS["AudioBook Service"]
        CartMS["Cart Service"]
        PaymentMS["Payment Service"]
    end

    %% Database Layer
    CustomerDB[(Customer DB)]:::database
    AudioBookDB[(AudioBook DB)]:::database
    CartDB[(Cart DB)]:::database
    PaymentDB[(Payment DB)]:::database

    %% Relationships
    Client --> Angular
    Angular --> Gateway
    Gateway --> CustomerMS
    Gateway --> AudioBookMS
    Gateway --> CartMS
    Gateway --> PaymentMS

    CustomerMS --> CustomerDB
    AudioBookMS --> AudioBookDB
    CartMS --> CartDB
    PaymentMS --> PaymentDB

    CartMS <--> PaymentMS

    %% Service Discovery Connections
    CustomerMS -.-> ServiceDiscovery
    AudioBookMS -.-> ServiceDiscovery
    CartMS -.-> ServiceDiscovery
    PaymentMS -.-> ServiceDiscovery
    Gateway -.-> ServiceDiscovery

    %% Frontend Internal Connections
    Angular --> AuthModule
    Angular --> HomeModule
    Angular --> LibModule
    Angular --> CartModule
    Angular --> PlayerModule
    Angular --> CoreServices
    CoreServices --> AudioBookSvc
    CoreServices --> CartSvc
    CoreServices --> AuthSvc
    CoreServices --> StorageSvc

    %% Click Events
    click Angular "https://github.com/Mayank-Maurya/Audible_Clone/tree/main/Audible_FrontEnd/src/app"
    click AuthModule "https://github.com/Mayank-Maurya/Audible_Clone/tree/main/Audible_FrontEnd/src/app/login"
    click HomeModule "https://github.com/Mayank-Maurya/Audible_Clone/tree/main/Audible_FrontEnd/src/app/home-page"
    click LibModule "https://github.com/Mayank-Maurya/Audible_Clone/tree/main/Audible_FrontEnd/src/app/library"
    click CartModule "https://github.com/Mayank-Maurya/Audible_Clone/tree/main/Audible_FrontEnd/src/app/cart"
    click PlayerModule "https://github.com/Mayank-Maurya/Audible_Clone/tree/main/Audible_FrontEnd/src/app/audio-player"
    click AudioBookSvc "https://github.com/Mayank-Maurya/Audible_Clone/blob/main/Audible_FrontEnd/src/app/audiobook.service.ts"
    click CartSvc "https://github.com/Mayank-Maurya/Audible_Clone/blob/main/Audible_FrontEnd/src/app/cart.service.ts"
    click AuthSvc "https://github.com/Mayank-Maurya/Audible_Clone/blob/main/Audible_FrontEnd/src/app/auth-service.service.ts"
    click StorageSvc "https://github.com/Mayank-Maurya/Audible_Clone/blob/main/Audible_FrontEnd/src/app/storage.service.ts"
    click Gateway "https://github.com/Mayank-Maurya/Audible_Clone/tree/main/Audible_Backend/GatewayMS"
    click CustomerMS "https://github.com/Mayank-Maurya/Audible_Clone/tree/main/Audible_Backend/Customer"
    click AudioBookMS "https://github.com/Mayank-Maurya/Audible_Clone/tree/main/Audible_Backend/AudioBook"
    click CartMS "https://github.com/Mayank-Maurya/Audible_Clone/tree/main/Audible_Backend/AudibleCart"
    click PaymentMS "https://github.com/Mayank-Maurya/Audible_Clone/tree/main/Audible_Backend/PaymentMS"
    click ServiceDiscovery "https://github.com/Mayank-Maurya/Audible_Clone/tree/main/Audible_Backend/audible_consul"
```
