# bitflowcode/gestordegastos architecture

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

- Interactive diagram: https://gitdiagram.com/bitflowcode/gestordegastos
- Repository: https://github.com/bitflowcode/gestordegastos

## Overview

##### Project type and purpose
- This is a Next.js full-stack (mostly frontend-centric) web application using the App Router (app/ directory).
- Purpose: an expense-tracking UI that lets users input, view, and export expense data (e.g., via jsPDF), with theming support and a collection of reusable UI components.

##### File structure
- Top-level config: next.config.js, tailwind.config.ts, postcss.config.mjs, eslint.config.mjs, tsconfig.json
- Public static assets: /public
- Application entry (App Router): /src/app
- layout.tsx (theme-provider, global CSS)
- page.tsx (home/dashboard)
- globals.css (base styling)
- UI component library: /src/components/ui (atomic components: Button, Input, Table, etc.)
- Cross-cutting component: /src/components/theme-provider.tsx
- Domain-specific components: expense-card, expense-form, expense-history, settings-view
- Hooks for state/data-logic: /src/hooks/use-expenses.ts
- Utility functions: /src/lib/utils.ts
- Type definitions for libraries: /src/types/jspdf.d.ts

##### README for technical stack
- Next.js (React, server & client components)
- TypeScript
- Tailwind CSS & PostCSS
- Vercel deployment

##### Main components and relationships
a. Next.js Server Layer (app/)
- layout.tsx: applies theme, global styles
- page.tsx: server-rendered page shell
b. React Client Components
- UI primitives (Button, Input, Table, etc.)
- Domain widgets (ExpenseForm, ExpenseCard, ExpenseHistory)
- ThemeToggle, AlertDialog, Toast, etc.
c. State/Data Layer
- useExpenses hook: manages in-memory expense state and persistence (e.g., localStorage or API)
- lib/utils.ts: PDF generation via jsPDF; any data-transformation helpers
d. Public Assets
- Static images, fonts in /public
e. Build & Deployment
- Next.js build pipeline (Webpack/RSC)
- Tailwind/PostCSS plugin
- ESLint, TypeScript checks
- Hosted on Vercel

##### Architectural patterns & principles
- Component-based / Atomic design: primitive vs. composite UI elements
- Separation of concerns: presentation (UI comps) vs. logic (hooks, utils)
- App Router with server components for layout and SEO
- Single page app interactions for expense management

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Next.js Server Layer
    subgraph "Next.js Server Layer"
        direction TB
        NLAYOUT["layout.tsx"]:::server
        NPAGE["page.tsx"]:::server
        NGLOBALCSS["globals.css"]:::server
    end

    %% Client Components
    subgraph "Client Components"
        direction TB
        TP["theme-provider.tsx"]:::client

        subgraph "UI Library"
            direction TB
            ALERT["alert-dialog.tsx"]:::client
            BUTTON["button.tsx"]:::client
            CALENDAR["calendar.tsx"]:::client
            CARD["card.tsx"]:::client
            CHART["chart.tsx"]:::client
            DROPDOWN["dropdown-menu.tsx"]:::client
            FORMUI["form.tsx"]:::client
            INPUT["input.tsx"]:::client
            LABEL["label.tsx"]:::client
            POPOVER["popover.tsx"]:::client
            SELECT["select.tsx"]:::client
            SHEET["sheet.tsx"]:::client
            SWITCH["switch.tsx"]:::client
            TABLE["table.tsx"]:::client
            TABS["tabs.tsx"]:::client
            TEXTAREA["textarea.tsx"]:::client
            THEMETOGGLE["theme-toggle.tsx"]:::client
            TOAST["toast.tsx"]:::client
            TOASTER["toaster.tsx"]:::client
            USET["use-toast.ts"]:::client
        end

        subgraph "Domain Widgets"
            direction TB
            ECARD["expense-card.tsx"]:::client
            EFORM["expense-form.tsx"]:::client
            EHISTORY["expense-history.tsx"]:::client
            SETVIEW["settings-view.tsx"]:::client
        end
    end

    %% State & Data Layer
    HOOK["use-expenses.ts"]:::data
    UTIL["utils.ts"]:::data
    TYPES["jspdf.d.ts"]:::data
    PERSIST["localStorage / External API"]:::data

    %% Public Assets
    PUB["Public Assets"]:::infra

    %% Build & Deployment
    subgraph "Build & Deployment"
        direction TB
        NEXTCFG["next.config.js"]:::infra
        TAILWIND["tailwind.config.ts"]:::infra
        POSTCSS["postcss.config.mjs"]:::infra
        ESLINTCFG["eslint.config.mjs"]:::infra
        TSCFG["tsconfig.json"]:::infra
        VERCEL["Vercel"]:::infra
    end

    %% Relationships
    NLAYOUT -->|"renders" | TP
    NPAGE -->|"initial HTML/CSS" | ALERT
    NPAGE -->|"initial HTML/CSS" | ECARD

    ALERT & BUTTON & CALENDAR & CARD & CHART & DROPDOWN & FORMUI & INPUT & LABEL & POPOVER & SELECT & SHEET & SWITCH & TABLE & TABS & TEXTAREA & THEMETOGGLE & TOAST & TOASTER & USET --> HOOK
    ECARD & EFORM & EHISTORY & SETVIEW --> HOOK
    TP --> ALERT

    HOOK -->|"generate PDF" | UTIL
    HOOK -->|"persist/retrieve" | PERSIST
    PERSIST -->|"hydrate" | HOOK

    NEXTCFG & TAILWIND & POSTCSS & ESLINTCFG & TSCFG -->|"build step"| NLAYOUT
    NEXTCFG & TAILWIND & POSTCSS & ESLINTCFG & TSCFG -->|"build step"| NPAGE
    NEXTCFG & TAILWIND & POSTCSS & ESLINTCFG & TSCFG -->|"build step"| NGLOBALCSS
    NEXTCFG & TAILWIND & POSTCSS & ESLINTCFG & TSCFG --> VERCEL

    VERCEL --> NLAYOUT

    PUB --> NPAGE

    %% Click Events
    click NLAYOUT "https://github.com/bitflowcode/gestordegastos/blob/main/src/app/layout.tsx"
    click NPAGE "https://github.com/bitflowcode/gestordegastos/blob/main/src/app/page.tsx"
    click NGLOBALCSS "https://github.com/bitflowcode/gestordegastos/blob/main/src/app/globals.css"
    click TP "https://github.com/bitflowcode/gestordegastos/blob/main/src/components/theme-provider.tsx"
    click ALERT "https://github.com/bitflowcode/gestordegastos/blob/main/src/components/ui/alert-dialog.tsx"
    click BUTTON "https://github.com/bitflowcode/gestordegastos/blob/main/src/components/ui/button.tsx"
    click CALENDAR "https://github.com/bitflowcode/gestordegastos/blob/main/src/components/ui/calendar.tsx"
    click CARD "https://github.com/bitflowcode/gestordegastos/blob/main/src/components/ui/card.tsx"
    click CHART "https://github.com/bitflowcode/gestordegastos/blob/main/src/components/ui/chart.tsx"
    click DROPDOWN "https://github.com/bitflowcode/gestordegastos/blob/main/src/components/ui/dropdown-menu.tsx"
    click FORMUI "https://github.com/bitflowcode/gestordegastos/blob/main/src/components/ui/form.tsx"
    click INPUT "https://github.com/bitflowcode/gestordegastos/blob/main/src/components/ui/input.tsx"
    click LABEL "https://github.com/bitflowcode/gestordegastos/blob/main/src/components/ui/label.tsx"
    click POPOVER "https://github.com/bitflowcode/gestordegastos/blob/main/src/components/ui/popover.tsx"
    click SELECT "https://github.com/bitflowcode/gestordegastos/blob/main/src/components/ui/select.tsx"
    click SHEET "https://github.com/bitflowcode/gestordegastos/blob/main/src/components/ui/sheet.tsx"
    click SWITCH "https://github.com/bitflowcode/gestordegastos/blob/main/src/components/ui/switch.tsx"
    click TABLE "https://github.com/bitflowcode/gestordegastos/blob/main/src/components/ui/table.tsx"
    click TABS "https://github.com/bitflowcode/gestordegastos/blob/main/src/components/ui/tabs.tsx"
    click TEXTAREA "https://github.com/bitflowcode/gestordegastos/blob/main/src/components/ui/textarea.tsx"
    click THEMETOGGLE "https://github.com/bitflowcode/gestordegastos/blob/main/src/components/ui/theme-toggle.tsx"
    click TOAST "https://github.com/bitflowcode/gestordegastos/blob/main/src/components/ui/toast.tsx"
    click TOASTER "https://github.com/bitflowcode/gestordegastos/blob/main/src/components/ui/toaster.tsx"
    click USET "https://github.com/bitflowcode/gestordegastos/blob/main/src/components/ui/use-toast.ts"
    click ECARD "https://github.com/bitflowcode/gestordegastos/blob/main/src/components/ui/expense-card.tsx"
    click EFORM "https://github.com/bitflowcode/gestordegastos/blob/main/src/components/ui/expense-form.tsx"
    click EHISTORY "https://github.com/bitflowcode/gestordegastos/blob/main/src/components/ui/expense-history.tsx"
    click SETVIEW "https://github.com/bitflowcode/gestordegastos/blob/main/src/components/ui/settings-view.tsx"
    click HOOK "https://github.com/bitflowcode/gestordegastos/blob/main/src/hooks/use-expenses.ts"
    click UTIL "https://github.com/bitflowcode/gestordegastos/blob/main/src/lib/utils.ts"
    click TYPES "https://github.com/bitflowcode/gestordegastos/blob/main/src/types/jspdf.d.ts"
    click PUB "https://github.com/bitflowcode/gestordegastos/tree/main/public/"
    click NEXTCFG "https://github.com/bitflowcode/gestordegastos/blob/main/next.config.js"
    click TAILWIND "https://github.com/bitflowcode/gestordegastos/blob/main/tailwind.config.ts"
    click POSTCSS "https://github.com/bitflowcode/gestordegastos/blob/main/postcss.config.mjs"
    click ESLINTCFG "https://github.com/bitflowcode/gestordegastos/blob/main/eslint.config.mjs"
    click TSCFG "https://github.com/bitflowcode/gestordegastos/blob/main/tsconfig.json"

    %% Styles
    classDef server fill:#ddeeff,stroke:#000,stroke-width:1px;
    classDef client fill:#ddffdd,stroke:#000,stroke-width:1px;
    classDef data fill:#ffe4b5,stroke:#000,stroke-width:1px;
    classDef infra fill:#dddddd,stroke:#000,stroke-width:1px;
```
