# bankoledo/finance-flow architecture

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

- Interactive diagram: https://gitdiagram.com/bankoledo/finance-flow
- Repository: https://github.com/bankoledo/finance-flow

## Overview

##### Project type and purpose
- This is a full-stack, single-page application for personal finance management.
- Frontend: React 18 + Vite + Tailwind CSS, deployed on Vercel.
- Backend: Supabase as BaaS (Auth, PostgreSQL database, real-time subscriptions, RLS policies).

##### File structure
- Top-level:
- public/ (static assets)
- src/ (application code)
- scripts/setup-db.js (initial database schema)
- config files (vite.config.js, tailwind.config.js, postcss.config.js, eslint.config.js)
- src/ subdivided into:
- components/ (UI, layout, landing, analytics, settings, transactions)
- contexts/ (AuthContext)
- hooks/ (useDataManager)
- lib/ (supabase client wrapper)
- pages/ (public vs protected “app” pages)
- main.jsx / App.jsx (entry points)

##### README insights
- Tech stack and feature list.
- Supabase SQL schema with RLS.
- Supabase Authentication + Brevo for email.
- Deployment on Vercel.

a. Main components
1. Client Browser (React SPA)
2. Vercel CDN / Hosting
3. Supabase Auth (Auth UI + JWT)
4. Supabase PostgreSQL Database (tables: profiles, categories, transactions, budgets)
5. Supabase Real-time (subscriptions for live data updates)
6. Brevo Email Service (for email verification & notifications)
7. Optional: local development (Vite dev server)
b. Relationships & interactions
- Browser ↔ Vercel: HTTP(S) requests to fetch static assets.
- Browser ↔ Supabase Auth: signup, login, token exchange via supabase-js.
- Browser ↔ Supabase DB: authenticated REST and real-time GraphQL/WS calls.
- Supabase DB ↔ RLS policies enforce per-user data access.
- Browser → Brevo via serverless function or Supabase Edge Functions (for sending emails).
c. Architectural patterns
- SPA architecture with client-side routing (React Router).
- Component-driven design (atomic UI in components/ui, layout wrappers).
- Context API for global auth state.
- Hook abstraction (useDataManager) for API calls.
- BaaS pattern: no custom backend servers.
d. Key technologies
- React+Vite (front-end), Tailwind CSS, Framer Motion, Lucide.
- supabase-js SDK for Auth & Database.
- PostgreSQL with RLS on Supabase.
- Brevo for email.
- Vercel for hosting & CI/CD.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Client Layer
    subgraph "Client"
        direction TB
        Browser["Client Browser (React SPA)"]:::frontend
        subgraph "React SPA"
            direction TB
            Entry["Entry Points\n(index.html, main.jsx, App.jsx)"]:::frontend
            Routes["React Router & Route Guards"]:::frontend
            UIlib["UI Component Library"]:::frontend
            Layout["Layout Components"]:::frontend
            Landing["Landing Pages"]:::frontend
            PublicAuth["Public Auth Pages"]:::frontend
            AuthContext["Auth Context & State Management"]:::frontend
            DataHook["useDataManager Hook"]:::frontend
        end
    end

    %% Hosting
    Browser -->|"HTTP(S) Static Assets"| Vercel["Vercel CDN / Hosting"]:::frontend

    %% BaaS Services
    subgraph "Backend Services (BaaS)"
        direction TB
        Auth["Supabase Auth (Auth UI + JWT)"]:::baas
        DB["Supabase PostgreSQL Database\n(Tables: profiles, categories, transactions, budgets)"]:::baas
        Realtime["Supabase Real-time Subscriptions"]:::baas
        Policies["RLS Policies & Schema Setup"]:::baas
    end

    %% External Service
    Brevo["Brevo Email Service"]:::external

    %% Data Flows
    Browser -->|"supabase-js REST"| Auth
    Browser -->|"supabase-js REST"| DB
    Browser -->|"supabase-js WS"| Realtime
    DB -->|"enforced by"| Policies
    Browser -->|"Serverless Function / Edge Fn"| Brevo

    %% Click Events
    click Browser "https://github.com/bankoledo/finance-flow/tree/main/src/"
    click Vercel "https://github.com/bankoledo/finance-flow/blob/main/vercel.json"
    click Entry "https://github.com/bankoledo/finance-flow/blob/main/index.html"
    click Entry "https://github.com/bankoledo/finance-flow/blob/main/src/main.jsx"
    click Entry "https://github.com/bankoledo/finance-flow/blob/main/src/App.jsx"
    click Routes "https://github.com/bankoledo/finance-flow/blob/main/src/components/ProtectedRoute.jsx"
    click UIlib "https://github.com/bankoledo/finance-flow/tree/main/src/components/ui/"
    click Layout "https://github.com/bankoledo/finance-flow/tree/main/src/components/layout/"
    click Landing "https://github.com/bankoledo/finance-flow/tree/main/src/components/landing/"
    click Landing "https://github.com/bankoledo/finance-flow/blob/main/src/pages/public/Home.jsx"
    click PublicAuth "https://github.com/bankoledo/finance-flow/blob/main/src/pages/public/Signup.jsx"
    click PublicAuth "https://github.com/bankoledo/finance-flow/blob/main/src/pages/public/Login.jsx"
    click PublicAuth "https://github.com/bankoledo/finance-flow/blob/main/src/pages/public/EmailConfirmation.jsx"
    click PublicAuth "https://github.com/bankoledo/finance-flow/blob/main/src/pages/public/ResetPassword.jsx"
    click AuthContext "https://github.com/bankoledo/finance-flow/blob/main/src/contexts/AuthContext.jsx"
    click DataHook "https://github.com/bankoledo/finance-flow/blob/main/src/hooks/useDataManager.js"
    click Policies "https://github.com/bankoledo/finance-flow/blob/main/scripts/setup-db.js"

    %% Styles
    classDef frontend fill:#E0F2FE,stroke:#0369A1,color:#0369A1
    classDef baas fill:#ECFDF5,stroke:#10B981,color:#065F46
    classDef external fill:#FFF7ED,stroke:#F97316,color:#9A3412
```
