# balamanikantatirunagaram-lgtm/invgen-web architecture

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

- Interactive diagram: https://gitdiagram.com/balamanikantatirunagaram-lgtm/invgen-web
- Repository: https://github.com/balamanikantatirunagaram-lgtm/invgen-web

## Overview

InvGen Web combines a marketing site with a desktop GST invoicing workspace backed by the same Supabase project as its mobile app. The user journey proceeds through login, GST verification and onboarding, then into workspace features for invoices, clients, products, quotations, dashboard and settings; invoice and quotation previews generate downloadable or printable PDFs. The graph preserves documented capabilities and separates UI, query/API, calculation and PDF layers. Some feature and API implementations were not sampled, so their links are limited to README statements or source-index references.

Main entry points: [`src/app/hooks/queries.ts`](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/hooks/queries.ts) (Query and mutation hooks), [`src/app/features/invoices/PdfPreviewPage.tsx`](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/features/invoices/PdfPreviewPage.tsx) (Invoice PDF preview), [`src/app/features/quotations/QuotationPdfPreview.tsx`](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/features/quotations/QuotationPdfPreview.tsx) (Quotation PDF preview), [`src/app/features/auth/VerifyGstPage.tsx`](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/features/auth/VerifyGstPage.tsx) (GST verification)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and access"]
  node_marketing["Marketing site<br/>[App.tsx]"]
  node_login["Login<br/>[LoginPage.tsx]"]
  node_guards["Route guards<br/>[RequireAuth.tsx]"]
  node_verify["GST verification<br/>[VerifyGstPage.tsx]"]
  node_onboarding["Onboarding<br/>[WelcomeWizard.tsx]"]
end

subgraph group_workspace["Invoicing workspace"]
  node_dashboard["Dashboard<br/>[DashboardPage.tsx]"]
  node_invoicebuilder["Invoice builder<br/>[BuilderPage.tsx]"]
  node_ledger["Invoice ledger<br/>[LedgerPage.tsx]"]
  node_clients["Client directory<br/>[ClientsPage.tsx]"]
  node_products["Product catalog<br/>[ProductsPage.tsx]"]
  node_quotations["Quotations"]
  node_settings["Settings<br/>[SettingsPages.tsx]"]
end

subgraph group_data["Data and services"]
  node_queries["Query and mutation hooks<br/>[queries.ts]"]
  node_templates["Template loader<br/>[useTemplates.ts]"]
  node_api["Supabase repositories"]
  node_gstapi["GST lookup API<br/>[gstVerify.ts]"]
  node_session["Session state<br/>[session.ts]"]
  node_supabase["Supabase client<br/>[client.ts]"]
  node_gstproxy["GST verification proxy<br/>[index.ts]"]
end

subgraph group_documents["Document output"]
  node_math["GST and formatting rules<br/>[gst.ts]"]
  node_invoicepreview["Invoice PDF preview<br/>[PdfPreviewPage.tsx]"]
  node_quotationpreview["Quotation PDF preview"]
  node_pdfbuild["PDF builder<br/>[buildPdf.ts]"]
  node_pdfdocument["Invoice templates"]
  node_pdfactions["Print and download<br/>[print.ts]"]
end

node_visitor(("Visitor"))
node_supastores[("Supabase database and auth")]

node_visitor -->|"browses"| node_marketing
node_marketing -->|"starts access"| node_login
node_login -.->|"enters app"| node_guards
node_guards -->|"requires verification"| node_verify
node_verify -.->|"continues setup"| node_onboarding
node_onboarding -.->|"opens workspace"| node_dashboard
node_dashboard -->|"loads workspace data"| node_queries
node_invoicebuilder -.->|"reads and saves"| node_queries
node_ledger -.->|"loads invoices"| node_queries
node_clients -->|"manages clients"| node_queries
node_clients -->|"checks GSTIN"| node_gstapi
node_products -.->|"manages products"| node_queries
node_quotations -.->|"reads and saves"| node_queries
node_settings -.->|"loads settings"| node_queries
node_verify -->|"requests verification"| node_gstapi
node_verify -->|"updates session"| node_session
node_queries -->|"calls repositories"| node_api
node_api -->|"uses client"| node_supabase
node_gstapi -->|"uses client"| node_supabase
node_templates -->|"loads templates"| node_supabase
node_supabase -->|"accesses shared backend"| node_supastores
node_gstapi -.->|"uses verification proxy"| node_gstproxy
node_invoicebuilder -.->|"uses GST rules"| node_math
node_invoicepreview -->|"loads invoice data"| node_queries
node_invoicepreview -->|"loads templates"| node_templates
node_invoicepreview -.->|"uses shared formatting"| node_math
node_invoicepreview -->|"builds PDF"| node_pdfbuild
node_quotationpreview -->|"loads quotation data"| node_queries
node_quotationpreview -->|"loads templates"| node_templates
node_quotationpreview -.->|"builds PDF"| node_pdfbuild
node_pdfbuild -->|"renders document"| node_pdfdocument
node_pdfdocument -->|"uses shared formatting"| node_math
node_invoicepreview -->|"prints PDF"| node_pdfactions
node_quotationpreview -->|"prints PDF"| node_pdfactions

click node_marketing "https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/App.tsx"
click node_login "https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/features/auth/LoginPage.tsx"
click node_guards "https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/routes/RequireAuth.tsx"
click node_verify "https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/features/auth/VerifyGstPage.tsx"
click node_onboarding "https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/features/onboarding/WelcomeWizard.tsx"
click node_dashboard "https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/features/dashboard/DashboardPage.tsx"
click node_invoicebuilder "https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/features/invoices/BuilderPage.tsx"
click node_ledger "https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/features/invoices/LedgerPage.tsx"
click node_clients "https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/features/clients/ClientsPage.tsx"
click node_products "https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/features/products/ProductsPage.tsx"
click node_quotations "https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/features/quotations/QuotationBuilder.tsx"
click node_settings "https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/features/settings/SettingsPages.tsx"
click node_queries "https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/hooks/queries.ts"
click node_templates "https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/hooks/useTemplates.ts"
click node_api "https://github.com/balamanikantatirunagaram-lgtm/invgen-web/tree/main/src/app/api"
click node_gstapi "https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/api/gstVerify.ts"
click node_session "https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/stores/session.ts"
click node_supabase "https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/supabase/client.ts"
click node_gstproxy "https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/supabase/functions/verify-gst/index.ts"
click node_math "https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/lib/gst.ts"
click node_invoicepreview "https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/features/invoices/PdfPreviewPage.tsx"
click node_quotationpreview "https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/features/quotations/QuotationPdfPreview.tsx"
click node_pdfbuild "https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/pdf/buildPdf.ts"
click node_pdfdocument "https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/pdf/invoiceDocument.tsx"
click node_pdfactions "https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/pdf/print.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_marketing,node_login,node_guards,node_verify,node_onboarding toneBlue
class node_dashboard,node_invoicebuilder,node_ledger,node_clients,node_products,node_quotations,node_settings,node_supastores toneAmber
class node_queries,node_templates,node_api,node_gstapi,node_session,node_supabase,node_gstproxy toneMint
class node_math,node_invoicepreview,node_quotationpreview,node_pdfbuild,node_pdfdocument,node_pdfactions toneRose
class node_visitor toneIndigo
```

## Components

### Entry and access

- [Marketing site](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/App.tsx): `src/App.tsx`
- [Login](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/features/auth/LoginPage.tsx): `src/app/features/auth/LoginPage.tsx`
- [Route guards](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/routes/RequireAuth.tsx): `src/app/routes/RequireAuth.tsx`
- [GST verification](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/features/auth/VerifyGstPage.tsx): `src/app/features/auth/VerifyGstPage.tsx`
- [Onboarding](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/features/onboarding/WelcomeWizard.tsx): `src/app/features/onboarding/WelcomeWizard.tsx`

### Invoicing workspace

- [Dashboard](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/features/dashboard/DashboardPage.tsx): `src/app/features/dashboard/DashboardPage.tsx`
- [Invoice builder](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/features/invoices/BuilderPage.tsx): `src/app/features/invoices/BuilderPage.tsx`
- [Invoice ledger](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/features/invoices/LedgerPage.tsx): `src/app/features/invoices/LedgerPage.tsx`
- [Client directory](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/features/clients/ClientsPage.tsx): `src/app/features/clients/ClientsPage.tsx`
- [Product catalog](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/features/products/ProductsPage.tsx): `src/app/features/products/ProductsPage.tsx`
- [Quotations](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/features/quotations/QuotationBuilder.tsx): `src/app/features/quotations/QuotationBuilder.tsx`
- [Settings](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/features/settings/SettingsPages.tsx): `src/app/features/settings/SettingsPages.tsx`

### Data and services

- [Query and mutation hooks](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/hooks/queries.ts): `src/app/hooks/queries.ts`
- [Template loader](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/hooks/useTemplates.ts): `src/app/hooks/useTemplates.ts`
- [Supabase repositories](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/tree/main/src/app/api): `src/app/api`
- [GST lookup API](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/api/gstVerify.ts): `src/app/api/gstVerify.ts`
- [Session state](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/stores/session.ts): `src/app/stores/session.ts`
- [Supabase client](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/supabase/client.ts): `src/app/supabase/client.ts`
- [GST verification proxy](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/supabase/functions/verify-gst/index.ts): `supabase/functions/verify-gst/index.ts`

### Document output

- [GST and formatting rules](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/lib/gst.ts): `src/app/lib/gst.ts`
- [Invoice PDF preview](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/features/invoices/PdfPreviewPage.tsx): `src/app/features/invoices/PdfPreviewPage.tsx`
- [Quotation PDF preview](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/features/quotations/QuotationPdfPreview.tsx): `src/app/features/quotations/QuotationPdfPreview.tsx`
- [PDF builder](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/pdf/buildPdf.ts): `src/app/pdf/buildPdf.ts`
- [Invoice templates](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/pdf/invoiceDocument.tsx): `src/app/pdf/invoiceDocument.tsx`
- [Print and download](https://github.com/balamanikantatirunagaram-lgtm/invgen-web/blob/main/src/app/pdf/print.ts): `src/app/pdf/print.ts`

### Other components

- **Visitor**
- **Supabase database and auth**

## Connections

- Visitor → Marketing site: browses (evidence: `src/App.tsx`)
- Marketing site → Login: starts access (evidence: `src/App.tsx`)
- Login → Route guards: enters app
- Route guards → GST verification: requires verification (evidence: `src/App.tsx`)
- GST verification → Onboarding: continues setup (evidence: `README.md`)
- Onboarding → Dashboard: opens workspace (evidence: `README.md`)
- Dashboard → Query and mutation hooks: loads workspace data (evidence: `src/app/features/dashboard/DashboardPage.tsx`)
- Invoice builder → Query and mutation hooks: reads and saves (evidence: `src/app/hooks/queries.ts`)
- Invoice ledger → Query and mutation hooks: loads invoices (evidence: `src/app/hooks/queries.ts`)
- Client directory → Query and mutation hooks: manages clients (evidence: `src/app/features/clients/ClientsPage.tsx`)
- Client directory → GST lookup API: checks GSTIN (evidence: `src/app/features/clients/ClientsPage.tsx`)
- Product catalog → Query and mutation hooks: manages products (evidence: `src/app/hooks/queries.ts`)
- Quotations → Query and mutation hooks: reads and saves (evidence: `src/app/hooks/queries.ts`)
- Settings → Query and mutation hooks: loads settings (evidence: `src/app/hooks/queries.ts`)
- GST verification → GST lookup API: requests verification (evidence: `src/app/features/auth/VerifyGstPage.tsx`)
- GST verification → Session state: updates session (evidence: `src/app/features/auth/VerifyGstPage.tsx`)
- Query and mutation hooks → Supabase repositories: calls repositories (evidence: `src/app/hooks/queries.ts`)
- Supabase repositories → Supabase client: uses client (evidence: `src/app/api/companies.ts`)
- GST lookup API → Supabase client: uses client (evidence: `src/app/api/gstVerify.ts`)
- Template loader → Supabase client: loads templates (evidence: `src/app/hooks/useTemplates.ts`)
- Supabase client → Supabase database and auth: accesses shared backend (evidence: `README.md`)
- GST lookup API → GST verification proxy: uses verification proxy
- Invoice builder → GST and formatting rules: uses GST rules (evidence: `README.md`)
- Invoice PDF preview → Query and mutation hooks: loads invoice data (evidence: `src/app/features/invoices/PdfPreviewPage.tsx`)
- Invoice PDF preview → Template loader: loads templates (evidence: `src/app/features/invoices/PdfPreviewPage.tsx`)
- Invoice PDF preview → GST and formatting rules: uses shared formatting (evidence: `README.md`)
- Invoice PDF preview → PDF builder: builds PDF (evidence: `src/app/features/invoices/PdfPreviewPage.tsx`)
- Quotation PDF preview → Query and mutation hooks: loads quotation data (evidence: `src/app/features/quotations/QuotationPdfPreview.tsx`)
- Quotation PDF preview → Template loader: loads templates (evidence: `src/app/features/quotations/QuotationPdfPreview.tsx`)
- Quotation PDF preview → PDF builder: builds PDF (evidence: `src/app/features/quotations/QuotationPdfPreview.tsx`)
- PDF builder → Invoice templates: renders document (evidence: `src/app/pdf/buildPdf.ts`)
- Invoice templates → GST and formatting rules: uses shared formatting (evidence: `src/app/pdf/invoiceDocument.tsx`)
- Invoice PDF preview → Print and download: prints PDF (evidence: `src/app/features/invoices/PdfPreviewPage.tsx`)
- Quotation PDF preview → Print and download: prints PDF (evidence: `src/app/features/quotations/QuotationPdfPreview.tsx`)
