A comprehensive Inventory Management System built using a microservices architecture, containerized with Docker. This project demonstrates the implementation of a modern web application using containerization and orchestration technologies.
Class: TD48 - ESIEA
Team Members:
- DAOUDI Amir Salah Eddine
- HELOUI Youssef
- ZEJLI Mohamed-Nadir
- MOURTADA Heddy
This project is developed as part of the Containerization and Virtualization course, focusing on creating a microservices-based application using Docker. The system consists of three main components:
- Frontend Service: Built with Vite and React.js
- Backend Service: Developed using Node.js and Express.js
- Database Service: MongoDB for data persistence
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Frontend │ │ Backend │ │ Database │
│ (Vite/React) │────▶│ (Node/Express) │────▶│ (MongoDB) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
- User authentication and authorization
- Product management (CRUD operations)
- Company and location tracking
- Brand management
- Product history tracking
- Analytics dashboard
- Responsive design with Tailwind CSS
-
Frontend:
- Vite
- React.js
- Tailwind CSS
- Redux for state management
-
Backend:
- Node.js
- Express.js
- JWT for authentication
- MongoDB drivers
-
Database:
- MongoDB
-
DevOps:
- Docker
- Docker Compose
- Multi-stage builds
The application is fully containerized using Docker, with each service running in its own container:
-
MongoDB Service:
- Uses official MongoDB 6.0 image
- Persistent volume for data storage
- Health checks for reliability
-
Backend Service:
- Multi-stage build for optimization
- Node.js 18.8.0 base image
- Environment variables for configuration
- Waits for MongoDB availability
-
Frontend Service:
- Node.js 18 with Alpine for minimal size
- Vite development server
- Environment variables for API configuration
Our docker-compose.yml
orchestrates all services:
services:
mongo:
image: mongo:6.0
volumes:
- mongo_data:/data/db
healthcheck:
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
backend:
build: ./Backend
depends_on:
mongo:
condition: service_healthy
frontend:
build: ./Frontend
depends_on:
- backend
# Build and start all services
docker-compose up --build
# View service logs
docker-compose logs [service_name]
# Stop all services
docker-compose down
# Remove volumes (if needed)
docker-compose down -v
MONGODB_URI=mongodb://mongo:27017/inventory
PORT=3000
SECRET_KEY=your-secret-key
VITE_SERVER=http://localhost:3000
- POST
/api/v1/auth/register
- Register new user - POST
/api/v1/auth/login
- User login
- GET
/api/v1/products
- List all products - POST
/api/v1/products
- Add new product - PUT
/api/v1/products/:id
- Update product - DELETE
/api/v1/products/:id
- Delete product
- GET
/api/v1/analytics
- Get analytics data
The main dashboard provides a comprehensive overview of your inventory system, featuring:
- Real-time analytics and metrics
- Product status distribution
- Warranty expiration tracking
- Team information and project details
Efficiently manage product brands with features including:
- Add new brands/manufacturers
- Track brand-specific products
- Manage brand relationships
- Update brand information
Keep track of your inventory across different locations:
- Add new storage locations
- Monitor stock levels by location
- Manage location capacity
- Track product movements
Comprehensive product management interface offering:
- Add new products with detailed information
- Track product specifications
- Monitor stock levels
- Manage product warranties
- Update product information
Secure user management system featuring:
- User role management
- Access control
- User activity tracking
- Account management
- Docker Desktop
- Node.js 18.x (for local development)
- Git
- Clone the repository
- Install dependencies for each service
- Set up environment variables
- Run
docker-compose up --build
Common issues and solutions:
-
Frontend Connection Issues:
- Ensure Vite is configured to listen on all interfaces
- Check CORS configuration in backend
-
Database Connection:
- Verify MongoDB container is healthy
- Check connection string format
-
Container Startup:
- Use
docker-compose logs
to debug - Ensure all ports are available
- Use
IMS-DOCKER/
├── Backend/
│ ├── controllers/
│ │ ├── product_controller.js # Product-related operations
│ │ └── user_controllers.js # User authentication and management
│ ├── db/
│ │ └── user_db.js # Database connection configuration
│ ├── middlewares/
│ │ └── user_auth.js # Authentication middleware
│ ├── models/
│ │ ├── company_model.js # Company data schema
│ │ ├── history_model.js # Product history schema
│ │ ├── locations_models.js # Location data schema
│ │ ├── product_model.js # Product data schema
│ │ └── user_model.js # User data schema
│ ├── routes/
│ │ ├── analyticsRoutes.js # Analytics API endpoints
│ │ ├── companyRoutes.js # Company management endpoints
│ │ ├── historyRoutes.js # Product history endpoints
│ │ ├── locationRoutes.js # Location management endpoints
│ │ ├── productRoutes.js # Product management endpoints
│ │ └── user_routes.js # User authentication routes
│ ├── utils/
│ │ └── user_utils.js # Utility functions
│ ├── .env # Backend environment variables
│ ├── app.js # Main application entry
│ ├── Dockerfile # Backend container configuration
│ ├── package.json
│ └── seed.js # Database seeding script
│
├── Frontend/
│ ├── src/
│ │ ├── assets/ # Static assets
│ │ │ ├── admin-logo.svg
│ │ │ ├── authenticate.svg
│ │ │ ├── menu.svg
│ │ │ ├── react.svg
│ │ │ └── user-logo.svg
│ │ ├── components/ # Reusable UI components
│ │ │ ├── HeaderBar.jsx
│ │ │ ├── LoadingIndicator.jsx
│ │ │ ├── LogoutButton.jsx
│ │ │ ├── PopUpComponent.jsx
│ │ │ ├── ShowErrorMessage.jsx
│ │ │ ├── ShowSuccessMessage.jsx
│ │ │ └── SideNavbar.jsx
│ │ ├── screens/ # Application views
│ │ │ ├── brands/ # Brand management screens
│ │ │ ├── dashboard/ # Analytics dashboard
│ │ │ ├── locations/ # Location management
│ │ │ ├── login/ # Authentication screens
│ │ │ ├── product/ # Product management
│ │ │ └── users/ # User management
│ │ ├── App.jsx # Root component
│ │ ├── main.jsx # Application entry point
│ │ └── router.jsx # Route definitions
│ ├── .env # Frontend environment variables
│ ├── Dockerfile # Frontend container configuration
│ ├── index.html # HTML entry point
│ ├── package.json
│ ├── tailwind.config.js # Tailwind CSS configuration
│ └── vite.config.js # Vite build configuration
│
├── docker-compose.yml # Multi-container orchestration
└── README.md # Project documentation
-
Backend/
controllers/
: Business logic for different featuresmodels/
: MongoDB schema definitionsroutes/
: API endpoint definitionsmiddlewares/
: Request processing middlewareutils/
: Helper functions and utilities
-
Frontend/
src/components/
: Reusable React componentssrc/screens/
: Main application viewssrc/assets/
: Static files (images, icons)src/router.jsx
: Application routing logic
-
Root Directory
docker-compose.yml
: Defines and configures all servicesREADME.md
: Project documentation and setup instructions
-
Backend Configuration
.env
: Environment variablespackage.json
: Dependencies and scriptsDockerfile
: Container build instructions
-
Frontend Configuration
.env
: Environment variablesvite.config.js
: Build configurationtailwind.config.js
: CSS framework settingsDockerfile
: Container build instructions