How chandrakanth2704/smart-medical-inventory-management-system works
Smart Medical Inventory Management System is a dual-role web application for managing medicine stock and customer purchases. Admins maintain medicines, suppliers, purchases, inventory and sales, then review reports; customers browse medicines, manage a cart and account details, and place and track orders. Next.js pages and route handlers implement the workflows, with MySQL for relational records and MongoDB/GridFS for medicine images. The graph preserves documented capabilities, but unsampled page-to-API wiring is not asserted.
Main entry points: auth.ts Session and role checks · mongodb.ts MongoDB and GridFS · route.ts Medicine management API · page.tsx Medicine catalog
Components 26
Access and dashboard
- Admin dashboard
frontend/app/(dashboard)/dashboard-shell.tsx - Sign-in and registration
frontend/app/login/page.tsx - Authentication routes
frontend/app/api/auth/login/route.ts - Session and role checks
frontend/lib/auth.ts
Medicine catalog
- Medicine catalog
frontend/app/store/page.tsx - Add to cart
frontend/app/store/add-to-cart-button.tsx - Floating cart
frontend/app/store/floating-cart-bar.tsx - Medicine image gallery
frontend/app/store/medicine-image-gallery.tsx - Save to wishlist
frontend/app/store/save-to-wishlist-button.tsx - Store account menu
frontend/app/store/store-account-menu.tsx
Inventory operations
- Medicine management API
frontend/app/api/medicines/route.ts - Medicine image API
frontend/app/api/medicines/[id]/images/route.ts - Stock and adjustments
frontend/app/api/inventory/route.ts - Purchases
frontend/app/api/purchases/route.ts - Supplier management
frontend/app/api/suppliers/route.ts - Sales
frontend/app/api/sales/route.ts - Reports
frontend/app/api/reports/route.ts - Admin workspaces
frontend/app/(dashboard)/inventory/page.tsx
Customer shopping
- Cart and checkout
frontend/app/checkout/page.tsx - Customer orders
frontend/app/api/customer/orders/route.ts - Delivery details
frontend/app/api/customer/delivery-details/route.ts - Wishlist API
frontend/app/api/customer/wishlist/route.ts
Data stores
- MySQL relational data
frontend/lib/mysql.ts - MongoDB and GridFS
frontend/lib/mongodb.ts
Other components
- Admin
- Customer
Connections 13
- Admin → Admin dashboard: manages operations
README.md - Customer → Medicine catalog: browses medicines
README.md - Customer → Cart and checkout: places orders
README.md - Authentication routes → Session and role checks: checks sessions
frontend/lib/auth.ts - Medicine management API → Session and role checks: checks roles
frontend/app/api/medicines/route.ts - Purchases → Session and role checks: checks roles
frontend/app/api/purchases/route.ts - Sales → Session and role checks: checks roles
frontend/app/api/sales/route.ts - Reports → Session and role checks: checks roles
frontend/app/api/reports/route.ts - Medicine management API → MongoDB and GridFS: reads image metadata
frontend/app/api/medicines/route.ts - Medicine image API → MongoDB and GridFS: stores image files
frontend/app/api/medicines/[id]/images/route.ts - Medicine catalog → MongoDB and GridFS: loads image metadata
frontend/app/store/page.tsx - Customer orders → Session and role checks: checks customer role
frontend/app/api/customer/orders/route.ts - Delivery details → Session and role checks: checks customer role
frontend/app/api/customer/delivery-details/route.ts