How zluck4270/web_full_stack works
Botica Nova Salud is a pharmacy ERP/POS: staff authenticate, enter role-authorized modules, and use them to process sales, inventory, purchasing, cash, customers and oversight. The SPA routes users into these workflows; shared pharmacy state/API services communicate with the Express API, whose routes apply authentication and selected permission checks before controllers operate on the SQL adapter. The README documents FEFO, DCI substitutes, replenishment, alerts, audit, backups and staff access. Those capabilities are retained, but their exact internal call chains are not asserted where source excerpts do not show them.
Main entry points: App.tsx Module navigation · server.js REST API · PharmacyContext.tsx Shared pharmacy state · authMiddleware.js JWT authentication
Components 30
Pharmacy interface
- Module navigation
src/App.tsx - Sign in
src/components/auth/LoginView.tsx - Shared pharmacy state
src/context/PharmacyContext.tsx - API client
src/services/pharmacyApi.js - Language context
src/i18n/I18nContext.tsx
API and access
- REST API
backend/server.js - Authentication routes
backend/src/routes/authRoutes.js - Sales routes
backend/src/routes/salesRoutes.js - Inventory routes
backend/src/routes/inventoryRoutes.js - Cash routes
backend/src/routes/cashRoutes.js - Purchases routes
backend/src/routes/purchasesRoutes.js - Users routes
backend/src/routes/usersRoutes.js - JWT authentication
backend/src/middleware/authMiddleware.js - Permission checks
backend/src/middleware/rbacMiddleware.js
Pharmacy operations
- Dashboard
src/components/dashboard/DashboardView.tsx - Point of sale
src/components/pos/PointOfSaleView.tsx - Sales history
src/components/sales/SalesHistoryView.tsx - Inventory and FEFO
src/components/inventory/InventoryBatchesView.tsx - Purchasing
src/components/purchases/PurchasesView.tsx - Cash shifts
src/components/cash/CashRegisterView.tsx - Alerts
src/components/alerts/ActiveAlertsView.tsx - Customer directory
src/components/customers/CustomersView.tsx - Staff and RBAC
src/components/users/UsersManagementView.tsx - Audit log view
src/components/audit/AuditView.tsx - Inventory operations
backend/src/controllers/inventoryController.js - User administration
backend/src/controllers/usersController.js - FEFO dispatch
backend/src/services/fefoService.js
Data and controls
- Backup service
backend/src/services/backupService.js - SQL adapter
backend/src/config/db.js
Other components
- Pharmacy staff
Connections 45
- Pharmacy staff → Sign in: signs in
- Module navigation → Sign in: shows when signed out
src/App.tsx - Module navigation → Shared pharmacy state: provides state
src/App.tsx - Module navigation → Language context: provides language
src/App.tsx - Module navigation → Dashboard: renders module
src/App.tsx - Module navigation → Point of sale: renders module
src/App.tsx - Module navigation → Sales history: renders module
src/App.tsx - Module navigation → Inventory and FEFO: renders module
src/App.tsx - Module navigation → Cash shifts: renders module
src/App.tsx - Module navigation → Purchasing: renders module
src/App.tsx - Module navigation → Alerts: renders module
src/App.tsx - Module navigation → Customer directory: renders module
src/App.tsx - Module navigation → Staff and RBAC: renders module
src/App.tsx - Module navigation → Audit log view: renders module
src/App.tsx - Point of sale → Shared pharmacy state: uses operations
src/components/pos/PointOfSaleView.tsx - Sales history → Shared pharmacy state: uses operations
src/components/sales/SalesHistoryView.tsx - Inventory and FEFO → Shared pharmacy state: uses operations
src/components/inventory/InventoryBatchesView.tsx - Purchasing → Shared pharmacy state: uses operations
src/components/purchases/PurchasesView.tsx - Cash shifts → Shared pharmacy state: uses operations
src/components/cash/CashRegisterView.tsx - Dashboard → Shared pharmacy state: uses metrics
src/components/dashboard/DashboardView.tsx - Audit log view → Shared pharmacy state: uses data
src/components/audit/AuditView.tsx - Staff and RBAC → API client: calls user API
src/components/users/UsersManagementView.tsx - Shared pharmacy state → API client: calls endpoints
src/context/PharmacyContext.tsx - API client → REST API: requests API
- REST API → Authentication routes: mounts routes
backend/server.js - REST API → Sales routes: mounts routes
backend/server.js - REST API → Inventory routes: mounts routes
backend/server.js - REST API → Cash routes: mounts routes
backend/server.js - REST API → Purchases routes: mounts routes
backend/server.js - REST API → Users routes: mounts routes
backend/server.js - Inventory routes → JWT authentication: authenticates requests
backend/src/routes/inventoryRoutes.js - Inventory routes → Permission checks: checks permissions
backend/src/routes/inventoryRoutes.js - Inventory routes → Inventory operations: dispatches handlers
backend/src/routes/inventoryRoutes.js - Users routes → JWT authentication: authenticates requests
backend/src/routes/usersRoutes.js - Users routes → User administration: dispatches handlers
backend/src/routes/usersRoutes.js - Permission checks → SQL adapter: reads permissions
backend/src/middleware/rbacMiddleware.js - Inventory operations → SQL adapter: queries inventory
backend/src/controllers/inventoryController.js - User administration → SQL adapter: queries user records
backend/src/controllers/usersController.js - Inventory operations → FEFO dispatch: FEFO integration
- Purchases routes → JWT authentication: authenticates requests
backend/src/routes/purchasesRoutes.js - Purchases routes → Permission checks: checks permissions
backend/src/routes/purchasesRoutes.js - Cash routes → JWT authentication: authenticates requests
backend/src/routes/cashRoutes.js - Cash routes → Permission checks: checks permissions
backend/src/routes/cashRoutes.js - Authentication routes → JWT authentication: token middleware
backend/src/routes/authRoutes.js - REST API → Backup service: backup capability