How josephgmkonda/medicalaidsystem works
Project Type and Purpose
• This is a full-stack web application called “Medical Aid System” that streamlines medical supply logistics.
• The frontend is built in React (Vite, Tailwind, Redux Toolkit), and the backend is a Node.js/Express API using Sequelize ORM with a MySQL database.
• It supports three user roles (Admin, Inventory Manager, Client), secure JWT authentication, inventory tracking, order processing with approval workflow, and dashboard analytics.
File Structure Analysis
• Top-level directories:
• API/ – the Express server and business logic
• Frontend/MedicalAid/ – the React application
• API/ substructure reveals an MVC pattern:
• config/database.js for Sequelize setup
• models/ (Inventory, Order, OrderItem, User)
• controllers/ (AdminDashboard, Auth, Inventory, Order, User)
• routes/ mapping endpoints to controllers
• middleware/AunthUser.js for JWT-based auth
• Frontend/MedicalAid/ structure:
• public/ + index.html
• src/
– components/ (reusable UI, e.g., Navbar, Sidebar, ProtectedRoute)
– pages/ (feature pages, dashboard, charts, sign-in, user/inventory management)
– features/ (Redux slices for Admin, Auth, Inventory, etc.)
– store.js for Redux store configuration
• Config files: .env at API/, package.json, Vite config, Tailwind config, ESLint, PostCSS.
Key Insights from README
• Technology stack (React, Node.js, Express, Sequelize, MySQL, JWT)
• Functional overview and user roles
• Screenshots illustrating dashboards and workflows
• Client Browser (React SPA)
• Frontend Application (Vite bundle + Tailwind CSS + Redux state)
• API Server (Node.js + Express)
• Authentication Layer (JWT issuance & validation middleware)
• Database (MySQL via Sequelize)
• Browser → Frontend SPA (HTTP/HTTPS)
• SPA → API Server (REST calls: /auth, /inventory, /orders, /users, /admin-dashboard)
• API Server → Auth Middleware → Issue/Validate JWT
• API Server → Database (Sequelize ORM queries)
• API Server → Controllers/Services → Models → Database
• API Server ↔ External env (config/.env)
c. Architectural Patterns & Principles:
• Separation of concerns: UI, business logic, data persistence
• MVC in backend (routes → controllers → models)
• State management in frontend via Redux slices
• Role-based access control enforced at API middleware
• RESTful design for API endpoints
d. Key Technologies & Libraries:
• React.js + Vite + Tailwind CSS (frontend)
• Redux Toolkit (AdminSlice, AuthSlice, InventorySlice, etc.)
• Express.js + Node.js (API entry point index.js)
• Sequelize ORM + MySQL (config/database.js)
• JWT (middleware/AunthUser.js)