# confidential-info/budget-tracker architecture

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

- Interactive diagram: https://gitdiagram.com/confidential-info/budget-tracker
- Repository: https://github.com/confidential-info/budget-tracker

## Overview

##### Main Components

Frontend Layer:
- Client Application (React)
- Layout Components
- Route Components
- Feature Components
- UI Components

Authentication Layer:
- Clerk Authentication Service
- Google OAuth
- Facebook OAuth
- User Session Management

Backend Layer:
- Database (PostgreSQL via Neon)
- Drizzle ORM Layer
- API Layer

##### Component Relationships

**[Client Layer] → [Authentication Layer] → [Backend Layer] → [Database Layer]**

##### Detailed Component Breakdown

Client Layer (React):
- Routes Module (src/routes)
- Components Module (src/components)
- Layouts Module (src/layouts)
- Utils Module (src/utils)

- Dashboard System
- Budget Management
- Expense Tracking
- User Authentication UI

##### Specific Implementation Details

Frontend Architecture:
**[Root Layout] → [Dashboard Layout] → [Feature Components]**
- ↓
**[Authentication] ← [Clerk Services] → [User Data]**
- ↓
**[Database Layer] ← [Drizzle ORM] → [PostgreSQL/Neon]**

##### Key Interactions to Highlight

- User Authentication Flow:
- User → Clerk Auth → Dashboard Access

- Budget Management Flow:
- Dashboard → Budget CRUD → Database

- Expense Tracking Flow:
- Expense Component → Database → Chart Updates

##### Technical Stack Indicators

- React + React Router
- Tailwind CSS
- Clerk Authentication
- Drizzle ORM
- PostgreSQL (Neon)
- Heroicons
- Headless UI

##### Data Flow Patterns

Key flows:
- User authentication and session management
- Budget creation and management
- Expense tracking and visualization
- Dashboard data aggregation

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Frontend["React Frontend"]
        Routes["Routes Module"]
        Components["Components Module"]
        Layouts["Layouts Module"]
        Utils["Utils Module"]

        subgraph LayoutComponents["Layout Components"]
            RootLayout["Root Layout"]
            DashboardLayout["Dashboard Layout"]
        end

        subgraph RouteComponents["Route Components"]
            MainRoutes["Main Routes"]
            DashboardRoute["Dashboard Route"]
            ExpensesRoute["Expenses Route"]
            BudgetsRoute["Budgets Route"]
        end

        subgraph FeatureComponents["Feature Components"]
            BudgetManagement["Budget Management"]
            ExpenseTracking["Expense Tracking"]
            DashboardSystem["Dashboard System"]
        end

        subgraph Navigation
            MainNav["Main Navigation"]
            SideNav["Side Navigation"]
        end
    end

    subgraph Auth["Authentication Layer"]
        ClerkAuth["Clerk Authentication"]
        SignIn["Sign In"]
        SignUp["Sign Up"]
        GoogleOAuth["Google OAuth"]
        FacebookOAuth["Facebook OAuth"]
    end

    subgraph Backend["Backend Layer"]
        DrizzleORM["Drizzle ORM"]
        DBConfig["Database Config"]
        Schema["Database Schema"]
        PostgreSQL["PostgreSQL/Neon"]
    end

    Frontend --> Routes
    Frontend --> Components
    Frontend --> Layouts
    Frontend --> Utils

    Routes --> LayoutComponents
    Routes --> RouteComponents
    
    Components --> FeatureComponents
    Components --> Navigation

    FeatureComponents --> Auth
    Auth --> Backend
    Backend --> PostgreSQL

    %% Component Mappings
    click RootLayout "https://github.com/confidential-info/Budget-Tracker/blob/main/src/layouts/root-layout.jsx"
    click DashboardLayout "https://github.com/confidential-info/Budget-Tracker/blob/main/src/layouts/dashboard-layout.jsx"
    click MainRoutes "https://github.com/confidential-info/Budget-Tracker/blob/main/src/routes/index.jsx"
    click DashboardRoute "https://github.com/confidential-info/Budget-Tracker/blob/main/src/routes/dashboard.jsx"
    click ExpensesRoute "https://github.com/confidential-info/Budget-Tracker/blob/main/src/routes/ExpensesPage.jsx"
    click BudgetsRoute "https://github.com/confidential-info/Budget-Tracker/blob/main/src/routes/Budgets.jsx"
    click SignIn "https://github.com/confidential-info/Budget-Tracker/blob/main/src/routes/sign-in.jsx"
    click SignUp "https://github.com/confidential-info/Budget-Tracker/blob/main/src/routes/sign-up.jsx"
    click MainNav "https://github.com/confidential-info/Budget-Tracker/blob/main/src/components/Nav.jsx"
    click SideNav "https://github.com/confidential-info/Budget-Tracker/blob/main/src/components/SideNav.jsx"
    click DBConfig "https://github.com/confidential-info/Budget-Tracker/blob/main/src/utils/dbConfig.jsx"
    click Schema "https://github.com/confidential-info/Budget-Tracker/blob/main/src/utils/schema.jsx"

    classDef frontend fill:#3b82f6,color:#fff
    classDef auth fill:#22c55e,color:#fff
    classDef backend fill:#f97316,color:#fff
    classDef database fill:#a855f7,color:#fff

    class Frontend,Routes,Components,Layouts,Utils,LayoutComponents,RouteComponents,FeatureComponents,Navigation frontend
    class Auth,ClerkAuth,SignIn,SignUp,GoogleOAuth,FacebookOAuth auth
    class Backend,DrizzleORM,DBConfig,Schema backend
    class PostgreSQL database
```
