How muneeb0346/d-khata works
D-Khata is a merchant-facing credit ledger with a customer-facing transaction-consensus flow. Merchants register customers, record credit, and share a customer-specific ledger link; customers verify or reject pending entries, and the ledger enforces a lock until resolution. The graph includes the main dashboard and public ledger, domain actions, and persistence/reconciliation. Several documented capabilities are represented at directory level where implementation excerpts were unavailable; those relationships are omitted unless the README or sampled source supports them.
Main entry points: actions.ts Server action exports · page.tsx Dashboard · LedgerViewContent.tsx Ledger details · customer.ts Customer actions
Components 25
Merchant dashboard
- Dashboard
src/app/page.tsx - Customer list
src/components/dashboard/CustomerList.tsx - Customer form
src/components/dashboard/NewCustomerForm.tsx - Active ledger view
src/components/dashboard/ActiveLedgerView.tsx - Ledger details
src/components/dashboard/LedgerViewContent.tsx - Ledger forms
src/components/dashboard/LedgerFormSheet.tsx - Credit entry form
src/components/dashboard/AddCreditForm.tsx - Payment form
src/components/dashboard/ReceivePayForm.tsx - Customer deletion
src/components/dashboard/DeleteCustomerFlow.tsx - WhatsApp sharing
src/hooks/useWhatsAppShare.ts
Customer ledger
- Public ledger page
src/app/khata/[customerId]/page.tsx - Transaction history
src/components/khata/TransactionList.tsx - Balance graph
src/components/charts/BalanceGraph.tsx
Domain operations
- Server action exports
src/server/actions.ts - Customer actions
src/server/actions/customer.ts - Ledger actions
src/server/actions/ledger.ts
Persistence and logic
- PostgreSQL database
src/server/db/index.ts - Data schema
src/server/db/schema.ts - Ledger reconciliation
src/server/db/reconcile.ts - Input validation
src/server/lib/validation.ts - Action schemas
src/server/lib/schemas.ts - Input and balance formatting
src/utils/formatters.ts
Other components
- Merchant
- Customer
Connections 33
- Merchant → Dashboard: uses
README.md - Dashboard → Customer list: renders
src/app/page.tsx - Dashboard → Customer form: renders
src/app/page.tsx - Dashboard → Active ledger view: opens
src/app/page.tsx - Dashboard → Server action exports: fetches customers
src/app/page.tsx - Customer form → Server action exports: creates or edits
src/components/dashboard/NewCustomerForm.tsx - Customer form → Input and balance formatting: formats input
src/components/dashboard/NewCustomerForm.tsx - Active ledger view → Ledger details: renders
src/components/dashboard/ActiveLedgerView.tsx - Active ledger view → WhatsApp sharing: uses
src/components/dashboard/ActiveLedgerView.tsx - WhatsApp sharing → WhatsApp: shares link
README.md - Ledger details → Transaction history: renders
src/components/dashboard/LedgerViewContent.tsx - Ledger details → Balance graph: renders
src/components/dashboard/LedgerViewContent.tsx - Ledger details → Ledger forms: opens forms
src/components/dashboard/LedgerViewContent.tsx - Ledger details → Customer deletion: renders
src/components/dashboard/LedgerViewContent.tsx - Ledger forms → Credit entry form: renders
src/components/dashboard/LedgerFormSheet.tsx - Ledger forms → Payment form: renders
src/components/dashboard/LedgerFormSheet.tsx - Ledger forms → Server action exports: submits actions
src/components/dashboard/LedgerFormSheet.tsx - Customer deletion → Server action exports: deletes customer
src/components/dashboard/DeleteCustomerFlow.tsx - Customer → Public ledger page: opens shared link
README.md - Public ledger page → Server action exports: loads and resolves
src/app/khata/[customerId]/page.tsx - Public ledger page → Transaction history: renders
src/app/khata/[customerId]/page.tsx - Public ledger page → Balance graph: renders
src/app/khata/[customerId]/page.tsx - Server action exports → Customer actions: exports
src/server/actions.ts - Server action exports → Ledger actions: exports
src/server/actions.ts - Customer actions → PostgreSQL database: reads and writes
src/server/actions/customer.ts - Customer actions → Data schema: uses tables
src/server/actions/customer.ts - Customer actions → Input validation: validates input
src/server/actions/customer.ts - Customer actions → Action schemas: uses schemas
src/server/actions/customer.ts - Ledger actions → PostgreSQL database: reads and writes
src/server/actions/ledger.ts - Ledger actions → Data schema: uses tables
src/server/actions/ledger.ts - Ledger actions → Ledger reconciliation: reconciles balances
src/server/actions/ledger.ts - Ledger actions → Action schemas: validates actions
src/server/actions/ledger.ts - PostgreSQL database → Data schema: initializes tables
src/server/db/index.ts