# krishna-040893/powerca_website architecture

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

- Interactive diagram: https://gitdiagram.com/krishna-040893/powerca_website
- Repository: https://github.com/krishna-040893/powerca_website

## Overview

PowerCA is a SaaS practice-management platform for Chartered Accountants. The visible user journey includes account registration, payment verification, invoice generation and storage; its API routes also support affiliate referrals and administrative commission management. The README additionally describes job, client, billing, compliance, task, financial-statement, CRM, and costing capabilities. Those product areas are represented as documented capabilities, not claims about inspected implementations. Source excerpts establish the registration, payment, invoice-storage, and affiliate-admin links; other links are limited to relationships explicitly described in the README.

Main entry points: [`src/lib/supabase/admin.ts`](https://github.com/krishna-040893/powerca_website/blob/main/src/lib/supabase/admin.ts) (Supabase data), [`src/app/dashboard/page.tsx`](https://github.com/krishna-040893/powerca_website/blob/main/src/app/dashboard/page.tsx) (Practice capabilities), [`src/app/api/payment/verify/route.ts`](https://github.com/krishna-040893/powerca_website/blob/main/src/app/api/payment/verify/route.ts) (Payment verification), [`src/app`](https://github.com/krishna-040893/powerca_website/tree/main/src/app) (Web experience)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_product["Practice platform"]
  node_web["Web experience"]
  node_practice["Practice capabilities<br/>[page.tsx]"]
  node_client["Client and job records<br/>[page.tsx]"]
  node_compliance["Compliance and tasks<br/>[page.tsx]"]
  node_financials["Statements and costing<br/>[page.tsx]"]
end

subgraph group_identity["Identity and access"]
  node_registration["Registration API<br/>[route.ts]"]
  node_registrations["Registration API<br/>[route.ts]"]
  node_auth["Auth services<br/>[auth.ts]"]
  node_adminauth["Admin sessions<br/>[admin-session.ts]"]
end

subgraph group_commerce["Payments and billing"]
  node_payment["Payment verification<br/>[route.ts]"]
  node_invoices["Invoice generation"]
  node_invoicefiles[("Invoice storage<br/>[invoice-storage.ts]")]
end

subgraph group_growth["Affiliate program"]
  node_affiliate["Affiliate experience"]
  node_affiliateapi["Affiliate APIs"]
  node_admin["Admin portal"]
  node_commission["Commission management<br/>[route.ts]"]
  node_referrals["Referral management<br/>[route.ts]"]
end

subgraph group_operations["Shared services"]
  node_database[("Supabase data<br/>[admin.ts]")]
  node_email["Email delivery<br/>[send-emails.ts]"]
  node_crm["CRM integration<br/>[crm.ts]"]
end

node_accountant(("CA practice user"))
node_razorpay["Razorpay"]
node_resend["Resend"]

node_accountant -->|"uses"| node_web
node_web -->|"accesses"| node_practice
node_accountant -->|"registers"| node_registration
node_registration -->|"writes registration"| node_database
node_registration -->|"sends welcome"| node_email
node_accountant -.->|"submits details"| node_registrations
node_registrations -->|"writes records"| node_database
node_web -.->|"verifies payment"| node_payment
node_payment -->|"reads and writes"| node_database
node_payment -->|"generates invoice"| node_invoices
node_payment -->|"uploads invoice"| node_invoicefiles
node_invoicefiles -->|"stores PDF"| node_database
node_payment -.->|"verifies gateway payment"| node_razorpay
node_web -->|"opens program"| node_affiliate
node_affiliate -.->|"requests referral actions"| node_affiliateapi
node_admin -->|"manages commissions"| node_commission
node_admin -->|"manages referrals"| node_referrals
node_commission -->|"checks session"| node_adminauth
node_commission -->|"reads and updates"| node_database
node_referrals -->|"checks session"| node_adminauth
node_referrals -->|"reads referral data"| node_database
node_email -->|"sends messages"| node_resend
node_practice -->|"supports management"| node_client
node_practice -->|"tracks deadlines"| node_compliance
node_practice -->|"provides reporting"| node_financials
node_practice -->|"integrates CRM"| node_crm

click node_web "https://github.com/krishna-040893/powerca_website/tree/main/src/app"
click node_practice "https://github.com/krishna-040893/powerca_website/blob/main/src/app/dashboard/page.tsx"
click node_registration "https://github.com/krishna-040893/powerca_website/blob/main/src/app/api/auth/register/route.ts"
click node_registrations "https://github.com/krishna-040893/powerca_website/blob/main/src/app/api/registrations/route.ts"
click node_auth "https://github.com/krishna-040893/powerca_website/blob/main/src/lib/auth.ts"
click node_adminauth "https://github.com/krishna-040893/powerca_website/blob/main/src/lib/auth/admin-session.ts"
click node_database "https://github.com/krishna-040893/powerca_website/blob/main/src/lib/supabase/admin.ts"
click node_payment "https://github.com/krishna-040893/powerca_website/blob/main/src/app/api/payment/verify/route.ts"
click node_invoices "https://github.com/krishna-040893/powerca_website/blob/main/src/lib/invoice-generator.ts"
click node_invoicefiles "https://github.com/krishna-040893/powerca_website/blob/main/src/lib/invoice-storage.ts"
click node_affiliate "https://github.com/krishna-040893/powerca_website/tree/main/src/app/affiliate"
click node_affiliateapi "https://github.com/krishna-040893/powerca_website/tree/main/src/app/api/affiliate"
click node_admin "https://github.com/krishna-040893/powerca_website/tree/main/src/app/admin"
click node_commission "https://github.com/krishna-040893/powerca_website/blob/main/src/app/api/admin/affiliate-payments/route.ts"
click node_referrals "https://github.com/krishna-040893/powerca_website/blob/main/src/app/api/admin/affiliate-referrals/route.ts"
click node_email "https://github.com/krishna-040893/powerca_website/blob/main/src/lib/send-emails.ts"
click node_crm "https://github.com/krishna-040893/powerca_website/blob/main/src/lib/crm.ts"
click node_client "https://github.com/krishna-040893/powerca_website/blob/main/src/app/dashboard/page.tsx"
click node_compliance "https://github.com/krishna-040893/powerca_website/blob/main/src/app/dashboard/page.tsx"
click node_financials "https://github.com/krishna-040893/powerca_website/blob/main/src/app/dashboard/page.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_web,node_practice,node_client,node_compliance,node_financials,node_accountant toneBlue
class node_registration,node_registrations,node_auth,node_adminauth toneAmber
class node_payment,node_invoices,node_invoicefiles toneMint
class node_affiliate,node_affiliateapi,node_admin,node_commission,node_referrals toneRose
class node_database,node_email,node_crm,node_razorpay,node_resend toneIndigo
```

## Components

### Practice platform

- [Web experience](https://github.com/krishna-040893/powerca_website/tree/main/src/app): `src/app`
- [Practice capabilities](https://github.com/krishna-040893/powerca_website/blob/main/src/app/dashboard/page.tsx): `src/app/dashboard/page.tsx`
- [Client and job records](https://github.com/krishna-040893/powerca_website/blob/main/src/app/dashboard/page.tsx): `src/app/dashboard/page.tsx`
- [Compliance and tasks](https://github.com/krishna-040893/powerca_website/blob/main/src/app/dashboard/page.tsx): `src/app/dashboard/page.tsx`
- [Statements and costing](https://github.com/krishna-040893/powerca_website/blob/main/src/app/dashboard/page.tsx): `src/app/dashboard/page.tsx`

### Identity and access

- [Registration API](https://github.com/krishna-040893/powerca_website/blob/main/src/app/api/auth/register/route.ts): `src/app/api/auth/register/route.ts`
- [Registration API](https://github.com/krishna-040893/powerca_website/blob/main/src/app/api/registrations/route.ts): `src/app/api/registrations/route.ts`
- [Auth services](https://github.com/krishna-040893/powerca_website/blob/main/src/lib/auth.ts): `src/lib/auth.ts`
- [Admin sessions](https://github.com/krishna-040893/powerca_website/blob/main/src/lib/auth/admin-session.ts): `src/lib/auth/admin-session.ts`

### Payments and billing

- [Payment verification](https://github.com/krishna-040893/powerca_website/blob/main/src/app/api/payment/verify/route.ts): `src/app/api/payment/verify/route.ts`
- [Invoice generation](https://github.com/krishna-040893/powerca_website/blob/main/src/lib/invoice-generator.ts): `src/lib/invoice-generator.ts`
- [Invoice storage](https://github.com/krishna-040893/powerca_website/blob/main/src/lib/invoice-storage.ts): `src/lib/invoice-storage.ts`

### Affiliate program

- [Affiliate experience](https://github.com/krishna-040893/powerca_website/tree/main/src/app/affiliate): `src/app/affiliate`
- [Affiliate APIs](https://github.com/krishna-040893/powerca_website/tree/main/src/app/api/affiliate): `src/app/api/affiliate`
- [Admin portal](https://github.com/krishna-040893/powerca_website/tree/main/src/app/admin): `src/app/admin`
- [Commission management](https://github.com/krishna-040893/powerca_website/blob/main/src/app/api/admin/affiliate-payments/route.ts): `src/app/api/admin/affiliate-payments/route.ts`
- [Referral management](https://github.com/krishna-040893/powerca_website/blob/main/src/app/api/admin/affiliate-referrals/route.ts): `src/app/api/admin/affiliate-referrals/route.ts`

### Shared services

- [Supabase data](https://github.com/krishna-040893/powerca_website/blob/main/src/lib/supabase/admin.ts): `src/lib/supabase/admin.ts`
- [Email delivery](https://github.com/krishna-040893/powerca_website/blob/main/src/lib/send-emails.ts): `src/lib/send-emails.ts`
- [CRM integration](https://github.com/krishna-040893/powerca_website/blob/main/src/lib/crm.ts): `src/lib/crm.ts`

### Other components

- **CA practice user**
- **Razorpay**
- **Resend**

## Connections

- CA practice user → Web experience: uses (evidence: `README.md`)
- Web experience → Practice capabilities: accesses (evidence: `README.md`)
- CA practice user → Registration API: registers (evidence: `README.md`)
- Registration API → Supabase data: writes registration (evidence: `src/app/api/auth/register/route.ts`)
- Registration API → Email delivery: sends welcome (evidence: `src/app/api/auth/register/route.ts`)
- CA practice user → Registration API: submits details
- Registration API → Supabase data: writes records (evidence: `src/app/api/registrations/route.ts`)
- Web experience → Payment verification: verifies payment
- Payment verification → Supabase data: reads and writes (evidence: `src/app/api/payment/verify/route.ts`)
- Payment verification → Invoice generation: generates invoice (evidence: `src/app/api/payment/verify/route.ts`)
- Payment verification → Invoice storage: uploads invoice (evidence: `src/app/api/payment/verify/route.ts`)
- Invoice storage → Supabase data: stores PDF (evidence: `src/lib/invoice-storage.ts`)
- Payment verification → Razorpay: verifies gateway payment
- Web experience → Affiliate experience: opens program (evidence: `README.md`)
- Affiliate experience → Affiliate APIs: requests referral actions
- Admin portal → Commission management: manages commissions (evidence: `README.md`)
- Admin portal → Referral management: manages referrals (evidence: `README.md`)
- Commission management → Admin sessions: checks session (evidence: `src/app/api/admin/affiliate-payments/route.ts`)
- Commission management → Supabase data: reads and updates (evidence: `src/app/api/admin/affiliate-payments/route.ts`)
- Referral management → Admin sessions: checks session (evidence: `src/app/api/admin/affiliate-referrals/route.ts`)
- Referral management → Supabase data: reads referral data (evidence: `src/app/api/admin/affiliate-referrals/route.ts`)
- Email delivery → Resend: sends messages (evidence: `src/lib/send-emails.ts`)
- Practice capabilities → Client and job records: supports management (evidence: `README.md`)
- Practice capabilities → Compliance and tasks: tracks deadlines (evidence: `README.md`)
- Practice capabilities → Statements and costing: provides reporting (evidence: `README.md`)
- Practice capabilities → CRM integration: integrates CRM (evidence: `README.md`)
