Skip to main content

Project Structure

sahyog-heena-jwellers/
├── backend/
│   ├── src/sj/
│   │   ├── __init__.py                   # App initialization & CORS
│   │   ├── app.py                        # FastAPI app factory
│   │   ├── config.py                     # Env var config
│   │   ├── db.py                         # DB engine & session
│   │   ├── deps.py                       # Dependency injection
│   │   ├── schema.py                     # SQLAlchemy ORM models
│   │   ├── routes.py                     # Main API routes (~2600 lines)
│   │   ├── order_draft_routes.py         # Order draft routes
│   │   ├── khata_router.py               # Khata submission routes
│   │   ├── gupshup_incoming_webhook.py   # WhatsApp webhook handler
│   │   ├── gupshup.py                    # Gupshup API helpers
│   │   ├── services.py                   # Core business logic
│   │   ├── khata_services.py             # Khata processing (v1)
│   │   ├── khata_services_v2.py          # Khata processing (v2)
│   │   ├── khata_upload.py               # Khata upload handlers
│   │   └── pdf_service.py               # PDF generation helpers
│   ├── tests/                            # Pytest test suite
│   ├── alembic/                          # DB migrations
│   ├── pyproject.toml                    # Poetry config
│   └── .env                             # Environment variables

└── frontend/
    ├── src/
    │   ├── main.tsx                      # React entry point
    │   ├── App.tsx                       # Root component + routing
    │   ├── pages/                        # Page-level components
    │   ├── components/                   # Reusable UI components
    │   ├── store/                        # Zustand stores
    │   ├── lib/
    │   │   └── axiosInstance.ts          # Configured Axios instance
    │   ├── types/
    │   │   └── RecordTypes.ts            # TypeScript interfaces
    │   └── utils/
    │       └── helper.ts
    ├── package.json
    └── vite.config.ts

Frontend Routes

All routes are nested under DashboardLayout which renders the sidebar navigation.
PathComponentDescription
/order-draftsOrderDraftsPending WhatsApp order drafts
/order-drafts/:draftIdOrderDraftEditReview and edit a specific draft
/client-orderClientOrderManage client orders
/takadaTakadaManage takadas (partial deliveries)
/karigar-accountKarigarAccountList of all karigars
/karigar-account/:idKarigarLedgerKarigar ledger detail
/polisher-accountPolishAccountList of all polishers
/polisher-account/:idPolisherLedgerPolisher ledger detail
/client-accountClientAccountList of all clients
/client-account/:idClientLedgerClient ledger detail
/bank-accountBankAccountList of all bank accounts
/bank-account/:idBankLedgerBank ledger detail
/bullion-accountBullionAccountList of all bullion accounts
/bullion-account/:idBullionLedgerBullion ledger detail
/khata-uploadKhataUploadKhata OCR upload (v1)
/khata-upload-2KhataUpload2Khata OCR upload (v2)

State Management

The frontend uses Zustand for global state.

useDataStore

Holds master data loaded at app startup.
StateTypeDescription
clientsClient[]All clients
karigarsKarigar[]All karigars
karigarListKarigar[]Karigar list for dropdowns
polisherListPolisher[]Polisher list for dropdowns
polishAccountPolisher[]Polisher account data
clientAccountClient[]Client account data
bankAccountBankAccount[]Bank accounts
bullionAccountBullionAccount[]Bullion accounts
takadaTakada[]All takadas
Actions:
  • fetchClientsAndKarigars() — fetches clients and karigars
  • fetchPolishers() — fetches polisher data

clientOrdersStore

Manages client order state including filtering, pagination, and selected order.

useAccessibilityStore

Stores user accessibility preferences (e.g. font size, high contrast).