How farazpatwegar/testapp works
DukaanSaathi is a shop-management app: shop staff onboard or sign in, manage products and customers, record sales and expenses, track credit (Udhaar), and review reports. The React Native app keeps a local cache and syncs domain actions with a versioned backend API; the backend authenticates shop membership and persists business operations. The sampled code confirms the app entry, sale flow, API client, cache/sync behavior, and selected backend routes. Other documented-by-tree screens and backend modules are represented, but their internal calls are not inferred where source excerpts were unavailable.
Main entry points: server.ts API server · auth.ts Auth middleware · App.tsx App navigation · main_navigation_screen.tsx Shop workspace
Components 28
Mobile app
- App navigation
App.tsx - Onboarding
src/screens/onboarding_screen.tsx - Shop workspace
src/screens/main_navigation_screen.tsx - POS scanner
src/screens/pos_scanner_screen.tsx - Sale entry
src/screens/add_sale_screen.tsx - Dashboard
src/screens/dashboard_screen.tsx - Stock management
src/screens/stock_screen.tsx - Customer credit
src/screens/udhaar_screen.tsx - Customer detail
src/screens/customer_detail_screen.tsx - Expense tracking
src/screens/expenses_screen.tsx - Reports view
src/screens/reports_screen.tsx - UPI payment dialog
src/widgets/upi_qr_dialog.tsx
Client services
- Local app state
src/models/app_data.ts - Domain API services
src/services/api - API transport
src/services/api/api_client.ts - Offline sync queue
src/services/sync_service.ts - Receipt PDF
src/services/pdf_service.ts
API backend
- API server
backend/src/server.ts - Auth middleware
backend/src/middleware/auth.ts - PostgreSQL access
backend/src/config/prisma.ts
Backend operations
- Authentication
backend/src/modules/auth/auth.routes.ts - Business data
backend/src/modules/business/business.routes.ts - Sales and receipts
backend/src/modules/sales/sales.routes.ts - Payment operations
backend/src/modules/payments/payments.routes.ts - Report operations
backend/src/modules/reports/reports.routes.ts - Shop settings
backend/src/modules/shops/shops.routes.ts
Other components
- Shop staff
- Shop owner
Connections 42
- Shop staff → App navigation: uses
App.tsx - App navigation → Local app state: loads
App.tsx - App navigation → Onboarding: routes to
App.tsx - App navigation → Shop workspace: routes to
App.tsx - App navigation → Sale entry: routes to
App.tsx - App navigation → POS scanner: routes to
App.tsx - Onboarding → Domain API services: authenticates via
src/screens/onboarding_screen.tsx - Shop workspace → Dashboard: offers views
- Shop workspace → Stock management: offers views
- Shop workspace → Customer credit: offers views
- Shop workspace → Expense tracking: offers views
- Shop workspace → Reports view: offers views
- Customer credit → Customer detail: opens
- POS scanner → Local app state: scans products
src/screens/pos_scanner_screen.tsx - Sale entry → Local app state: records sale
src/screens/add_sale_screen.tsx - Sale entry → Domain API services: requests payment
src/screens/add_sale_screen.tsx - Sale entry → Receipt PDF: creates receipt
src/screens/add_sale_screen.tsx - Sale entry → UPI payment dialog: shows UPI
src/screens/add_sale_screen.tsx - Local app state → Domain API services: loads and mutates
src/models/app_data.ts - Local app state → Offline sync queue: queues failed writes
src/models/app_data.ts - Domain API services → API transport: sends requests
src/services/api/sale_service.ts - API transport → API server: HTTP requests
- API server → Authentication: mounts routes
backend/src/server.ts - API server → Business data: mounts routes
backend/src/server.ts - API server → Sales and receipts: mounts routes
backend/src/server.ts - API server → Payment operations: mounts routes
backend/src/server.ts - API server → Report operations: mounts routes
backend/src/server.ts - API server → Shop settings: mounts routes
backend/src/server.ts - Shop owner → Authentication: registers or signs in
backend/src/modules/auth/auth.routes.ts - Authentication → PostgreSQL access: reads and writes
backend/src/modules/auth/auth.routes.ts - Business data → PostgreSQL access: reads and writes
backend/src/modules/business/business.routes.ts - Sales and receipts → PostgreSQL access: records sales
backend/src/modules/sales/sales.routes.ts - Payment operations → PostgreSQL access: persists payments
backend/src/modules/payments/payments.routes.ts - Report operations → PostgreSQL access: queries reports
backend/src/modules/reports/reports.routes.ts - Shop settings → PostgreSQL access: reads and writes
backend/src/modules/shops/shops.routes.ts - Authentication → Auth middleware: requires auth
backend/src/modules/auth/auth.routes.ts - Business data → Auth middleware: requires auth
backend/src/modules/business/business.routes.ts - Sales and receipts → Auth middleware: requires auth
backend/src/modules/sales/sales.routes.ts - Payment operations → Auth middleware: requires auth
backend/src/modules/payments/payments.routes.ts - Report operations → Auth middleware: requires auth
backend/src/modules/reports/reports.routes.ts - Shop settings → Auth middleware: requires auth
backend/src/modules/shops/shops.routes.ts - Auth middleware → PostgreSQL access: checks membership
backend/src/middleware/auth.ts