# krishna17092004/personal-expense-tracker architecture

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

- Interactive diagram: https://gitdiagram.com/krishna17092004/personal-expense-tracker
- Repository: https://github.com/krishna17092004/personal-expense-tracker

## Overview

##### Main Components
- Client Side (Frontend): This includes the HTML pages (index.php, login.php, register.php, profile.php, etc.), along with CSS (bootstrap.css, style.css) and JavaScript files contained in the js directory. These handle user interactions and display the interface.
- Server Side (Backend): PHP scripts such as add_expense.php, change_password.php, expensereport.php, manage_expense.php, session.php, and config.php handle business logic, user authentication, session management, and CRUD operations.
- Database: The SQL file (PersonalExpenseTracker.sql) and instructions on setting up a MySQL database (named “dailyexpense”) indicate that this component serves as the persistent data store for user accounts and expense records.
- File Uploads: The “uploads” directory suggests that users might upload files (e.g., images for receipts or reports) as part of their expense tracking.

##### Relationships and Interactions
- The Client sends HTTP requests (through form submissions and navigation) to the Server.
- The Server (PHP scripts) processes these requests, manages sessions, and interacts with the Database to store, fetch, update, or delete expense records.
- Once processed, the Server sends back HTML/CSS/JS content to the Client for rendering.
- Static resources (CSS, JS, images in uploads) are served to enhance the UI experience.

##### Architectural Patterns
- You might note session management as an integral part of user authentication.
- That the project follows a simple client-server model with a clear separation between presentation (frontend) and data management (backend and database).

##### Relevant Technologies and Frameworks
- PHP for server-side scripting.
- MySQL for the relational database management system.
- Bootstrap (from the CSS files) for a responsive and modern UI.
- XAMPP as the local development environment (Apache server and MySQL).

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Client (Browser)"
        direction TB
        C1["index.php"]:::frontend
        C2["login.php"]:::frontend
        C3["register.php"]:::frontend
        C4["profile.php"]:::frontend
        C5["logout.php"]:::frontend
        subgraph "Static Assets"
            direction TB
            C6["bootstrap.css"]:::static
            C7["style.css"]:::static
            C8["JavaScript Files"]:::static
        end
    end

    subgraph "Server (PHP Application)"
        direction TB
        S1["add_expense.php"]:::backend
        S2["change_password.php"]:::backend
        S3["expensereport.php"]:::backend
        S4["manage_expense.php"]:::backend
        S5["session.php"]:::backend
        S6["config.php"]:::backend
    end

    subgraph "Database (MySQL)"
        direction TB
        DB["PersonalExpenseTracker.sql"]:::db
    end

    subgraph "Static Resources"
        direction TB
        U["uploads"]:::resource
    end

    %% Client to Server interactions
    C2 -->|"UserAuthentication"| S5
    C1 -->|"SubmitExpense"| S1
    C4 -->|"ChangePassword"| S2

    %% Server to Database interactions
    S3 -->|"QueryExpenses"| DB
    DB -->|"ReturnData"| S3
    S1 -->|"InsertExpense"| DB
    DB -->|"ConfirmInsert"| S1
    S4 -->|"UpdateDeleteExpense"| DB
    DB -->|"OperationResult"| S4
    S5 -->|"ValidateSession"| DB
    DB -->|"UserData"| S5

    %% File upload interaction
    S1 -->|"UploadReceipt"| U

    %% Response flow from Server to Client (illustrative)
    S3 ---|"PageResponse"| C1

    %% Client loading static resources
    C8 ---|"LoadAssets"| C6
    C8 ---|"LoadAssets"| C7
    C8 ---|"AccessUploads"| U

    %% Click Events for Client Side (Frontend)
    click C1 "https://github.com/krishna17092004/personal-expense-tracker/blob/main/index.php"
    click C2 "https://github.com/krishna17092004/personal-expense-tracker/blob/main/login.php"
    click C3 "https://github.com/krishna17092004/personal-expense-tracker/blob/main/register.php"
    click C4 "https://github.com/krishna17092004/personal-expense-tracker/blob/main/profile.php"
    click C5 "https://github.com/krishna17092004/personal-expense-tracker/blob/main/logout.php"
    click C6 "https://github.com/krishna17092004/personal-expense-tracker/blob/main/css/bootstrap.css"
    click C7 "https://github.com/krishna17092004/personal-expense-tracker/blob/main/css/style.css"
    click C8 "https://github.com/krishna17092004/personal-expense-tracker/tree/main/js"

    %% Click Events for Server Side (Backend)
    click S1 "https://github.com/krishna17092004/personal-expense-tracker/blob/main/add_expense.php"
    click S2 "https://github.com/krishna17092004/personal-expense-tracker/blob/main/change_password.php"
    click S3 "https://github.com/krishna17092004/personal-expense-tracker/blob/main/expensereport.php"
    click S4 "https://github.com/krishna17092004/personal-expense-tracker/blob/main/manage_expense.php"
    click S5 "https://github.com/krishna17092004/personal-expense-tracker/blob/main/session.php"
    click S6 "https://github.com/krishna17092004/personal-expense-tracker/blob/main/config.php"

    %% Click Events for Database and File Uploads
    click DB "https://github.com/krishna17092004/personal-expense-tracker/blob/main/PersonalExpenseTracker.sql"
    click U "https://github.com/krishna17092004/personal-expense-tracker/tree/main/uploads"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef backend fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef db fill:#FFFFCC,stroke:#333,stroke-width:2px;
    classDef static fill:#F0E68C,stroke:#333,stroke-width:2px;
    classDef resource fill:#FFB6C1,stroke:#333,stroke-width:2px;
```
