# hardiksjain/finplan360 architecture

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

- Interactive diagram: https://gitdiagram.com/hardiksjain/finplan360
- Repository: https://github.com/hardiksjain/finplan360

## Overview

##### Project Type and Purpose
- This is a full-stack mobile application where the mobile frontend (developed in Flutter) communicates with a Django backend.
- Its primary purpose is to help users track expenses by scanning debit/credit SMS messages, categorizing and visualizing their expenses, and providing tour recommendations based on spending habits.

##### Main Architectural Components
- Frontend (Mobile App):
- Built using Flutter, with separate folders for Android, iOS, web, macos, linux, and windows.
- Contains modular pages such as login, registration, home, profile, and expense pages.
- Handles SMS fetching, expense categorization, pie chart visualization, and tour recommendations.
- Backend (Server):
- Built using Django (files and folders such as manage.py, settings.py, urls.py, models.py, views.py, and serializers.py).
- Provides RESTful APIs to handle user authentication, registration, expense data processing, and possibly sending recommendations.
- Contains migration scripts to set up the database schema.
- Database:
- Uses SQLite (db.sqlite3) for data persistence (user accounts, expense transactions, etc.).
- Additional Data/Service:
- A dataset folder containing a travel_packages.csv file to support tour recommendation logic.
- External mobile SMS integration (for fetching and analyzing debit messages).

##### Relationships and Interactions
- The mobile app provides a user interface where users register, log in, and manage their finances.
- User actions (login, fetching SMS data, expense categorization) trigger API calls from the Flutter frontend to the Django backend.
- The backend processes these requests, interacts with its SQLite database, and, when needed, uses the travel packages CSV data to generate tour recommendations.

##### Architectural Patterns and Design Principles
- The Django backend follows the MTV (Model–Template–View) pattern with clearly separated models, views, and serializers for API endpoints.
- The Flutter frontend is organized into distinct modules (pages and components) that manage presentation and business logic separately.
- The design follows a clear separation of concerns: presentation (frontend) vs. business logic/data handling (backend).
- Using migration files indicates a versioned and controlled evolution of the database schema.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Subgraph
    subgraph "Mobile App (Flutter)"
        Pages["Mobile App Pages"]:::frontend
        UIComponents["UI Components"]:::frontend
        AppConstants["App Constants"]:::frontend
    end

    %% Backend Subgraph
    subgraph "Django Backend"
        subgraph "API Layer"
            Views["Views"]:::backend
            APIURLs["API URLs"]:::backend
        end
        subgraph "Business Logic"
            Models["Models"]:::backend
            Serializers["Serializers"]:::backend
        end
        CoreConfig["Core Config"]:::backend
        DBMigrations["DB Migrations"]:::backend
    end

    %% External Components
    Database["Database (SQLite)"]:::database
    Dataset["Tour Recommendation Dataset"]:::dataset

    %% Connections - Frontend Internal
    Pages -->|"uses"| UIComponents
    Pages -->|"uses"| AppConstants

    %% Connections - Frontend to Backend
    Pages -->|"REST_call"| Views

    %% Connections - Backend Internal
    CoreConfig -->|"configures"| Views
    CoreConfig -->|"configures"| APIURLs

    Views -->|"processes"| Models
    APIURLs -->|"routes_to"| Views
    Models -->|"serializes_using"| Serializers

    %% Connections - Backend to Database
    Models -->|"read/write"| Database
    DBMigrations -->|"migrates"| Database

    %% Connection - Tour Recommendation
    Models -->|"tour_recommendation"| Dataset

    %% Click Events for Frontend
    click Pages "https://github.com/hardiksjain/finplan360/tree/master/finplan360_frontend/lib/pages"
    click UIComponents "https://github.com/hardiksjain/finplan360/tree/master/finplan360_frontend/lib/components"
    click AppConstants "https://github.com/hardiksjain/finplan360/tree/master/finplan360_frontend/lib/constants"

    %% Click Events for Django API Endpoints
    click Views "https://github.com/hardiksjain/finplan360/blob/master/finplan360_backend/app_finplan360/views.py"
    click APIURLs "https://github.com/hardiksjain/finplan360/blob/master/finplan360_backend/app_finplan360/urls.py"

    %% Click Events for Django Business Logic
    click Models "https://github.com/hardiksjain/finplan360/blob/master/finplan360_backend/app_finplan360/models.py"
    click Serializers "https://github.com/hardiksjain/finplan360/blob/master/finplan360_backend/app_finplan360/serializers.py"

    %% Click Event for Django Core Config
    click CoreConfig "https://github.com/hardiksjain/finplan360/blob/master/finplan360_backend/finplan360_backend/settings.py"

    %% Click Event for Database Migrations
    click DBMigrations "https://github.com/hardiksjain/finplan360/tree/master/finplan360_backend/app_finplan360/migrations"

    %% Click Event for Database
    click Database "https://github.com/hardiksjain/finplan360/blob/master/finplan360_backend/db.sqlite3"

    %% Click Event for Tour Recommendation Dataset
    click Dataset "https://github.com/hardiksjain/finplan360/blob/master/finplan360_backend/dataset/travel_packages.csv"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef backend fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef database fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;
    classDef dataset fill:#fff3cd,stroke:#856404,stroke-width:2px;
```
