# mrtamalampudi/jon-snow architecture

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

- Interactive diagram: https://gitdiagram.com/mrtamalampudi/jon-snow
- Repository: https://github.com/mrtamalampudi/jon-snow

## Overview

##### Main Architectural Components

a) Core Layers (Use vertical layers):
- Controllers Layer (Entry point)
- Service Layer (Business Logic)
- Repository Layer (Data Access)
- Model Layer (Domain Objects)

b) Cross-cutting Concerns (Show as horizontal layers):
- Security (JWT Authentication)
- AOP (Aspect-Oriented Programming)
- Global Exception Handling
- Specification Pattern Implementation

##### Key Components to Highlight

a) Security Components:
- JWTAuthenticationFilter
- UsernamePasswordFilter
- WebSecurityConfig

b) Data Management:
- JPA/Hibernate (indicated by JPAConfig)
- Database Tables (from SQL scripts)
- Repositories for each entity

c) Business Domains:
- Transaction Management
- Split Bill System
- User Management
- Category Management
- Budget Management

##### Component Relationships

Following flows:
- HTTP Request → Security Filters → Controllers
- Controllers → DTOs → Services
- Services → Repositories → Database
- Cross-cutting AOP aspects intercepting service calls
- Specification pattern implementation for search operations

##### Special Features to Highlight

- Split Bill Feature Components
- Transaction Management Flow
- User Authentication Process
- Specification Pattern Implementation
- Audit Functionality

##### Elements

- Database Schema (showing key tables)
- Security Flow
- DTO Transformation Layer
- Exception Handling Flow
- AOP Interceptors

##### The audit and tracking capabilities

Key Relationships to Show:

**Client Request**
- ↓
**Security Filters (JWT/Username Password)**
- ↓
**Controllers**
- ↓
**DTOs ←→ Mappers**
- ↓
**Services (with AOP)**
- ↓
**Specifications ←→ Repositories**
- ↓
**Database**

Remember to:
- Keep the main flow clear and visible
- Bidirectional relationships where they exist
- Notes for important architectural decisions
- How cross-cutting concerns interact with the main flow

This will create a comprehensive yet clear visualization of the system's architecture while maintaining the appropriate level of detail for a principal software engineer to understand the complete system design.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        CL[Client Request]
    end

    subgraph "Security Layer"
        JWT["JWT Authentication"]:::security
        UPF["Username Password Filter"]:::security
        WSC["Web Security Config"]:::security
    end

    subgraph "Cross-Cutting Concerns"
        AOPConfig["AOP Configuration"]:::crosscut
        TAOP["Transaction AOP"]:::crosscut
        SAOP["Split Bill AOP"]:::crosscut
        GEH["Global Exception Handler"]:::crosscut
    end

    subgraph "Controller Layer"
        SBC["Split Bill Controller"]:::controller
        SBGC["Split Bill Groups Controller"]:::controller
        TC["Transaction Controller"]:::controller
        UC["User Controller"]:::controller
    end

    subgraph "DTO Layer"
        DTO["DTOs"]:::dto
        MAP["Mappers"]:::dto
    end

    subgraph "Service Layer"
        SBS["Split Bill Service"]:::service
        SBGS["Split Bill Groups Service"]:::service
        TS["Transaction Service"]:::service
        US["User Service"]:::service
    end

    subgraph "Specification Layer"
        BS["Base Specification"]:::spec
        SB["Specification Builders"]:::spec
        SR["Search Request"]:::spec
    end

    subgraph "Repository Layer"
        BR["Base Repository"]:::repo
        TR["Transaction Repository"]:::repo
        UR["User Repository"]:::repo
    end

    subgraph "Model Layer"
        SBM["Split Bill Model"]:::model
        SBGM["Split Bill Group Model"]:::model
        TM["Transaction Model"]:::model
        UM["User Model"]:::model
        AM["Audit Models"]:::model
    end

    subgraph "Database Layer"
        DB[(Database)]:::database
        SCHEMA["Database Schema"]:::database
    end

    CL --> JWT
    JWT --> UPF
    UPF --> WSC
    WSC --> SBC & SBGC & TC & UC

    SBC & SBGC & TC & UC --> DTO
    DTO <--> MAP
    MAP --> SBS & SBGS & TS & US

    AOPConfig --> TAOP & SAOP
    TAOP & SAOP --> SBS & SBGS & TS & US
    GEH --> SBC & SBGC & TC & UC

    SBS & SBGS & TS & US --> BS
    BS --> SB
    SB --> SR
    SR --> BR & TR & UR

    BR & TR & UR --> SBM & SBGM & TM & UM & AM
    SBM & SBGM & TM & UM & AM --> DB
    DB --> SCHEMA

    %% Click events for component mapping
    click JWT "https://github.com/MRTamalampudi/jon-snow/blob/main/src/main/java/com/expenses/jonsnow/security/JWTAuthenticationFilter.java"
    click UPF "https://github.com/MRTamalampudi/jon-snow/blob/main/src/main/java/com/expenses/jonsnow/security/UsernamePasswordFilter.java"
    click WSC "https://github.com/MRTamalampudi/jon-snow/blob/main/src/main/java/com/expenses/jonsnow/config/WebSecurityConfig.java"
    click AOPConfig "https://github.com/MRTamalampudi/jon-snow/blob/main/src/main/java/com/expenses/jonsnow/config/AspectConfig.java"
    click TAOP "https://github.com/MRTamalampudi/jon-snow/blob/main/src/main/java/com/expenses/jonsnow/aop/TransactionAOP.java"
    click SAOP "https://github.com/MRTamalampudi/jon-snow/blob/main/src/main/java/com/expenses/jonsnow/aop/SplitBillAOP.java"
    click GEH "https://github.com/MRTamalampudi/jon-snow/blob/main/src/main/java/com/expenses/jonsnow/exceptions/GlobalExceptionHandler.java"
    click BR "https://github.com/MRTamalampudi/jon-snow/blob/main/src/main/java/com/expenses/jonsnow/repository/BaseRepo.java"
    click SCHEMA "https://github.com/MRTamalampudi/jon-snow/tree/main/src/main/resources/database/schema/"
    click SBC "https://github.com/MRTamalampudi/jon-snow/blob/main/src/main/java/com/expenses/jonsnow/controllers/SplitBillController.java"
    click SBGC "https://github.com/MRTamalampudi/jon-snow/blob/main/src/main/java/com/expenses/jonsnow/controllers/SplitBillGroupsController.java"
    click SBM "https://github.com/MRTamalampudi/jon-snow/blob/main/src/main/java/com/expenses/jonsnow/model/SplitBill.java"
    click SBGM "https://github.com/MRTamalampudi/jon-snow/blob/main/src/main/java/com/expenses/jonsnow/model/SplitBillGroup.java"
    click SBS "https://github.com/MRTamalampudi/jon-snow/blob/main/src/main/java/com/expenses/jonsnow/service/SplitBillService.java"
    click SBGS "https://github.com/MRTamalampudi/jon-snow/blob/main/src/main/java/com/expenses/jonsnow/service/SplitBillGroupsService.java"
    click TC "https://github.com/MRTamalampudi/jon-snow/blob/main/src/main/java/com/expenses/jonsnow/controllers/TransactionController.java"
    click TM "https://github.com/MRTamalampudi/jon-snow/blob/main/src/main/java/com/expenses/jonsnow/model/Transaction.java"
    click TS "https://github.com/MRTamalampudi/jon-snow/blob/main/src/main/java/com/expenses/jonsnow/service/TransactionService.java"
    click TR "https://github.com/MRTamalampudi/jon-snow/blob/main/src/main/java/com/expenses/jonsnow/repository/TransactionRepo.java"
    click BS "https://github.com/MRTamalampudi/jon-snow/blob/main/src/main/java/com/expenses/jonsnow/specification/BaseSpecification.java"
    click SB "https://github.com/MRTamalampudi/jon-snow/tree/main/src/main/java/com/expenses/jonsnow/specification/Builder/"
    click SR "https://github.com/MRTamalampudi/jon-snow/blob/main/src/main/java/com/expenses/jonsnow/specification/SearchRequest.java"
    click DTO "https://github.com/MRTamalampudi/jon-snow/tree/main/src/main/java/com/expenses/jonsnow/dto/"
    click MAP "https://github.com/MRTamalampudi/jon-snow/tree/main/src/main/java/com/expenses/jonsnow/mapper/"
    click UC "https://github.com/MRTamalampudi/jon-snow/blob/main/src/main/java/com/expenses/jonsnow/controllers/UserController.java"
    click UM "https://github.com/MRTamalampudi/jon-snow/blob/main/src/main/java/com/expenses/jonsnow/model/User.java"
    click US "https://github.com/MRTamalampudi/jon-snow/blob/main/src/main/java/com/expenses/jonsnow/service/UserService.java"
    click UR "https://github.com/MRTamalampudi/jon-snow/blob/main/src/main/java/com/expenses/jonsnow/repository/UserRepo.java"
    click AM "https://github.com/MRTamalampudi/jon-snow/blob/main/src/main/java/com/expenses/jonsnow/model/Audit.java"

    classDef security fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef crosscut fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef controller fill:#87CEEB,stroke:#333,stroke-width:2px;
    classDef service fill:#4169E1,stroke:#333,stroke-width:2px;
    classDef dto fill:#DDA0DD,stroke:#333,stroke-width:2px;
    classDef spec fill:#F4A460,stroke:#333,stroke-width:2px;
    classDef repo fill:#FF6347,stroke:#333,stroke-width:2px;
    classDef model fill:#20B2AA,stroke:#333,stroke-width:2px;
    classDef database fill:#CD853F,stroke:#333,stroke-width:2px;
```
