# manchanda-sumit/expense-tracker architecture

> Architecture diagram of the GitHub repository manchanda-sumit/expense-tracker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/manchanda-sumit/expense-tracker
- Repository: https://github.com/manchanda-sumit/expense-tracker

## Overview

1. This is a single-page React application built with Vite. The top-level runtime is the browser, with `src/main.jsx` bootstrapping `App.jsx`, and `src/routes/AppRoutes.jsx` handling navigation between screens.

2. The app is organized around three feature areas: authentication, dashboard, and transactions. Those live under `src/app/auth`, `src/app/dashboard`, and `src/app/transactions`, which is a strong signal that the codebase is structured by user-facing feature rather than by technical layer alone.

3. Authentication is separated into `Login.jsx` and `Register.jsx`. These are likely the public entry points for unauthenticated users, and they sit behind the routing layer rather than being embedded in the main dashboard shell.

4. `src/routes/ProtectedRoute.jsx` is the main access-control boundary. It likely guards dashboard and transaction routes so only authenticated users can enter the app’s internal workspace. That makes routing a key architectural seam in this repo.

5. The dashboard area appears to be the authenticated home experience, with `Home.jsx` as the landing page. The `src/pre-made-components` directory contains dashboard-oriented reusable widgets such as `DashboardStatCard`, `MonthlyExpenseBreakdown`, `Payments`, and `TransactionHistory`, suggesting the dashboard is composed from multiple data-driven cards and summary panels.

6. Transactions are modeled as a dedicated feature with its own page and modal. `Transactions.jsx` likely owns listing and orchestration, while `components/TransactionModal.jsx` handles create/edit/detail interactions. That indicates a page-plus-dialog pattern around transaction management.

7. The shared UI layer lives in `src/components`. It includes generic controls like `CustomButton`, `CustomInput`, `CustomSelect`, plus shell/navigation pieces like `Header`, `Sidebar`, `Layout`, `NavItem`, and a generic `Modal`. This is the app’s presentation boundary: reusable, feature-agnostic UI versus feature-specific screens.

8. The application shell is probably `Layout` + `Header` + `Sidebar`, used after login to wrap dashboard and transaction pages. This is the main visual structure for the authenticated portion of the app, and it likely carries navigation state and page framing.

9. Data access is centralized in `src/config/axios.js` and `src/hooks/useFetch.jsx`. That suggests the app talks to an external backend via HTTP, with axios configured once and a custom fetching hook abstracting request state and side effects. Any API boundary should be drawn outside the React UI, through these two pieces.

10. Cross-cutting helpers live in `src/constants/constants.js` and `src/utils/utils.js`. These are likely used for shared labels, formatting, validation, or other app-wide logic that should not live inside feature pages.

11. The asset pipeline is minimal and focused, with branding under `src/assets/images/logo`. That reinforces that visual identity is handled inside the app bundle rather than through a separate asset service.

12. Tooling is the standard Vite + React stack, with ESLint configured in `eslint.config.js` and the build/dev setup in `vite.config.js`. There is no evidence of server-side rendering, state management libraries, or a separate backend repo in this tree, so the architecture should be diagrammed as a client-side React SPA that consumes external HTTP APIs.

Main entry points: [`src/components/Layout.jsx`](https://github.com/manchanda-sumit/expense-tracker/blob/master/src/components/Layout.jsx) (Layout), [`src/routes/AppRoutes.jsx`](https://github.com/manchanda-sumit/expense-tracker/blob/master/src/routes/AppRoutes.jsx) (Routes), [`src/app/dashboard/Home.jsx`](https://github.com/manchanda-sumit/expense-tracker/blob/master/src/app/dashboard/Home.jsx) (Home), [`src/app/transactions/Transactions.jsx`](https://github.com/manchanda-sumit/expense-tracker/blob/master/src/app/transactions/Transactions.jsx) (Transactions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime & shell"]
  node_browser(("Browser<br/>runtime"))
  node_main["main<br/>bootstrap<br/>[main.jsx]"]
  node_app["App<br/>root component<br/>[App.jsx]"]
  node_routes["Routes<br/>navigation<br/>[AppRoutes.jsx]"]
  node_protected["Protected<br/>route guard<br/>[ProtectedRoute.jsx]"]
end

subgraph group_features["Feature areas"]
  node_login["Login<br/>auth screen<br/>[Login.jsx]"]
  node_register["Register<br/>auth screen<br/>[Register.jsx]"]
  node_dashboard["Home<br/>dashboard screen<br/>[Home.jsx]"]
  node_transactions["Transactions<br/>feature page<br/>[Transactions.jsx]"]
  node_txmodal["Txn modal<br/>transaction dialog"]
end

subgraph group_shared["Shared UI"]
  node_layout["Layout<br/>app shell<br/>[Layout.jsx]"]
  node_header["Header<br/>shell ui<br/>[Header.jsx]"]
  node_sidebar["Sidebar<br/>navigation ui<br/>[Sidebar.jsx]"]
  node_controls["Controls<br/>form ui"]
  node_modal["Modal<br/>ui primitive<br/>[Modal.jsx]"]
  node_widgets["Dashboard widgets<br/>summary widgets"]
end

subgraph group_data["Data & support"]
  node_axios["Axios client<br/>http config<br/>[axios.js]"]
  node_fetch["useFetch<br/>data hook<br/>[useFetch.jsx]"]
  node_constants["Constants<br/>shared config<br/>[constants.js]"]
  node_utils["Utils<br/>helpers<br/>[utils.js]"]
end

node_browser -->|"loads"| node_main
node_main -->|"mounts"| node_app
node_app -->|"renders"| node_routes
node_routes -->|"public"| node_login
node_routes -->|"public"| node_register
node_routes -->|"guards"| node_protected
node_protected -->|"wraps"| node_layout
node_layout -->|"includes"| node_header
node_layout -->|"includes"| node_sidebar
node_layout -->|"shows"| node_dashboard
node_layout -->|"shows"| node_transactions
node_dashboard -->|"composes"| node_widgets
node_transactions -->|"opens"| node_txmodal
node_txmodal -->|"uses"| node_modal
node_login -->|"auth api"| node_axios
node_register -->|"auth api"| node_axios
node_dashboard -->|"loads data"| node_fetch
node_transactions -->|"loads data"| node_fetch
node_axios -->|"uses"| node_constants
node_fetch -->|"uses"| node_utils
node_controls -->|"supports"| node_login
node_controls -->|"supports"| node_register
node_controls -->|"supports"| node_txmodal
node_sidebar -->|"navigates"| node_routes

click node_main "https://github.com/manchanda-sumit/expense-tracker/blob/master/src/main.jsx"
click node_app "https://github.com/manchanda-sumit/expense-tracker/blob/master/src/App.jsx"
click node_routes "https://github.com/manchanda-sumit/expense-tracker/blob/master/src/routes/AppRoutes.jsx"
click node_protected "https://github.com/manchanda-sumit/expense-tracker/blob/master/src/routes/ProtectedRoute.jsx"
click node_login "https://github.com/manchanda-sumit/expense-tracker/blob/master/src/app/auth/Login.jsx"
click node_register "https://github.com/manchanda-sumit/expense-tracker/blob/master/src/app/auth/Register.jsx"
click node_dashboard "https://github.com/manchanda-sumit/expense-tracker/blob/master/src/app/dashboard/Home.jsx"
click node_transactions "https://github.com/manchanda-sumit/expense-tracker/blob/master/src/app/transactions/Transactions.jsx"
click node_txmodal "https://github.com/manchanda-sumit/expense-tracker/blob/master/src/app/transactions/components/TransactionModal.jsx"
click node_layout "https://github.com/manchanda-sumit/expense-tracker/blob/master/src/components/Layout.jsx"
click node_header "https://github.com/manchanda-sumit/expense-tracker/blob/master/src/components/Header.jsx"
click node_sidebar "https://github.com/manchanda-sumit/expense-tracker/blob/master/src/components/Sidebar.jsx"
click node_modal "https://github.com/manchanda-sumit/expense-tracker/blob/master/src/components/Modal.jsx"
click node_axios "https://github.com/manchanda-sumit/expense-tracker/blob/master/src/config/axios.js"
click node_fetch "https://github.com/manchanda-sumit/expense-tracker/blob/master/src/hooks/useFetch.jsx"
click node_constants "https://github.com/manchanda-sumit/expense-tracker/blob/master/src/constants/constants.js"
click node_utils "https://github.com/manchanda-sumit/expense-tracker/blob/master/src/utils/utils.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_browser,node_main,node_app,node_routes,node_protected toneBlue
class node_login,node_register,node_dashboard,node_transactions,node_txmodal toneAmber
class node_layout,node_header,node_sidebar,node_controls,node_modal,node_widgets toneMint
class node_axios,node_fetch,node_constants,node_utils toneRose
```

## Components

### Runtime & shell

Browser entrypoint and authenticated app shell

- **Browser**: runtime · Client-side execution environment
- [main](https://github.com/manchanda-sumit/expense-tracker/blob/master/src/main.jsx): bootstrap · Vite entry that mounts the React app · `src/main.jsx`
- [App](https://github.com/manchanda-sumit/expense-tracker/blob/master/src/App.jsx): root component · Top-level application component · `src/App.jsx`
- [Routes](https://github.com/manchanda-sumit/expense-tracker/blob/master/src/routes/AppRoutes.jsx): navigation · Screen routing and navigation boundaries · `src/routes/AppRoutes.jsx`
- [Protected](https://github.com/manchanda-sumit/expense-tracker/blob/master/src/routes/ProtectedRoute.jsx): route guard · Access control for authenticated areas · `src/routes/ProtectedRoute.jsx`

### Feature areas

User-facing screens and workflow areas

- [Login](https://github.com/manchanda-sumit/expense-tracker/blob/master/src/app/auth/Login.jsx): auth screen · Public sign-in screen · `src/app/auth/Login.jsx`
- [Register](https://github.com/manchanda-sumit/expense-tracker/blob/master/src/app/auth/Register.jsx): auth screen · Public account creation screen · `src/app/auth/Register.jsx`
- [Home](https://github.com/manchanda-sumit/expense-tracker/blob/master/src/app/dashboard/Home.jsx): dashboard screen · Authenticated landing page · `src/app/dashboard/Home.jsx`
- [Transactions](https://github.com/manchanda-sumit/expense-tracker/blob/master/src/app/transactions/Transactions.jsx): feature page · Transaction list and orchestration page · `src/app/transactions/Transactions.jsx`
- [Txn modal](https://github.com/manchanda-sumit/expense-tracker/blob/master/src/app/transactions/components/TransactionModal.jsx): transaction dialog · Create/edit/detail modal for transactions · `src/app/transactions/components/TransactionModal.jsx`

### Shared UI

Reusable presentation components

- [Layout](https://github.com/manchanda-sumit/expense-tracker/blob/master/src/components/Layout.jsx): app shell · Authenticated page frame and composition · `src/components/Layout.jsx`
- [Header](https://github.com/manchanda-sumit/expense-tracker/blob/master/src/components/Header.jsx): shell ui · Top navigation and page header · `src/components/Header.jsx`
- [Sidebar](https://github.com/manchanda-sumit/expense-tracker/blob/master/src/components/Sidebar.jsx): navigation ui · Primary authenticated navigation · `src/components/Sidebar.jsx`
- **Controls**: form ui · Reusable input and action controls
- [Modal](https://github.com/manchanda-sumit/expense-tracker/blob/master/src/components/Modal.jsx): ui primitive · Generic dialog container · `src/components/Modal.jsx`
- **Dashboard widgets**: summary widgets · Reusable dashboard summary cards and panels

### Data & support

HTTP access and cross-cutting helpers

- [Axios client](https://github.com/manchanda-sumit/expense-tracker/blob/master/src/config/axios.js): http config · Central HTTP client configuration · `src/config/axios.js`
- [useFetch](https://github.com/manchanda-sumit/expense-tracker/blob/master/src/hooks/useFetch.jsx): data hook · Shared request state and side effects · `src/hooks/useFetch.jsx`
- [Constants](https://github.com/manchanda-sumit/expense-tracker/blob/master/src/constants/constants.js): shared config · App-wide labels and fixed values · `src/constants/constants.js`
- [Utils](https://github.com/manchanda-sumit/expense-tracker/blob/master/src/utils/utils.js): helpers · Shared helper functions · `src/utils/utils.js`

## Connections

- Browser → main: loads · Browser loads the SPA entrypoint
- main → App: mounts · Bootstraps the root React component
- App → Routes: renders · App delegates screen selection to routing
- Routes → Login: public · Unauthenticated access to sign-in
- Routes → Register: public · Unauthenticated access to registration
- Routes → Protected: guards · Protected branch for authenticated workspace
- Protected → Layout: wraps · Authenticated routes are framed by the app shell
- Layout → Header: includes · Shell includes top header
- Layout → Sidebar: includes · Shell includes primary navigation
- Layout → Home: shows · Default authenticated home screen
- Layout → Transactions: shows · Shell hosts transaction management page
- Home → Dashboard widgets: composes · Home dashboard is built from summary widgets
- Transactions → Txn modal: opens · Transaction page uses dialog for record actions
- Txn modal → Modal: uses · Modal dialog primitive underpins transaction editing
- Login → Axios client: auth api · Authentication screens submit via HTTP client
- Register → Axios client: auth api · Account creation uses shared HTTP client
- Home → useFetch: loads data · Dashboard panels pull data through shared fetch logic
- Transactions → useFetch: loads data · Transaction listing and mutations use fetch hook
- Axios client → Constants: uses · HTTP and request behavior rely on shared constants
- useFetch → Utils: uses · Fetch hook relies on shared helper logic
- Controls → Login: supports · Form controls support auth screens
- Controls → Register: supports · Form controls support auth screens
- Controls → Txn modal: supports · Reusable inputs and selects support transaction dialog
- Sidebar → Routes: navigates · Navigation links route between feature areas
