# shailifadadu/invoease architecture

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

## Overview

InvoEase is a web invoicing product for businesses and freelancers. Users sign in by email, complete onboarding, then create and manage invoices; dashboard views summarize revenue and invoice status. Server actions validate and persist invoice changes, with invoice emails and a public invoice endpoint supporting sharing. The README also documents print-ready PDF export and multi-currency support. Relationships reflect the sampled code, SOURCE INDEX references, and README; unsampled capabilities are represented without guessing their internal wiring.

Main entry points: [`app/actions.ts`](https://github.com/shailifadadu/invoease/blob/main/app/actions.ts) (Server actions), [`app/utils/auth.ts`](https://github.com/shailifadadu/invoease/blob/main/app/utils/auth.ts) (Magic-link auth), [`app/utils/db.ts`](https://github.com/shailifadadu/invoease/blob/main/app/utils/db.ts) (Prisma data access), [`app/dashboard/page.tsx`](https://github.com/shailifadadu/invoease/blob/main/app/dashboard/page.tsx) (Dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity &amp; onboarding"]
  node_login["Email login<br/>[page.tsx]"]
  node_auth["Magic-link auth<br/>[auth.ts]"]
  node_authroute["Auth endpoint<br/>[route.ts]"]
  node_onboarding["Profile onboarding<br/>[page.tsx]"]
end

subgraph group_invoices["Invoice management"]
  node_actions["Server actions<br/>[actions.ts]"]
  node_createform["Invoice creation<br/>[CreateInvoice.tsx]"]
  node_editform["Invoice editing<br/>[EditInvoice.tsx]"]
  node_invoicepages["Invoice routes<br/>[page.tsx]"]
  node_invoicelist["Invoice listing<br/>[InvoiceList.tsx]"]
  node_invoiceapi["Invoice document API<br/>[route.ts]"]
  node_emailapi["Invoice email API<br/>[route.ts]"]
  node_pdf["Print-ready PDF export<br/>[route.ts]"]
end

subgraph group_insights["Dashboard &amp; insights"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_metrics["Revenue metrics"]
  node_charts["Invoice insights<br/>[InvoiceGraph.tsx]"]
end

subgraph group_services["Data &amp; delivery"]
  node_db["Prisma data access<br/>[db.ts]"]
  node_database[("PostgreSQL")]
  node_mailtrap["Mailtrap"]
  node_currency["Currency formatting<br/>[formatCurrency.ts]"]
  node_validation["Form schemas<br/>[zodSchemas.ts]"]
  node_guard["Session guard<br/>[hooks.ts]"]
end

node_user(("Business user"))

node_user -->|"starts sign-in"| node_login
node_login -->|"requests sign-in"| node_auth
node_authroute -->|"dispatches handlers"| node_auth
node_auth -->|"uses adapter"| node_db
node_auth -.->|"sends magic link"| node_mailtrap
node_user -->|"enters profile"| node_onboarding
node_onboarding -->|"submits profile"| node_actions
node_actions -->|"requires session"| node_guard
node_guard -->|"checks session"| node_auth
node_actions -->|"validates input"| node_validation
node_user -->|"creates invoice"| node_createform
node_createform -->|"submits invoice"| node_actions
node_user -->|"manages invoices"| node_invoicepages
node_invoicepages -->|"renders editor"| node_editform
node_editform -->|"submits changes"| node_actions
node_actions -->|"writes invoices"| node_db
node_db -->|"reads and writes"| node_database
node_actions -->|"sends invoice email"| node_mailtrap
node_actions -->|"formats totals"| node_currency
node_user -->|"views activity"| node_dashboard
node_dashboard -->|"renders metrics"| node_metrics
node_dashboard -->|"renders charts"| node_charts
node_dashboard -->|"links invoices"| node_invoicelist
node_invoiceapi -->|"reads invoice"| node_db
node_invoiceapi -->|"formats amount"| node_currency
node_invoiceapi -.->|"provides document"| node_pdf
node_emailapi -->|"reads invoice"| node_db
node_emailapi -->|"checks session"| node_guard
node_emailapi -->|"sends email"| node_mailtrap

click node_login "https://github.com/shailifadadu/invoease/blob/main/app/login/page.tsx"
click node_auth "https://github.com/shailifadadu/invoease/blob/main/app/utils/auth.ts"
click node_authroute "https://github.com/shailifadadu/invoease/blob/main/app/api/auth/%5B...nextauth%5D/route.ts"
click node_onboarding "https://github.com/shailifadadu/invoease/blob/main/app/onboarding/page.tsx"
click node_actions "https://github.com/shailifadadu/invoease/blob/main/app/actions.ts"
click node_createform "https://github.com/shailifadadu/invoease/blob/main/app/components/CreateInvoice.tsx"
click node_editform "https://github.com/shailifadadu/invoease/blob/main/app/components/EditInvoice.tsx"
click node_invoicepages "https://github.com/shailifadadu/invoease/blob/main/app/dashboard/invoices/%5BinvoiceId%5D/page.tsx"
click node_invoicelist "https://github.com/shailifadadu/invoease/blob/main/app/components/InvoiceList.tsx"
click node_invoiceapi "https://github.com/shailifadadu/invoease/blob/main/app/api/invoice/%5BinvoiceId%5D/route.ts"
click node_emailapi "https://github.com/shailifadadu/invoease/blob/main/app/api/email/%5BinvoiceId%5D/route.ts"
click node_dashboard "https://github.com/shailifadadu/invoease/blob/main/app/dashboard/page.tsx"
click node_metrics "https://github.com/shailifadadu/invoease/blob/main/app/components/DashboardBlocks.tsx"
click node_charts "https://github.com/shailifadadu/invoease/blob/main/app/components/InvoiceGraph.tsx"
click node_db "https://github.com/shailifadadu/invoease/blob/main/app/utils/db.ts"
click node_currency "https://github.com/shailifadadu/invoease/blob/main/app/utils/formatCurrency.ts"
click node_validation "https://github.com/shailifadadu/invoease/blob/main/app/utils/zodSchemas.ts"
click node_guard "https://github.com/shailifadadu/invoease/blob/main/app/utils/hooks.ts"
click node_pdf "https://github.com/shailifadadu/invoease/blob/main/app/api/invoice/%5BinvoiceId%5D/route.ts"

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_login,node_auth,node_authroute,node_onboarding,node_user toneBlue
class node_actions,node_createform,node_editform,node_invoicepages,node_invoicelist,node_invoiceapi,node_emailapi,node_pdf toneAmber
class node_dashboard,node_metrics,node_charts toneMint
class node_db,node_database,node_mailtrap,node_currency,node_validation,node_guard toneRose
```

## Components

### Identity & onboarding

- [Email login](https://github.com/shailifadadu/invoease/blob/main/app/login/page.tsx): `app/login/page.tsx`
- [Magic-link auth](https://github.com/shailifadadu/invoease/blob/main/app/utils/auth.ts): `app/utils/auth.ts`
- [Auth endpoint](https://github.com/shailifadadu/invoease/blob/main/app/api/auth/%5B...nextauth%5D/route.ts): `app/api/auth/[...nextauth]/route.ts`
- [Profile onboarding](https://github.com/shailifadadu/invoease/blob/main/app/onboarding/page.tsx): `app/onboarding/page.tsx`

### Invoice management

- [Server actions](https://github.com/shailifadadu/invoease/blob/main/app/actions.ts): `app/actions.ts`
- [Invoice creation](https://github.com/shailifadadu/invoease/blob/main/app/components/CreateInvoice.tsx): `app/components/CreateInvoice.tsx`
- [Invoice editing](https://github.com/shailifadadu/invoease/blob/main/app/components/EditInvoice.tsx): `app/components/EditInvoice.tsx`
- [Invoice routes](https://github.com/shailifadadu/invoease/blob/main/app/dashboard/invoices/%5BinvoiceId%5D/page.tsx): `app/dashboard/invoices/[invoiceId]/page.tsx`
- [Invoice listing](https://github.com/shailifadadu/invoease/blob/main/app/components/InvoiceList.tsx): `app/components/InvoiceList.tsx`
- [Invoice document API](https://github.com/shailifadadu/invoease/blob/main/app/api/invoice/%5BinvoiceId%5D/route.ts): `app/api/invoice/[invoiceId]/route.ts`
- [Invoice email API](https://github.com/shailifadadu/invoease/blob/main/app/api/email/%5BinvoiceId%5D/route.ts): `app/api/email/[invoiceId]/route.ts`
- [Print-ready PDF export](https://github.com/shailifadadu/invoease/blob/main/app/api/invoice/%5BinvoiceId%5D/route.ts): `app/api/invoice/[invoiceId]/route.ts`

### Dashboard & insights

- [Dashboard](https://github.com/shailifadadu/invoease/blob/main/app/dashboard/page.tsx): `app/dashboard/page.tsx`
- [Revenue metrics](https://github.com/shailifadadu/invoease/blob/main/app/components/DashboardBlocks.tsx): `app/components/DashboardBlocks.tsx`
- [Invoice insights](https://github.com/shailifadadu/invoease/blob/main/app/components/InvoiceGraph.tsx): `app/components/InvoiceGraph.tsx`

### Data & delivery

- [Prisma data access](https://github.com/shailifadadu/invoease/blob/main/app/utils/db.ts): `app/utils/db.ts`
- **PostgreSQL**
- **Mailtrap**
- [Currency formatting](https://github.com/shailifadadu/invoease/blob/main/app/utils/formatCurrency.ts): `app/utils/formatCurrency.ts`
- [Form schemas](https://github.com/shailifadadu/invoease/blob/main/app/utils/zodSchemas.ts): `app/utils/zodSchemas.ts`
- [Session guard](https://github.com/shailifadadu/invoease/blob/main/app/utils/hooks.ts): `app/utils/hooks.ts`

### Other components

- **Business user**

## Connections

- Business user → Email login: starts sign-in
- Email login → Magic-link auth: requests sign-in (evidence: `app/login/page.tsx`)
- Auth endpoint → Magic-link auth: dispatches handlers (evidence: `app/api/auth/[...nextauth]/route.ts`)
- Magic-link auth → Prisma data access: uses adapter (evidence: `app/utils/auth.ts`)
- Magic-link auth → Mailtrap: sends magic link
- Business user → Profile onboarding: enters profile
- Profile onboarding → Server actions: submits profile (evidence: `app/onboarding/page.tsx`)
- Server actions → Session guard: requires session (evidence: `app/actions.ts`)
- Session guard → Magic-link auth: checks session (evidence: `app/utils/hooks.ts`)
- Server actions → Form schemas: validates input (evidence: `app/actions.ts`)
- Business user → Invoice creation: creates invoice
- Invoice creation → Server actions: submits invoice (evidence: `app/components/CreateInvoice.tsx`)
- Business user → Invoice routes: manages invoices
- Invoice routes → Invoice editing: renders editor (evidence: `app/dashboard/invoices/[invoiceId]/page.tsx`)
- Invoice editing → Server actions: submits changes (evidence: `app/components/EditInvoice.tsx`)
- Server actions → Prisma data access: writes invoices (evidence: `app/actions.ts`)
- Prisma data access → PostgreSQL: reads and writes
- Server actions → Mailtrap: sends invoice email (evidence: `app/actions.ts`)
- Server actions → Currency formatting: formats totals (evidence: `app/actions.ts`)
- Business user → Dashboard: views activity
- Dashboard → Revenue metrics: renders metrics (evidence: `app/dashboard/page.tsx`)
- Dashboard → Invoice insights: renders charts (evidence: `app/dashboard/page.tsx`)
- Dashboard → Invoice listing: links invoices
- Invoice document API → Prisma data access: reads invoice (evidence: `app/api/invoice/[invoiceId]/route.ts`)
- Invoice document API → Currency formatting: formats amount (evidence: `app/api/invoice/[invoiceId]/route.ts`)
- Invoice document API → Print-ready PDF export: provides document (evidence: `app/api/invoice/[invoiceId]/route.ts`)
- Invoice email API → Prisma data access: reads invoice (evidence: `app/api/email/[invoiceId]/route.ts`)
- Invoice email API → Session guard: checks session (evidence: `app/api/email/[invoiceId]/route.ts`)
- Invoice email API → Mailtrap: sends email (evidence: `app/api/email/[invoiceId]/route.ts`)
