# dharshibalasubramaniyam/fullstack-expense-tracker architecture

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

- Interactive diagram: https://gitdiagram.com/dharshibalasubramaniyam/fullstack-expense-tracker
- Repository: https://github.com/dharshibalasubramaniyam/fullstack-expense-tracker

## Overview

##### Main Components

A. Frontend Layer (React.js):
- User Interface Components
- Authentication Module (login, register, password reset)
- User Dashboard
- Admin Dashboard
- Transaction Management
- Budget Management
- Reports & Statistics
- Profile Management

B. Backend Layer (Spring Boot):
- REST API Controllers
- Service Layer
- Repository Layer
- Security Layer (JWT Authentication)
- Data Models
- DTOs (Request/Response)
- Exception Handlers

C. Database Layer (MySQL):
- User Management
- Transaction Management
- Category Management
- Budget Management
- Role Management

##### Key Relationships to Highlight

- Client-Server Communication:
- REST API endpoints connecting frontend to backend
- JWT token flow for authentication
- Data flow directions

- Database Interactions:
- Entity relationships between models
- CRUD operations flow

##### Specific Implementation Details

**[Frontend Layer]**
- Public Components
- Welcome Page
- Auth Components
- Login
- Register
- Password Reset
- User Components
- Dashboard
- Transactions
- Budget
- Statistics
- Admin Components
- User Management
- Category Management
- Transaction Overview

**[Backend Layer]**
- Security
- JWT Authentication
- Role-based Access Control
- Controllers
- Auth Controllers
- User Controllers
- Admin Controllers
- Services
- Core Services
- Notification Service
- Repositories
- Data Access Layer

**[Database Layer]**
- Users
- Transactions
- Categories
- Budgets
- Roles

##### Additional Elements

- External Services:
- Email Service for notifications
- File Storage for profile images

- Cross-cutting Concerns:
- Error Handling
- Logging
- Security
- Data Validation

##### Important Flows to Highlight

- Authentication Flow:
- User → Login Request → JWT Authentication → Token Response → Protected Resources

- Transaction Flow:
- User → Transaction Creation → Validation → Database Storage → Budget Update → Notification

##### Notes

- Database schema relationships in a separate view
- Clear separation between user and admin functionalities

This system design should effectively communicate the architecture while maintaining clarity and providing sufficient detail for implementation understanding.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef database fill:#f1c40f,stroke:#f39c12,color:black
    classDef security fill:#e74c3c,stroke:#c0392b,color:white
    classDef service fill:#9b59b6,stroke:#8e44ad,color:white

    %% Frontend Layer
    subgraph Frontend
        UI[User Interface]
        AuthModule[Authentication Module]:::frontend
        UserDash[User Dashboard]:::frontend
        AdminDash[Admin Dashboard]:::frontend
        TransactionUI[Transaction Management]:::frontend
        BudgetUI[Budget Management]:::frontend
        ReportsUI[Reports & Statistics]:::frontend
        ProfileUI[Profile Management]:::frontend
    end

    %% Backend Layer
    subgraph Backend
        API[REST API Controllers]:::backend
        Security[Security Layer]:::security
        JWT[JWT Authentication]:::security
        Services[Service Layer]:::service
        NotifService[Notification Service]:::service
        Repos[Repository Layer]:::backend
        Models[Data Models]:::backend
        DTOs[DTOs]:::backend
        ExHandlers[Exception Handlers]:::backend
    end

    %% Database Layer
    subgraph Database
        DB[(MySQL Database)]:::database
        UserDB[(User Management)]:::database
        TransDB[(Transaction Management)]:::database
        CatDB[(Category Management)]:::database
        BudgetDB[(Budget Management)]:::database
        RoleDB[(Role Management)]:::database
    end

    %% External Services
    EmailSvc[Email Service]:::service
    Storage[File Storage]:::service

    %% Relationships
    UI --> AuthModule
    AuthModule --> API
    API --> JWT
    JWT --> Security
    Security --> Services
    Services --> Repos
    Repos --> DB
    Services --> NotifService
    NotifService --> EmailSvc
    ProfileUI --> Storage

    %% Click Events
    click AuthModule "https://github.com/DharshiBalasubramaniyam/Fullstack-Expense-Tracker/tree/main/frontend/src/pages/auth"
    click UserDash "https://github.com/DharshiBalasubramaniyam/Fullstack-Expense-Tracker/blob/main/frontend/src/pages/user/dashboard.js"
    click AdminDash "https://github.com/DharshiBalasubramaniyam/Fullstack-Expense-Tracker/tree/main/frontend/src/pages/admin"
    click TransactionUI "https://github.com/DharshiBalasubramaniyam/Fullstack-Expense-Tracker/tree/main/frontend/src/components/userTransactions"
    click Security "https://github.com/DharshiBalasubramaniyam/Fullstack-Expense-Tracker/tree/main/backend/src/main/java/com/fullStack/expenseTracker/security"
    click JWT "https://github.com/DharshiBalasubramaniyam/Fullstack-Expense-Tracker/tree/main/backend/src/main/java/com/fullStack/expenseTracker/security/jwt"
    click Services "https://github.com/DharshiBalasubramaniyam/Fullstack-Expense-Tracker/tree/main/backend/src/main/java/com/fullStack/expenseTracker/services"
    click Repos "https://github.com/DharshiBalasubramaniyam/Fullstack-Expense-Tracker/tree/main/backend/src/main/java/com/fullStack/expenseTracker/repository"
    click Models "https://github.com/DharshiBalasubramaniyam/Fullstack-Expense-Tracker/tree/main/backend/src/main/java/com/fullStack/expenseTracker/models"
    click DTOs "https://github.com/DharshiBalasubramaniyam/Fullstack-Expense-Tracker/tree/main/backend/src/main/java/com/fullStack/expenseTracker/dto"
    click ExHandlers "https://github.com/DharshiBalasubramaniyam/Fullstack-Expense-Tracker/tree/main/backend/src/main/java/com/fullStack/expenseTracker/handlers"
    click BudgetUI "https://github.com/DharshiBalasubramaniyam/Fullstack-Expense-Tracker/blob/main/frontend/src/components/userDashboard/budget.js"
    click ProfileUI "https://github.com/DharshiBalasubramaniyam/Fullstack-Expense-Tracker/tree/main/frontend/src/components/userProfile"
    click ReportsUI "https://github.com/DharshiBalasubramaniyam/Fullstack-Expense-Tracker/blob/main/frontend/src/pages/user/statistics.js"
    click NotifService "https://github.com/DharshiBalasubramaniyam/Fullstack-Expense-Tracker/blob/main/backend/src/main/java/com/fullStack/expenseTracker/services/NotificationService.java"

    %% Legend
    subgraph Legend
        Frontend_L[Frontend]:::frontend
        Backend_L[Backend]:::backend
        Database_L[Database]:::database
        Security_L[Security]:::security
        Service_L[Service]:::service
    end
```
