How tashiel-singh/worthitsolutions-wil-insy7315- works
MedFlow is a healthcare-distribution platform for distributor, pharmacy, and patient roles. The main workflow is role-guarded access to inventory and B2B ordering, followed by invoice review; patients can separately view prescriptions and request refills. The React app’s context holds operational state and attempts backend order synchronization, while the Express API exposes auth, users, products, orders, invoices, analytics, tax, and patient routes. The README describes the broader compliance, dual-stock-pool, tier pricing, and patient-portal capabilities. Backend route internals and several frontend views were not sampled, so those links are shown only where routing or calls are evidenced.
Main entry points: app.ts Express API router · App.tsx React app routes · AppContext.tsx Application state · auth.ts JWT and role middleware
Components 28
Web application
- React app routes
src/App.tsx - Login view
src/views/LoginView.tsx - Executive dashboard
src/views/DashboardView.tsx
Distribution workflows
- Dual-pool inventory
src/views/InventoryView.tsx - Bulk ordering
src/views/BulkOrderView.tsx - Invoices
src/views/InvoicesView.tsx - Tax calculations
src/utils/taxCalculations.ts
Patient care
- Patient portal
src/views/PatientPortalView.tsx
Backend API
- Express API router
backend/src/app.ts - Authentication routes
backend/src/routes/auth.ts - User routes
backend/src/routes/users.ts - Product routes
backend/src/routes/products.ts - Order routes
backend/src/routes/orders.ts - Invoice routes
backend/src/routes/invoices.ts - Analytics routes
backend/src/routes/analytics.ts - Tax routes
backend/src/routes/tax.ts - Patient routes
backend/src/routes/patients.ts - JWT and role middleware
backend/src/middleware/auth.ts - Validation and errors
backend/src/middleware/errors.ts - Prisma database access
backend/src/lib/prisma.ts - Bulk order calculation
backend/src/services/BulkOrderCalculationService.ts - Revenue segregation
backend/src/services/RevenueSegregationService.ts - Formal tax deductions
backend/src/services/FormalTaxDeductionService.ts
Shared runtime
- Application state
src/context/AppContext.tsx - API client
src/services/api.ts - Domain types
src/types/index.ts - Currency and expiry
src/utils/formatters.ts
Other components
- Users
Connections 38
- Users → React app routes: accesses
README.md - React app routes → Login view: routes to
src/App.tsx - React app routes → Executive dashboard: routes to
src/App.tsx - React app routes → Dual-pool inventory: routes to
src/App.tsx - React app routes → Bulk ordering: routes to
src/App.tsx - React app routes → Invoices: routes to
src/App.tsx - React app routes → Patient portal: routes to
src/App.tsx - React app routes → Application state: provides context
src/App.tsx - Bulk ordering → Application state: reads and updates
src/views/BulkOrderView.tsx - Dual-pool inventory → Application state: reads and updates
src/views/InventoryView.tsx - Invoices → Application state: reads
src/views/InvoicesView.tsx - Patient portal → Application state: reads and updates
src/views/PatientPortalView.tsx - Application state → API client: syncs orders
src/context/AppContext.tsx - Application state → Domain types: uses domain types
src/context/AppContext.tsx - Bulk ordering → Tax calculations: calculates totals
src/views/BulkOrderView.tsx - Bulk ordering → Currency and expiry: formats values
src/views/BulkOrderView.tsx - Dual-pool inventory → Currency and expiry: formats expiry
src/views/InventoryView.tsx - Invoices → Currency and expiry: formats values
src/views/InvoicesView.tsx - Express API router → Authentication routes: mounts
backend/src/app.ts - Express API router → User routes: mounts
backend/src/app.ts - Express API router → Product routes: mounts
backend/src/app.ts - Express API router → Order routes: mounts
backend/src/app.ts - Express API router → Invoice routes: mounts
backend/src/app.ts - Express API router → Analytics routes: mounts
backend/src/app.ts - Express API router → Tax routes: mounts
backend/src/app.ts - Express API router → Patient routes: mounts
backend/src/app.ts - JWT and role middleware → Validation and errors: passes auth errors
backend/src/middleware/auth.ts - Order routes → Bulk order calculation: uses calculations
backend/src/routes/orders.ts - Analytics routes → Revenue segregation: uses analytics
backend/src/routes/analytics.ts - Order routes → Prisma database access: queries database
backend/src/routes/orders.ts - Analytics routes → Prisma database access: queries database
backend/src/routes/analytics.ts - Authentication routes → Prisma database access: queries database
backend/src/routes/auth.ts - Invoice routes → Prisma database access: queries database
backend/src/routes/invoices.ts - Authentication routes → JWT and role middleware: uses auth middleware
backend/src/routes/auth.ts - Order routes → JWT and role middleware: uses auth middleware
backend/src/routes/orders.ts - Invoice routes → JWT and role middleware: uses auth middleware
backend/src/routes/invoices.ts - Analytics routes → JWT and role middleware: uses auth middleware
backend/src/routes/analytics.ts - API client → Express API router: requests API