# koley2000/invoiceease architecture

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

- Interactive diagram: https://gitdiagram.com/koley2000/invoiceease
- Repository: https://github.com/koley2000/invoiceease

## Overview

InvoiceEase is a Next.js invoice-management app. Users can sign up or sign in, create invoices, manage them from a dashboard, and edit, delete, download, or preview/print PDFs. The graph shows the documented API, authentication, persistence, and PDF-rendering layers. Several page and API implementations were not excerpted, so their connections are included only where the README or source index supports them; the dashboard’s request to its invoice API is directly excerpted.

Main entry points: [`src/lib/prisma.ts`](https://github.com/koley2000/invoiceease/blob/main/src/lib/prisma.ts) (Prisma client), [`src/components/InvoiceAction.tsx`](https://github.com/koley2000/invoiceease/blob/main/src/components/InvoiceAction.tsx) (Invoice actions), [`src/pages/api/invoice/index.ts`](https://github.com/koley2000/invoiceease/blob/main/src/pages/api/invoice/index.ts) (Invoice collection API), [`src/pages/api/invoice/[id].ts`](https://github.com/koley2000/invoiceease/blob/main/src/pages/api/invoice/%5Bid%5D.ts) (Single invoice API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_home["Landing page<br/>[index.tsx]"]
  node_hero["Landing content<br/>[Hero.tsx]"]
  node_appshell["App shell<br/>[_app.tsx]"]
  node_navbar["Navigation<br/>[Navbar.tsx]"]
end

subgraph group_identity["Authentication"]
  node_login["Login page<br/>[index.tsx]"]
  node_signup["Signup page<br/>[index.tsx]"]
  node_user_schema["Credential validation<br/>[userSchema.ts]"]
  node_auth["NextAuth credentials<br/>[&#91;...nextauth&#93;.ts]"]
  node_signup_api["Account signup API<br/>[signup.ts]"]
  node_auth_middleware["Session guard<br/>[authMiddleware.ts]"]
end

subgraph group_invoices["Invoice management"]
  node_dashboard["Invoice dashboard<br/>[index.tsx]"]
  node_create_page["Create page<br/>[index.tsx]"]
  node_edit_page["Edit page<br/>[&#91;id&#93;.tsx]"]
  node_invoice_form["Invoice form<br/>[InvoiceForm.tsx]"]
  node_invoice_action["Invoice actions<br/>[InvoiceAction.tsx]"]
  node_delete_modal["Delete confirmation<br/>[DeleteModal.tsx]"]
  node_invoice_api["Invoice collection API<br/>[index.ts]"]
  node_invoice_item_api["Single invoice API<br/>[&#91;id&#93;.ts]"]
  node_invoice_model["Invoice data model<br/>[Invoice.ts]"]
  node_db_client["Prisma client<br/>[prisma.ts]"]
  node_postgres[("PostgreSQL")]
  node_ui_table["Table components<br/>[table.tsx]"]
  node_ui_dialog["Dialog components<br/>[dialog.tsx]"]
end

subgraph group_documents["PDF documents"]
  node_pdf_blob["PDF blob helper<br/>[generatePdfBlob.ts]"]
  node_pdf_api["PDF generation API<br/>[index.ts]"]
  node_classic_template["Classic invoice template<br/>[classic.tsx]"]
end

node_user(("User"))

node_user -->|"opens"| node_home
node_home -->|"renders"| node_hero
node_appshell -->|"renders"| node_navbar
node_user -->|"signs in"| node_login
node_user -->|"signs up"| node_signup
node_login -->|"validates with"| node_user_schema
node_signup -->|"validates with"| node_user_schema
node_signup -.->|"submits to"| node_signup_api
node_signup_api -->|"uses"| node_db_client
node_login -.->|"authenticates via"| node_auth
node_auth -->|"uses"| node_db_client
node_auth_middleware -->|"checks session"| node_auth
node_auth_middleware -->|"looks up user"| node_db_client
node_user -->|"manages invoices"| node_dashboard
node_dashboard -->|"fetches invoices"| node_invoice_api
node_dashboard -->|"renders with"| node_ui_table
node_user -->|"creates invoice"| node_create_page
node_create_page -->|"renders"| node_invoice_form
node_edit_page -->|"renders"| node_invoice_form
node_invoice_form -->|"renders"| node_invoice_action
node_invoice_action -->|"creates invoice"| node_invoice_api
node_invoice_action -->|"updates invoice"| node_invoice_item_api
node_invoice_action -->|"renders"| node_delete_modal
node_delete_modal -->|"uses"| node_ui_dialog
node_invoice_api -->|"guards requests"| node_auth_middleware
node_invoice_item_api -->|"guards requests"| node_auth_middleware
node_invoice_api -->|"uses"| node_db_client
node_invoice_item_api -->|"uses"| node_db_client
node_invoice_api -->|"uses type"| node_invoice_model
node_invoice_item_api -->|"uses type"| node_invoice_model
node_db_client -->|"connects to"| node_postgres
node_invoice_action -->|"generates blob via"| node_pdf_blob
node_pdf_blob -->|"posts invoice to"| node_pdf_api
node_pdf_api -->|"renders with"| node_classic_template
node_pdf_api -->|"uses type"| node_invoice_model
node_classic_template -->|"renders data"| node_invoice_model

click node_home "https://github.com/koley2000/invoiceease/blob/main/src/pages/index.tsx"
click node_hero "https://github.com/koley2000/invoiceease/blob/main/src/components/Hero.tsx"
click node_appshell "https://github.com/koley2000/invoiceease/blob/main/src/pages/_app.tsx"
click node_navbar "https://github.com/koley2000/invoiceease/blob/main/src/components/Navbar.tsx"
click node_login "https://github.com/koley2000/invoiceease/blob/main/src/pages/login/index.tsx"
click node_signup "https://github.com/koley2000/invoiceease/blob/main/src/pages/signup/index.tsx"
click node_user_schema "https://github.com/koley2000/invoiceease/blob/main/src/utils/userSchema.ts"
click node_auth "https://github.com/koley2000/invoiceease/blob/main/src/pages/api/auth/%5B...nextauth%5D.ts"
click node_signup_api "https://github.com/koley2000/invoiceease/blob/main/src/pages/api/auth/signup.ts"
click node_auth_middleware "https://github.com/koley2000/invoiceease/blob/main/src/middleware/authMiddleware.ts"
click node_dashboard "https://github.com/koley2000/invoiceease/blob/main/src/pages/dashboard/index.tsx"
click node_create_page "https://github.com/koley2000/invoiceease/blob/main/src/pages/create-invoice/index.tsx"
click node_edit_page "https://github.com/koley2000/invoiceease/blob/main/src/pages/edit-invoice/%5Bid%5D.tsx"
click node_invoice_form "https://github.com/koley2000/invoiceease/blob/main/src/components/InvoiceForm.tsx"
click node_invoice_action "https://github.com/koley2000/invoiceease/blob/main/src/components/InvoiceAction.tsx"
click node_delete_modal "https://github.com/koley2000/invoiceease/blob/main/src/components/DeleteModal.tsx"
click node_invoice_api "https://github.com/koley2000/invoiceease/blob/main/src/pages/api/invoice/index.ts"
click node_invoice_item_api "https://github.com/koley2000/invoiceease/blob/main/src/pages/api/invoice/%5Bid%5D.ts"
click node_invoice_model "https://github.com/koley2000/invoiceease/blob/main/src/model/Invoice.ts"
click node_db_client "https://github.com/koley2000/invoiceease/blob/main/src/lib/prisma.ts"
click node_pdf_blob "https://github.com/koley2000/invoiceease/blob/main/src/utils/generatePdfBlob.ts"
click node_pdf_api "https://github.com/koley2000/invoiceease/blob/main/src/pages/api/generate-pdf/index.ts"
click node_classic_template "https://github.com/koley2000/invoiceease/blob/main/src/template/invoice/classic.tsx"
click node_ui_table "https://github.com/koley2000/invoiceease/blob/main/src/components/ui/table.tsx"
click node_ui_dialog "https://github.com/koley2000/invoiceease/blob/main/src/components/ui/dialog.tsx"

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_home,node_hero,node_appshell,node_navbar,node_user toneBlue
class node_login,node_signup,node_user_schema,node_auth,node_signup_api,node_auth_middleware toneAmber
class node_dashboard,node_create_page,node_edit_page,node_invoice_form,node_invoice_action,node_delete_modal,node_invoice_api,node_invoice_item_api,node_invoice_model,node_db_client,node_postgres,node_ui_table,node_ui_dialog toneMint
class node_pdf_blob,node_pdf_api,node_classic_template toneRose
```

## Components

### User experience

- [Landing page](https://github.com/koley2000/invoiceease/blob/main/src/pages/index.tsx): `src/pages/index.tsx`
- [Landing content](https://github.com/koley2000/invoiceease/blob/main/src/components/Hero.tsx): `src/components/Hero.tsx`
- [App shell](https://github.com/koley2000/invoiceease/blob/main/src/pages/_app.tsx): `src/pages/_app.tsx`
- [Navigation](https://github.com/koley2000/invoiceease/blob/main/src/components/Navbar.tsx): `src/components/Navbar.tsx`

### Authentication

- [Login page](https://github.com/koley2000/invoiceease/blob/main/src/pages/login/index.tsx): `src/pages/login/index.tsx`
- [Signup page](https://github.com/koley2000/invoiceease/blob/main/src/pages/signup/index.tsx): `src/pages/signup/index.tsx`
- [Credential validation](https://github.com/koley2000/invoiceease/blob/main/src/utils/userSchema.ts): `src/utils/userSchema.ts`
- [NextAuth credentials](https://github.com/koley2000/invoiceease/blob/main/src/pages/api/auth/%5B...nextauth%5D.ts): `src/pages/api/auth/[...nextauth].ts`
- [Account signup API](https://github.com/koley2000/invoiceease/blob/main/src/pages/api/auth/signup.ts): `src/pages/api/auth/signup.ts`
- [Session guard](https://github.com/koley2000/invoiceease/blob/main/src/middleware/authMiddleware.ts): `src/middleware/authMiddleware.ts`

### Invoice management

- [Invoice dashboard](https://github.com/koley2000/invoiceease/blob/main/src/pages/dashboard/index.tsx): `src/pages/dashboard/index.tsx`
- [Create page](https://github.com/koley2000/invoiceease/blob/main/src/pages/create-invoice/index.tsx): `src/pages/create-invoice/index.tsx`
- [Edit page](https://github.com/koley2000/invoiceease/blob/main/src/pages/edit-invoice/%5Bid%5D.tsx): `src/pages/edit-invoice/[id].tsx`
- [Invoice form](https://github.com/koley2000/invoiceease/blob/main/src/components/InvoiceForm.tsx): `src/components/InvoiceForm.tsx`
- [Invoice actions](https://github.com/koley2000/invoiceease/blob/main/src/components/InvoiceAction.tsx): `src/components/InvoiceAction.tsx`
- [Delete confirmation](https://github.com/koley2000/invoiceease/blob/main/src/components/DeleteModal.tsx): `src/components/DeleteModal.tsx`
- [Invoice collection API](https://github.com/koley2000/invoiceease/blob/main/src/pages/api/invoice/index.ts): `src/pages/api/invoice/index.ts`
- [Single invoice API](https://github.com/koley2000/invoiceease/blob/main/src/pages/api/invoice/%5Bid%5D.ts): `src/pages/api/invoice/[id].ts`
- [Invoice data model](https://github.com/koley2000/invoiceease/blob/main/src/model/Invoice.ts): `src/model/Invoice.ts`
- [Prisma client](https://github.com/koley2000/invoiceease/blob/main/src/lib/prisma.ts): `src/lib/prisma.ts`
- **PostgreSQL**
- [Table components](https://github.com/koley2000/invoiceease/blob/main/src/components/ui/table.tsx): `src/components/ui/table.tsx`
- [Dialog components](https://github.com/koley2000/invoiceease/blob/main/src/components/ui/dialog.tsx): `src/components/ui/dialog.tsx`

### PDF documents

- [PDF blob helper](https://github.com/koley2000/invoiceease/blob/main/src/utils/generatePdfBlob.ts): `src/utils/generatePdfBlob.ts`
- [PDF generation API](https://github.com/koley2000/invoiceease/blob/main/src/pages/api/generate-pdf/index.ts): `src/pages/api/generate-pdf/index.ts`
- [Classic invoice template](https://github.com/koley2000/invoiceease/blob/main/src/template/invoice/classic.tsx): `src/template/invoice/classic.tsx`

### Other components

- **User**

## Connections

- User → Landing page: opens (evidence: `src/pages/index.tsx`)
- Landing page → Landing content: renders (evidence: `src/pages/index.tsx`)
- App shell → Navigation: renders (evidence: `src/pages/_app.tsx`)
- User → Login page: signs in (evidence: `README.md`)
- User → Signup page: signs up (evidence: `README.md`)
- Login page → Credential validation: validates with (evidence: `src/pages/login/index.tsx`)
- Signup page → Credential validation: validates with (evidence: `src/pages/signup/index.tsx`)
- Signup page → Account signup API: submits to
- Account signup API → Prisma client: uses (evidence: `src/pages/api/auth/signup.ts`)
- Login page → NextAuth credentials: authenticates via
- NextAuth credentials → Prisma client: uses (evidence: `src/pages/api/auth/[...nextauth].ts`)
- Session guard → NextAuth credentials: checks session (evidence: `src/middleware/authMiddleware.ts`)
- Session guard → Prisma client: looks up user (evidence: `src/middleware/authMiddleware.ts`)
- User → Invoice dashboard: manages invoices (evidence: `README.md`)
- Invoice dashboard → Invoice collection API: fetches invoices (evidence: `src/pages/dashboard/index.tsx`)
- Invoice dashboard → Table components: renders with (evidence: `src/pages/dashboard/index.tsx`)
- User → Create page: creates invoice (evidence: `README.md`)
- Create page → Invoice form: renders (evidence: `src/pages/create-invoice/index.tsx`)
- Edit page → Invoice form: renders (evidence: `src/pages/edit-invoice/[id].tsx`)
- Invoice form → Invoice actions: renders (evidence: `src/components/InvoiceForm.tsx`)
- Invoice actions → Invoice collection API: creates invoice (evidence: `src/components/InvoiceAction.tsx`)
- Invoice actions → Single invoice API: updates invoice (evidence: `src/components/InvoiceAction.tsx`)
- Invoice actions → Delete confirmation: renders (evidence: `src/components/InvoiceAction.tsx`)
- Delete confirmation → Dialog components: uses (evidence: `src/components/DeleteModal.tsx`)
- Invoice collection API → Session guard: guards requests (evidence: `src/pages/api/invoice/index.ts`)
- Single invoice API → Session guard: guards requests (evidence: `src/pages/api/invoice/[id].ts`)
- Invoice collection API → Prisma client: uses (evidence: `src/pages/api/invoice/index.ts`)
- Single invoice API → Prisma client: uses (evidence: `src/pages/api/invoice/[id].ts`)
- Invoice collection API → Invoice data model: uses type (evidence: `src/pages/api/invoice/index.ts`)
- Single invoice API → Invoice data model: uses type (evidence: `src/pages/api/invoice/[id].ts`)
- Prisma client → PostgreSQL: connects to (evidence: `src/lib/prisma.ts`)
- Invoice actions → PDF blob helper: generates blob via (evidence: `src/components/InvoiceAction.tsx`)
- PDF blob helper → PDF generation API: posts invoice to (evidence: `src/utils/generatePdfBlob.ts`)
- PDF generation API → Classic invoice template: renders with (evidence: `src/pages/api/generate-pdf/index.ts`)
- PDF generation API → Invoice data model: uses type (evidence: `src/pages/api/generate-pdf/index.ts`)
- Classic invoice template → Invoice data model: renders data (evidence: `src/template/invoice/classic.tsx`)
