# whitechapel007/invoice-test architecture

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

- Interactive diagram: https://gitdiagram.com/whitechapel007/invoice-test
- Repository: https://github.com/whitechapel007/invoice-test

## Overview

This is a React invoice-management app: users authenticate, enter a protected dashboard, review invoice statistics, recent invoices and activities, and create invoices. The UI uses React Query queries/mutations over an Axios client to Netlify function endpoints; Firebase Auth supplies identity. README capabilities such as payment tracking, customer details, and invoice actions are represented where documented, but unsampled implementations are not inferred beyond their visible components. The sampled evidence does not establish the functions’ persistence mechanism or a Firestore data flow.

Main entry points: [`src/pages/Invoice.tsx`](https://github.com/whitechapel007/invoice-test/blob/main/src/pages/Invoice.tsx) (Invoice overview), [`src/services/api/axios.ts`](https://github.com/whitechapel007/invoice-test/blob/main/src/services/api/axios.ts) (HTTP client), [`src/App.tsx`](https://github.com/whitechapel007/invoice-test/blob/main/src/App.tsx) (Route application), [`src/services/api/queries.ts`](https://github.com/whitechapel007/invoice-test/blob/main/src/services/api/queries.ts) (Query operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Authentication"]
  node_app["Route application<br/>[App.tsx]"]
  node_authpages["Login and signup"]
  node_authcontext["Auth state<br/>[AuthContext.tsx]"]
  node_firebase["Firebase Auth<br/>[firebase.ts]"]
  node_protected["Route guard<br/>[ProtectedRoute.tsx]"]
end

subgraph group_dashboard["Invoice dashboard"]
  node_dashboardframe["Dashboard frame"]
  node_invoicepage["Invoice overview<br/>[Invoice.tsx]"]
  node_stats["Invoice statistics<br/>[invoicestats.js]"]
  node_recentinvoices["Recent invoices<br/>[RecentInvoices.tsx]"]
  node_activitiesview["Recent activities"]
  node_createform["Create invoice"]
  node_detailmodal["Invoice detail<br/>[InvoiceModal.tsx]"]
  node_actions["Invoice actions<br/>[InvoiceActions.tsx]"]
  node_types["Invoice domain types<br/>[type.ts]"]
end

subgraph group_api["Invoice data API"]
  node_queries["Query operations<br/>[queries.ts]"]
  node_client["HTTP client<br/>[axios.ts]"]
end

subgraph group_backend["Serverless backend"]
  node_invoicefn["Invoice endpoints<br/>[invoices.js]"]
  node_createfn["Create endpoint<br/>[createInvoice.js]"]
  node_activityfn["Activity endpoint<br/>[activities.js]"]
  node_statsfn["Stats endpoint<br/>[invoicestats.js]"]
  node_mockdata[("Mock data file<br/>[db.json]")]
end

node_user(("Invoice user"))

node_user -->|"opens app"| node_app
node_app -->|"routes to"| node_authpages
node_authpages -->|"requests authentication"| node_authcontext
node_authpages -->|"requests signup"| node_authcontext
node_authcontext -->|"calls auth"| node_firebase
node_app -->|"guards dashboard routes"| node_protected
node_protected -->|"checks auth state"| node_authcontext
node_app -->|"routes dashboard"| node_dashboardframe
node_dashboardframe -.->|"renders page"| node_invoicepage
node_invoicepage -->|"loads statistics"| node_stats
node_invoicepage -->|"renders list"| node_recentinvoices
node_invoicepage -->|"renders activity"| node_activitiesview
node_invoicepage -->|"opens form"| node_createform
node_invoicepage -->|"renders actions"| node_actions
node_recentinvoices -->|"fetches invoices"| node_queries
node_activitiesview -->|"fetches activities"| node_queries
node_recentinvoices -->|"opens details"| node_detailmodal
node_createform -->|"posts invoice"| node_client
node_queries -->|"sends requests"| node_client
node_client -.->|"requests invoices"| node_invoicefn
node_client -.->|"posts invoices"| node_createfn
node_client -.->|"requests activities"| node_activityfn
node_client -.->|"requests statistics"| node_statsfn
node_queries -->|"uses domain types"| node_types
node_invoicefn -.->|"data access"| node_mockdata
node_createfn -.->|"data access"| node_mockdata

click node_app "https://github.com/whitechapel007/invoice-test/blob/main/src/App.tsx"
click node_authpages "https://github.com/whitechapel007/invoice-test/tree/main/src/pages"
click node_authcontext "https://github.com/whitechapel007/invoice-test/blob/main/src/context/AuthContext.tsx"
click node_firebase "https://github.com/whitechapel007/invoice-test/blob/main/src/services/firebase.ts"
click node_protected "https://github.com/whitechapel007/invoice-test/blob/main/src/components/auth/ProtectedRoute.tsx"
click node_dashboardframe "https://github.com/whitechapel007/invoice-test/blob/main/src/components/common/DashboardWrapper.tsx"
click node_invoicepage "https://github.com/whitechapel007/invoice-test/blob/main/src/pages/Invoice.tsx"
click node_stats "https://github.com/whitechapel007/invoice-test/blob/main/netlify/functions/invoicestats.js"
click node_recentinvoices "https://github.com/whitechapel007/invoice-test/blob/main/src/components/invoice/RecentInvoices.tsx"
click node_activitiesview "https://github.com/whitechapel007/invoice-test/blob/main/src/components/invoice/RecentActivities.tsx"
click node_createform "https://github.com/whitechapel007/invoice-test/blob/main/src/components/modal/CreateInvoiceModal.tsx"
click node_detailmodal "https://github.com/whitechapel007/invoice-test/blob/main/src/components/modal/InvoiceModal.tsx"
click node_actions "https://github.com/whitechapel007/invoice-test/blob/main/src/components/invoice/InvoiceActions.tsx"
click node_types "https://github.com/whitechapel007/invoice-test/blob/main/src/types/type.ts"
click node_queries "https://github.com/whitechapel007/invoice-test/blob/main/src/services/api/queries.ts"
click node_client "https://github.com/whitechapel007/invoice-test/blob/main/src/services/api/axios.ts"
click node_invoicefn "https://github.com/whitechapel007/invoice-test/blob/main/netlify/functions/invoices.js"
click node_createfn "https://github.com/whitechapel007/invoice-test/blob/main/netlify/functions/createInvoice.js"
click node_activityfn "https://github.com/whitechapel007/invoice-test/blob/main/netlify/functions/activities.js"
click node_statsfn "https://github.com/whitechapel007/invoice-test/blob/main/netlify/functions/invoicestats.js"
click node_mockdata "https://github.com/whitechapel007/invoice-test/blob/main/netlify/functions/db.json"

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_app,node_authpages,node_authcontext,node_firebase,node_protected,node_user toneBlue
class node_dashboardframe,node_invoicepage,node_stats,node_recentinvoices,node_activitiesview,node_createform,node_detailmodal,node_actions,node_types toneAmber
class node_queries,node_client toneMint
class node_invoicefn,node_createfn,node_activityfn,node_statsfn,node_mockdata toneRose
```

## Components

### Authentication

- [Route application](https://github.com/whitechapel007/invoice-test/blob/main/src/App.tsx): `src/App.tsx`
- [Login and signup](https://github.com/whitechapel007/invoice-test/tree/main/src/pages): `src/pages`
- [Auth state](https://github.com/whitechapel007/invoice-test/blob/main/src/context/AuthContext.tsx): `src/context/AuthContext.tsx`
- [Firebase Auth](https://github.com/whitechapel007/invoice-test/blob/main/src/services/firebase.ts): `src/services/firebase.ts`
- [Route guard](https://github.com/whitechapel007/invoice-test/blob/main/src/components/auth/ProtectedRoute.tsx): `src/components/auth/ProtectedRoute.tsx`

### Invoice dashboard

- [Dashboard frame](https://github.com/whitechapel007/invoice-test/blob/main/src/components/common/DashboardWrapper.tsx): `src/components/common/DashboardWrapper.tsx`
- [Invoice overview](https://github.com/whitechapel007/invoice-test/blob/main/src/pages/Invoice.tsx): `src/pages/Invoice.tsx`
- [Invoice statistics](https://github.com/whitechapel007/invoice-test/blob/main/netlify/functions/invoicestats.js): `netlify/functions/invoicestats.js`
- [Recent invoices](https://github.com/whitechapel007/invoice-test/blob/main/src/components/invoice/RecentInvoices.tsx): `src/components/invoice/RecentInvoices.tsx`
- [Recent activities](https://github.com/whitechapel007/invoice-test/blob/main/src/components/invoice/RecentActivities.tsx): `src/components/invoice/RecentActivities.tsx`
- [Create invoice](https://github.com/whitechapel007/invoice-test/blob/main/src/components/modal/CreateInvoiceModal.tsx): `src/components/modal/CreateInvoiceModal.tsx`
- [Invoice detail](https://github.com/whitechapel007/invoice-test/blob/main/src/components/modal/InvoiceModal.tsx): `src/components/modal/InvoiceModal.tsx`
- [Invoice actions](https://github.com/whitechapel007/invoice-test/blob/main/src/components/invoice/InvoiceActions.tsx): `src/components/invoice/InvoiceActions.tsx`
- [Invoice domain types](https://github.com/whitechapel007/invoice-test/blob/main/src/types/type.ts): `src/types/type.ts`

### Invoice data API

- [Query operations](https://github.com/whitechapel007/invoice-test/blob/main/src/services/api/queries.ts): `src/services/api/queries.ts`
- [HTTP client](https://github.com/whitechapel007/invoice-test/blob/main/src/services/api/axios.ts): `src/services/api/axios.ts`

### Serverless backend

- [Invoice endpoints](https://github.com/whitechapel007/invoice-test/blob/main/netlify/functions/invoices.js): `netlify/functions/invoices.js`
- [Create endpoint](https://github.com/whitechapel007/invoice-test/blob/main/netlify/functions/createInvoice.js): `netlify/functions/createInvoice.js`
- [Activity endpoint](https://github.com/whitechapel007/invoice-test/blob/main/netlify/functions/activities.js): `netlify/functions/activities.js`
- [Stats endpoint](https://github.com/whitechapel007/invoice-test/blob/main/netlify/functions/invoicestats.js): `netlify/functions/invoicestats.js`
- [Mock data file](https://github.com/whitechapel007/invoice-test/blob/main/netlify/functions/db.json): `netlify/functions/db.json`

### Other components

- **Invoice user**

## Connections

- Invoice user → Route application: opens app (evidence: `src/App.tsx`)
- Route application → Login and signup: routes to (evidence: `src/App.tsx`)
- Login and signup → Auth state: requests authentication (evidence: `src/pages/Login.tsx`)
- Login and signup → Auth state: requests signup (evidence: `src/pages/Signup.tsx`)
- Auth state → Firebase Auth: calls auth (evidence: `src/context/AuthContext.tsx`)
- Route application → Route guard: guards dashboard routes (evidence: `src/App.tsx`)
- Route guard → Auth state: checks auth state (evidence: `src/components/auth/ProtectedRoute.tsx`)
- Route application → Dashboard frame: routes dashboard (evidence: `src/App.tsx`)
- Dashboard frame → Invoice overview: renders page
- Invoice overview → Invoice statistics: loads statistics
- Invoice overview → Recent invoices: renders list (evidence: `src/pages/Invoice.tsx`)
- Invoice overview → Recent activities: renders activity (evidence: `src/pages/Invoice.tsx`)
- Invoice overview → Create invoice: opens form (evidence: `src/pages/Invoice.tsx`)
- Invoice overview → Invoice actions: renders actions (evidence: `src/pages/Invoice.tsx`)
- Recent invoices → Query operations: fetches invoices (evidence: `src/components/invoice/RecentInvoices.tsx`)
- Recent activities → Query operations: fetches activities (evidence: `src/components/invoice/RecentActivities.tsx`)
- Recent invoices → Invoice detail: opens details (evidence: `src/components/invoice/RecentInvoices.tsx`)
- Create invoice → HTTP client: posts invoice (evidence: `src/components/modal/CreateInvoiceModal.tsx`)
- Query operations → HTTP client: sends requests (evidence: `src/services/api/queries.ts`)
- HTTP client → Invoice endpoints: requests invoices
- HTTP client → Create endpoint: posts invoices
- HTTP client → Activity endpoint: requests activities
- HTTP client → Stats endpoint: requests statistics
- Query operations → Invoice domain types: uses domain types (evidence: `src/services/api/queries.ts`)
- Invoice endpoints → Mock data file: data access
- Create endpoint → Mock data file: data access
