# timcooked/finora architecture

> Architecture diagram of the GitHub repository timcooked/finora, 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/timcooked/finora
- Repository: https://github.com/timcooked/finora

## Overview

##### Main Components
- Browser / Client: Where the React/Next.js app runs.
- Next.js Framework: Handles routing (App Router), SSR/SSG if any, and serves static assets.
- React Components:
- Layout & Routing (layout.jsx, page.jsx)
- Feature Modules (BudgetGoals, Calendar, Xlsx)
- Shared UI (Navbar, Dashboard, Chart, MoneyChart, Transactions, DateTransaction, MyCalendar, Xlsx)
- Context API (MoneyContext): Global state manager.
- LocalStorage: Persistent data store in the browser.
- Third‐Party Libraries: Recharts for charts, Tailwind CSS for styling.

##### Relationships & Data Flow
- On page load, Next.js serves the React app to the browser.
- The top‐level layout.jsx hydrates MoneyContext, which on init reads/writes LocalStorage.
- User interactions in UI components dispatch actions to the Context API.
- Context updates propagate state changes down the component tree.
- Persist state changes back into LocalStorage.
- Chart components subscribe to context for data and render via Recharts.
- Calendar, BudgetGoals, Xlsx pages each consume context and update state.

##### Architectural Patterns & Design Principles
- Component‐Based Architecture: Clear separation between feature pages and reusable components.
- Single Source of Truth: Context API centralizes state.
- Client‐Side Persistence: LocalStorage abstracts database concerns.
- Modular Design: Each directory under /app corresponds to a route with its own page.jsx and shared components.

##### Technologies & Frameworks to Call Out
- Next.js (App Router, SSR/SSG, static asset serving)
- React.js (JSX components, hooks)
- Context API (global state provider in context.js/MoneyContext.js)
- Recharts (Chart.jsx, MoneyChart.jsx)
- Tailwind CSS (globals.css, postcss.config.mjs)
- LocalStorage (window.localStorage)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Browser/Client Container
    subgraph "Browser / Client"
        direction TB
        subgraph "Next.js App"
            direction TB
            Layout["layout.jsx"]:::ui
            Page["page.jsx"]:::ui
        end
        subgraph "React Component Tree"
            direction TB
            MoneyContext["MoneyContext Provider"]:::state
            subgraph "Feature Module: BudgetGoals"
                direction TB
                BGPage["BudgetGoals Page"]:::ui
                BudgetGoalsComp["BudgetGoals"]:::ui
            end
            subgraph "Feature Module: Calendar"
                direction TB
                CalPage["Calendar Page"]:::ui
                MyCalendar["MyCalendar"]:::ui
                DateTransaction["DateTransaction"]:::ui
            end
            subgraph "Feature Module: Xlsx"
                direction TB
                XlsxPage["Xlsx Page"]:::ui
                XlsxComp["Xlsx"]:::ui
            end
            subgraph "Shared Components"
                direction TB
                Navbar["Navbar"]:::ui
                Dashboard["Dashboard"]:::ui
                Chart["Chart"]:::ui
                MoneyChart["MoneyChart"]:::ui
                Transactions["Transactions"]:::ui
            end
        end
    end

    %% External Frameworks & Persistence
    NextFW["Next.js Framework"]:::framework
    JsConfig["jsconfig.json"]:::framework
    PostCSS["postcss.config.mjs"]:::framework
    LocalStorage[(LocalStorage)]:::persist
    Recharts((Recharts)):::lib
    Tailwind((Tailwind CSS)):::lib

    %% Connections
    BrowserClient((User Browser)):::external -->|"loads App"| NextFW
    NextFW -->|"serves"| Layout
    NextFW -->|"serves"| Page
    Layout -->|"hydrates"| MoneyContext
    Page -->|"renders tree"| MoneyContext
    MoneyContext -->|"provides state"| Navbar
    MoneyContext -->|"provides state"| Dashboard
    MoneyContext -->|"provides state"| Chart
    MoneyContext -->|"provides state"| MoneyChart
    MoneyContext -->|"provides state"| Transactions
    MoneyContext -->|"provides state"| DateTransaction
    MoneyContext -->|"provides state"| MyCalendar
    MoneyContext -->|"provides state"| BudgetGoalsComp
    MoneyContext -->|"provides state"| XlsxComp
    Navbar -->|"dispatch action"| MoneyContext
    Dashboard -->|"dispatch action"| MoneyContext
    Chart -->|"dispatch action"| MoneyContext
    MoneyChart -->|"dispatch action"| MoneyContext
    Transactions -->|"dispatch action"| MoneyContext
    DateTransaction -->|"dispatch action"| MoneyContext
    MyCalendar -->|"dispatch action"| MoneyContext
    BudgetGoalsComp -->|"dispatch action"| MoneyContext
    XlsxComp -->|"dispatch action"| MoneyContext
    MoneyContext -->|"persist/load"| LocalStorage
    LocalStorage -->|"hydrate state"| MoneyContext

    Chart -->|"uses"| Recharts
    MoneyChart -->|"uses"| Recharts
    Layout -->|"styles via"| Tailwind
    Page -->|"styles via"| Tailwind

    %% Click Events
    click Layout "https://github.com/timcooked/finora/blob/main/app/layout.jsx"
    click Page "https://github.com/timcooked/finora/blob/main/app/page.jsx"
    click NextFW "https://github.com/timcooked/finora/blob/main/next.config.mjs"
    click JsConfig "https://github.com/timcooked/finora/blob/main/jsconfig.json"
    click PostCSS "https://github.com/timcooked/finora/blob/main/postcss.config.mjs"
    click BGPage "https://github.com/timcooked/finora/blob/main/app/BudgetGoals/page.jsx"
    click CalPage "https://github.com/timcooked/finora/blob/main/app/Calendar/page.jsx"
    click XlsxPage "https://github.com/timcooked/finora/blob/main/app/Xlsx/page.jsx"
    click Navbar "https://github.com/timcooked/finora/blob/main/app/components/Navbar.jsx"
    click Dashboard "https://github.com/timcooked/finora/blob/main/app/components/Dashboard.jsx"
    click Chart "https://github.com/timcooked/finora/blob/main/app/components/Chart.jsx"
    click MoneyChart "https://github.com/timcooked/finora/blob/main/app/components/MoneyChart.jsx"
    click Transactions "https://github.com/timcooked/finora/blob/main/app/components/Transactions.jsx"
    click DateTransaction "https://github.com/timcooked/finora/blob/main/app/components/DateTransaction.jsx"
    click MyCalendar "https://github.com/timcooked/finora/blob/main/app/components/MyCalendar.jsx"
    click XlsxComp "https://github.com/timcooked/finora/blob/main/app/components/Xlsx.jsx"
    click BudgetGoalsComp "https://github.com/timcooked/finora/blob/main/app/components/BudgetGoals.jsx"
    click MoneyContext "https://github.com/timcooked/finora/blob/main/app/context.js"
    click Globals "https://github.com/timcooked/finora/blob/main/app/globals.css"
    click Package "https://github.com/timcooked/finora/blob/main/package.json"
    click PackageLock "https://github.com/timcooked/finora/blob/main/package-lock.json"
    click ESLint "https://github.com/timcooked/finora/blob/main/eslint.config.mjs"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef state fill:#90EE90,stroke:#000,stroke-width:1px
    classDef persist fill:#D3D3D3,stroke:#000,stroke-width:1px
    classDef framework fill:#FFFF99,stroke:#000,stroke-width:1px
    classDef lib fill:#FFF0B3,stroke:#000,stroke-width:1px
    classDef external fill:#FFFFFF,stroke:#000,stroke-width:1px,stroke-dasharray: 5 5
```
