How bayronearljames-source/stocklink-inventory-system works
StockLink is a multi-branch inventory and restocking system. Staff use role-specific dashboards and pages to view branch stock, record stock movements, and create or track restock requests; administrators manage catalog data, review requests, and access audit and reporting views. The React client sends authenticated requests to an Express API, which enforces identity and role checks and accesses PostgreSQL through Prisma. The README and sampled sources document database-triggered low-stock requests, audit logging, and atomic restock fulfillment; several page-to-endpoint details are unsampled, so those links are not expanded.
Main entry points: AppRoutes.jsx Role-based routes · client.js API client · index.js Express API · App.jsx Client app
Components 21
React client
- Client app
client/src/App.jsx - Role-based routes
client/src/routes/AppRoutes.jsx - Role dashboards
client/src/pages/dashboard - Catalog management
client/src/pages/catalog/ItemCatalog.jsx - Branch management
client/src/pages/branches/BranchManagement.jsx - Supplier management
client/src/pages/suppliers/SupplierManagement.jsx - Branch stock
client/src/pages/stock/BranchStock.jsx - Stock movements
client/src/pages/movements/StockMovements.jsx - Restock requests
client/src/pages/restock/RestockRequests.jsx - Reports
client/src/pages/reports/Reports.jsx - Audit logs
client/src/pages/audit/AuditLogs.jsx - API client
client/src/api/client.js
Authentication and access
- Session context
client/src/context/AuthContext.jsx - Token and role guards
middleware/auth.js
Express API
- Login API
routes/auth.js - Express API
index.js
Inventory data
- Relational schema
migrations/001_init_schema.sql - Stock and audit triggers
migrations/004_add_stock_movements_logging.sql - Atomic fulfillment procedure
migrations/003_fix_restock_fulfill_transaction.sql
Other components
- Staff user
- PostgreSQL service
Connections 30
- Staff user → Client app: uses
- Client app → Role-based routes: renders
- Role-based routes → Session context: checks session
- Role-based routes → Role dashboards: routes by role
- Role-based routes → Catalog management: routes
- Role-based routes → Branch management: routes
- Role-based routes → Supplier management: routes
- Role-based routes → Branch stock: routes
- Role-based routes → Stock movements: routes
- Role-based routes → Restock requests: routes
- Role-based routes → Reports: routes
- Role-based routes → Audit logs: routes
- Session context → Login API: posts login
- Login API → PostgreSQL service: reads users
- Staff user → API client: requests data
- Role dashboards → API client: fetches data
- Branch stock → API client: fetches data
- Stock movements → API client: records movements
- Restock requests → API client: manages requests
- Catalog management → API client: API requests
- Branch management → API client: API requests
- Supplier management → API client: API requests
- Reports → API client: API requests
- Audit logs → API client: API requests
- API client → Express API: HTTP requests
- Express API → Token and role guards: verifies access
- Express API → PostgreSQL service: queries and writes
- Relational schema → PostgreSQL service: defines tables
- PostgreSQL service → Stock and audit triggers: runs on stock changes
- PostgreSQL service → Atomic fulfillment procedure: runs fulfillment