# mandap360/hall-harmony-finance architecture

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

- Interactive diagram: https://gitdiagram.com/mandap360/hall-harmony-finance
- Repository: https://github.com/mandap360/hall-harmony-finance

## Overview

##### Project type and purpose
- This is a full-stack web application: a React/TypeScript single-page app (SPA) built with Vite, styled with Tailwind CSS and shadcn-ui, using Supabase as a Backend-as-a-Service (database + auth).
- Purpose: financial/accounting management (accounts, transactions, bookings, vendors, reports).

##### File structure
- Top-level:
- src/ holds the entire frontend code (App.tsx, pages/, components/, hooks/, integrations/, lib/).
- public/ for static assets (robots.txt, index.html).
- supabase/ contains Supabase config & migrations for the Postgres schema and DB functions.
- config files (tsconfig, vite.config.ts, tailwind.config.ts).
- Patterns:
- SPA with React Router (src/pages + ProtectedRoute).
- Component-driven UI (src/components + nested feature folders).
- Custom hooks for each data domain (useAccounts, useExpenses, etc.).
- BaaS integration in src/integrations/supabase/client.ts.

##### README for additional insights
- Stack: Vite, TS, React, shadcn-ui, Tailwind CSS.
- Deployment via Lovable (likely automates build + hosting).
- No explicit server beyond Supabase.

##### Detail
- Feature domains (Accounts, Bookings, Expenses, Reports).
- Integration layer (src/integrations/supabase/client.ts).
- Migrations folder as the source of schema truth.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer Tools
    subgraph "Developer Tools"
        VITE["Vite Dev Server"]:::dev
        NPM["npm Scripts"]:::dev
        SUP_CLI["Supabase CLI"]:::dev
    end

    %% Build & Deploy
    subgraph "Build & Deploy"
        VITE_BUILD["Vite Build"]:::dev
        HOSTING["Lovable / CDN"]:::external
    end

    %% Client Layer
    subgraph "Client (Browser)"
        BROWSER["Browser"]:::frontend
        STATIC["public/index.html & assets"]:::frontend
        MAIN["src/main.tsx"]:::frontend
        APP["src/App.tsx"]:::frontend
        PAGES["src/pages (Auth.tsx, Index.tsx, NotFound.tsx)"]:::frontend
        PROT["ProtectedRoute & AuthLayout"]:::frontend
        UI["src/components"]:::frontend
        FEAT_ACC["src/components/account"]:::frontend
        FEAT_BANK["src/components/banking"]:::frontend
        FEAT_BOOK["src/components/booking"]:::frontend
        FEAT_EXP["src/components/expense"]:::frontend
        FEAT_REP["src/components/reports"]:::frontend
        PRIMS["src/components/ui"]:::frontend
        HOOKS["src/hooks"]:::frontend
        SUP_CLIENT["src/integrations/supabase/client.ts"]:::backend
        SUP_TYPES["src/integrations/supabase/types.ts"]:::backend
    end

    %% Backend Layer
    subgraph "Backend (Supabase BaaS)"
        AUTH["Auth Service"]:::backend
        API["PostgREST & Realtime API"]:::backend
        DB["Postgres Database"]:::database
        MIGR["supabase/migrations/*.sql"]:::backend
        CONFIG["supabase/config.toml"]:::backend
    end

    %% External Services
    subgraph "External Services"
        OAUTH["OAuth / Email Provider"]:::external
    end

    %% Connections
    VITE -->|dev build| VITE_BUILD
    VITE_BUILD -->|deploy| HOSTING
    HOSTING -->|serves| STATIC
    STATIC -->|loads| BROWSER

    BROWSER -->|boots SPA| MAIN
    MAIN -->|renders| APP
    APP -->|routes| PAGES
    APP -->|guards| PROT
    APP -->|uses UI| UI
    UI --> FEAT_ACC
    UI --> FEAT_BANK
    UI --> FEAT_BOOK
    UI --> FEAT_EXP
    UI --> FEAT_REP
    UI --> PRIMS
    APP -->|data logic| HOOKS

    APP -->|calls| SUP_CLIENT
    SUP_CLIENT -->|types| SUP_TYPES
    SUP_CLIENT -->|HTTPS / WS| API
    API -->|SQL queries| DB
    AUTH -->|JWT| SUP_CLIENT
    AUTH -->|stores users| DB
    MIGR -->|schema & functions| DB
    CONFIG -->|settings| AUTH
    CONFIG -->|settings| API

    OAUTH -->|auth backend| AUTH
    BROWSER -->|HTTPS / WS| API

    %% Click Events
    click STATIC "https://github.com/mandap360/hall-harmony-finance/blob/main/public/index.html"
    click MAIN "https://github.com/mandap360/hall-harmony-finance/blob/main/src/main.tsx"
    click APP "https://github.com/mandap360/hall-harmony-finance/blob/main/src/App.tsx"
    click PAGES "https://github.com/mandap360/hall-harmony-finance/tree/main/src/pages"
    click PROT "https://github.com/mandap360/hall-harmony-finance/blob/main/src/components/ProtectedRoute.tsx"
    click PROT "https://github.com/mandap360/hall-harmony-finance/blob/main/src/components/AuthenticatedLayout.tsx"
    click UI "https://github.com/mandap360/hall-harmony-finance/tree/main/src/components"
    click FEAT_ACC "https://github.com/mandap360/hall-harmony-finance/tree/main/src/components/account"
    click FEAT_BANK "https://github.com/mandap360/hall-harmony-finance/tree/main/src/components/banking"
    click FEAT_BOOK "https://github.com/mandap360/hall-harmony-finance/tree/main/src/components/booking"
    click FEAT_EXP "https://github.com/mandap360/hall-harmony-finance/tree/main/src/components/expense"
    click FEAT_REP "https://github.com/mandap360/hall-harmony-finance/tree/main/src/components/reports"
    click PRIMS "https://github.com/mandap360/hall-harmony-finance/tree/main/src/components/ui"
    click HOOKS "https://github.com/mandap360/hall-harmony-finance/tree/main/src/hooks"
    click SUP_CLIENT "https://github.com/mandap360/hall-harmony-finance/blob/main/src/integrations/supabase/client.ts"
    click SUP_TYPES "https://github.com/mandap360/hall-harmony-finance/blob/main/src/integrations/supabase/types.ts"
    click CONFIG "https://github.com/mandap360/hall-harmony-finance/blob/main/supabase/config.toml"
    click MIGR "https://github.com/mandap360/hall-harmony-finance/blob/main/supabase/migrations/*.sql"
    click VITE "https://github.com/mandap360/hall-harmony-finance/blob/main/vite.config.ts"
    click NPM "https://github.com/mandap360/hall-harmony-finance/blob/main/package.json"

    %% Styles
    classDef frontend fill:#C3DDF9,stroke:#0366d6,color:#000;
    classDef backend fill:#FDE68A,stroke:#D97706,color:#000;
    classDef database fill:#E5E7EB,stroke:#6B7280,color:#000,stroke-dasharray: 5 5;
    classDef dev fill:#FBCFE8,stroke:#DB2777,color:#000;
    classDef external fill:#D1FAE5,stroke:#059669,color:#000;
```
