# desniniranjan/dhanush-bill architecture

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

- Interactive diagram: https://gitdiagram.com/desniniranjan/dhanush-bill
- Repository: https://github.com/desniniranjan/dhanush-bill

## Overview

1. **Project shape**
   - This is a small **full-stack billing/invoice app** with a clear split between a **React/TypeScript frontend** and a **Node.js/Express backend**.
   - The app’s core domain is managing **bills/invoices**, with authentication and persistence delegated to Supabase.

2. **Frontend entry and shell**
   - `index.html` is the browser entry point.
   - `src/main.tsx` bootstraps the React app.
   - `src/App.tsx` is the main UI container/screen composition point.

3. **Frontend presentation layer**
   - `src/index.css` holds the global styling for the UI.
   - The frontend is built with **Vite**, so the client side is optimized for fast local development and static asset bundling.

4. **Backend entry**
   - `server.ts` is the server-side runtime entry point.
   - Based on the README, this is the **Express** layer, likely responsible for API endpoints and any server-side integration with auth/data services.

5. **Persistence and auth boundary**
   - The app uses **Supabase** as the main backend service for:
     - database storage for bills/invoices
     - authentication
     - real-time data updates
   - The README also mentions **JWT**, implying authenticated requests are validated through token-based auth rather than server sessions.

6. **Main data flow**
   - User interacts with the React UI.
   - Frontend sends requests to the Node/Express server and/or directly to Supabase depending on the operation.
   - Supabase stores and returns invoice/bill data, and authentication state drives access to protected actions.

7. **Configuration and environment**
   - `.env` and `.env.example` indicate runtime configuration is environment-driven.
   - These likely contain Supabase credentials, JWT-related secrets, and server port/config values.
   - `metadata.json` is likely auxiliary project metadata rather than a runtime subsystem.

8. **Build and tooling**
   - `package.json` / `package-lock.json` define the dependency graph and scripts.
   - `tsconfig.json` indicates the whole stack is TypeScript-based.
   - `vite.config.ts` customizes the frontend build/dev server.

9. **Deployment/runtime hints**
   - `Procfile` suggests the app is meant to run in a platform that uses process declarations.
   - `nixpacks.toml` suggests containerized or platform-managed builds are supported.
   - This implies a deployable service with both frontend and backend packaged together.

10. **Important architectural boundary for diagrams**
   - Draw the system with three major boxes:
     - **Browser/UI**: React app
     - **Application server**: Node/Express in `server.ts`
     - **External backend service**: Supabase
   - The critical boundary is that **Supabase owns auth and data**, while the app server and React UI orchestrate user interactions and business flows.

Main entry points: [`server.ts`](https://github.com/desniniranjan/dhanush-bill/blob/main/server.ts) (server.ts), [`src/App.tsx`](https://github.com/desniniranjan/dhanush-bill/blob/main/src/App.tsx) (App.tsx), [`package.json`](https://github.com/desniniranjan/dhanush-bill/blob/main/package.json) (package.json), [`src/main.tsx`](https://github.com/desniniranjan/dhanush-bill/blob/main/src/main.tsx) (main.tsx)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser/UI"]
  node_index_html["index.html<br/>browser entry<br/>[index.html]"]
  node_main_tsx["main.tsx<br/>react bootstrap<br/>[main.tsx]"]
  node_app_tsx["App.tsx<br/>ui shell<br/>[App.tsx]"]
  node_styles_css["index.css<br/>global styles<br/>[index.css]"]
end

subgraph group_server["App Server"]
  node_server_ts["server.ts<br/>express api<br/>[server.ts]"]
  node_env_config[".env<br/>runtime config<br/>[.env]"]
end

subgraph group_platform["Platform"]
  node_vite_config["vite.config.ts<br/>vite config<br/>[vite.config.ts]"]
  node_tsconfig["tsconfig.json<br/>typescript config<br/>[tsconfig.json]"]
  node_package_json["package.json<br/>deps/scripts<br/>[package.json]"]
  node_procfile["Procfile<br/>process start"]
  node_nixpacks["nixpacks.toml<br/>build config<br/>[nixpacks.toml]"]
  node_metadata["metadata.json<br/>project metadata<br/>[metadata.json]"]
end

subgraph group_supabase["Supabase"]
  node_supabase_auth(("Auth"))
  node_supabase_db[("Database<br/>supabase data")]
  node_supabase_realtime["Realtime<br/>supabase stream"]
  node_jwt{{"JWT<br/>token auth"}}
end

node_index_html -->|"loads"| node_main_tsx
node_main_tsx -->|"mounts"| node_app_tsx
node_app_tsx -->|"uses"| node_styles_css
node_app_tsx -->|"calls"| node_server_ts
node_app_tsx -->|"auth"| node_supabase_auth
node_app_tsx -->|"reads/writes"| node_supabase_db
node_app_tsx -->|"subscribes"| node_supabase_realtime
node_server_ts -->|"reads"| node_env_config
node_server_ts -->|"validates"| node_jwt
node_server_ts -->|"integrates"| node_supabase_auth
node_server_ts -->|"persists"| node_supabase_db
node_server_ts -->|"publishes"| node_supabase_realtime
node_vite_config -->|"builds"| node_main_tsx
node_vite_config -->|"bundles"| node_app_tsx
node_tsconfig -->|"types"| node_main_tsx
node_tsconfig -->|"types"| node_server_ts
node_package_json -->|"scripts"| node_vite_config
node_package_json -->|"deps"| node_server_ts
node_procfile -->|"starts"| node_server_ts
node_nixpacks -->|"builds"| node_package_json
node_metadata -->|"describes"| node_package_json

click node_index_html "https://github.com/desniniranjan/dhanush-bill/blob/main/index.html"
click node_main_tsx "https://github.com/desniniranjan/dhanush-bill/blob/main/src/main.tsx"
click node_app_tsx "https://github.com/desniniranjan/dhanush-bill/blob/main/src/App.tsx"
click node_styles_css "https://github.com/desniniranjan/dhanush-bill/blob/main/src/index.css"
click node_server_ts "https://github.com/desniniranjan/dhanush-bill/blob/main/server.ts"
click node_env_config "https://github.com/desniniranjan/dhanush-bill/blob/main/.env"
click node_vite_config "https://github.com/desniniranjan/dhanush-bill/blob/main/vite.config.ts"
click node_tsconfig "https://github.com/desniniranjan/dhanush-bill/blob/main/tsconfig.json"
click node_package_json "https://github.com/desniniranjan/dhanush-bill/blob/main/package.json"
click node_procfile "https://github.com/desniniranjan/dhanush-bill/tree/main/Procfile"
click node_nixpacks "https://github.com/desniniranjan/dhanush-bill/blob/main/nixpacks.toml"
click node_metadata "https://github.com/desniniranjan/dhanush-bill/blob/main/metadata.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_index_html,node_main_tsx,node_app_tsx,node_styles_css toneBlue
class node_server_ts,node_env_config toneAmber
class node_vite_config,node_tsconfig,node_package_json,node_procfile,node_nixpacks,node_metadata toneMint
class node_supabase_auth,node_supabase_db,node_supabase_realtime,node_jwt toneRose
```

## Components

### Browser/UI

React frontend shell and presentation layer

- [index.html](https://github.com/desniniranjan/dhanush-bill/blob/main/index.html): browser entry · HTML entry point that loads the client app · `index.html`
- [main.tsx](https://github.com/desniniranjan/dhanush-bill/blob/main/src/main.tsx): react bootstrap · Bootstraps the React application · `src/main.tsx`
- [App.tsx](https://github.com/desniniranjan/dhanush-bill/blob/main/src/App.tsx): ui shell · Main application container and screen composition · `src/App.tsx`
- [index.css](https://github.com/desniniranjan/dhanush-bill/blob/main/src/index.css): global styles · Shared styling for the UI · `src/index.css`

### App Server

Node and Express runtime for API and integration logic

- [server.ts](https://github.com/desniniranjan/dhanush-bill/blob/main/server.ts): express api · Server entry point for API and backend integration · `server.ts`
- [.env](https://github.com/desniniranjan/dhanush-bill/blob/main/.env): runtime config · Environment-driven secrets and service settings · `.env`

### Platform

Build, deployment, and runtime configuration

- [vite.config.ts](https://github.com/desniniranjan/dhanush-bill/blob/main/vite.config.ts): vite config · Frontend build and dev-server configuration · `vite.config.ts`
- [tsconfig.json](https://github.com/desniniranjan/dhanush-bill/blob/main/tsconfig.json): typescript config · TypeScript compiler settings · `tsconfig.json`
- [package.json](https://github.com/desniniranjan/dhanush-bill/blob/main/package.json): deps/scripts · Dependency graph and project scripts · `package.json`
- [Procfile](https://github.com/desniniranjan/dhanush-bill/tree/main/Procfile): process start · Deployment process declaration · `Procfile`
- [nixpacks.toml](https://github.com/desniniranjan/dhanush-bill/blob/main/nixpacks.toml): build config · Platform-managed build configuration · `nixpacks.toml`
- [metadata.json](https://github.com/desniniranjan/dhanush-bill/blob/main/metadata.json): project metadata · Auxiliary repository metadata · `metadata.json`

### Supabase

External auth, database, and realtime backend

- **Auth**: supabase auth · External authentication boundary
- **Database**: supabase data · Persistent storage for bills and invoices
- **Realtime**: supabase stream · Live data updates from Supabase
- **JWT**: token auth · Token-based request validation boundary

## Connections

- index.html → main.tsx: loads · Browser entry loads the React bootstrap
- main.tsx → App.tsx: mounts · Bootstrap renders the main app shell
- App.tsx → index.css: uses · UI shell applies global styles
- App.tsx → server.ts: calls · Frontend invokes backend API flows
- App.tsx → Auth: auth · User state and protected actions depend on Supabase auth
- App.tsx → Database: reads/writes · UI-driven bill and invoice operations touch persistent data
- App.tsx → Realtime: subscribes · Client listens for live updates
- server.ts → .env: reads · Server runtime is configured from environment variables
- server.ts → JWT: validates · Server verifies token-based access
- server.ts → Auth: integrates · Backend coordinates with Supabase authentication
- server.ts → Database: persists · Server-side business flows store and fetch data
- server.ts → Realtime: publishes · Backend participates in realtime-backed workflows
- vite.config.ts → main.tsx: builds · Vite compiles the client entry
- vite.config.ts → App.tsx: bundles · Frontend source is included in the Vite build
- tsconfig.json → main.tsx: types · TypeScript settings govern client code
- tsconfig.json → server.ts: types · TypeScript settings govern server code
- package.json → vite.config.ts: scripts · Project scripts drive the client toolchain
- package.json → server.ts: deps · Dependencies and scripts support the backend runtime
- Procfile → server.ts: starts · Process declaration launches the server runtime
- nixpacks.toml → package.json: builds · Platform build uses project scripts and dependencies
- metadata.json → package.json: describes · Auxiliary metadata references the project package
