How mohamedabi17/pharmacie-web-app works
Main Components
• Frontend Application (pharmacie_front): Built with React/Next.js and Tailwind CSS. It includes multiple routes (e.g., landing, login, admin, search, product details) and shared components (like the navbar, footer, dashboard, etc.).
• Backend Application (pharmacie_backend): An Express/Node.js server managing API endpoints with routes, middleware, and models (User, Medicament, Order, Payment, etc.). It likely interacts with a MongoDB database (as indicated by the README’s MongoDB reference).
• Database (MongoDB): Although not directly visible in the file tree, the README tells us that MongoDB is used for data persistence (storing inventory, prescriptions, orders, etc.).
Relationships and Interactions
• User Interactions: Users access the web application through the frontend. They authenticate, browse inventory, place orders, and manage prescriptions.
• Request Flow: Data flows from the frontend to the backend through RESTful endpoints. Security is implied with JWTs for authentication.
• Data Persistence: The backend communicates with the MongoDB database using models defined in the project (Category, Medicament, Order, etc.). The backend routes (pharmacieRouter.js) handle the requests and pass data to/from the database.
• Middleware: The backend’s middleware (in /middleware) processes requests, possibly handling authentication checks or error handling.
Architectural Patterns and Key Technologies
• MVC / RESTful API Pattern: The backend organizes code with models (data), routes (controllers), and middleware (business logic, security), while the frontend uses Next.js’s file-based routing.
• Micro Frontend Components: The frontend is broken into clearly defined pages and components, hinting at a modular design.
• Security & Authentication: JWT is used for secure user authentication and authorizations.
• Separation of Concerns: The project cleanly separates presentation (pharmacie_front) from business logic and data handling (pharmacie_backend).