141 lines
3.4 KiB
Markdown
141 lines
3.4 KiB
Markdown
# InInventer - Inventory Management System
|
|
|
|
A modern web-based inventory management system with role-based access control (RBAC), built using the MERN stack (MongoDB, Express, React, Node.js).
|
|
|
|
## Features
|
|
|
|
- **Role-Based Access Control (RBAC)**
|
|
- Superadmin: Full system access
|
|
- Company Admin: Manage company users and products
|
|
- Employer: View products and limited actions
|
|
|
|
- **Product Management**
|
|
- Add, edit, and delete products
|
|
- Track quantities with visual indicators
|
|
- Search and filter capabilities
|
|
|
|
- **User Management**
|
|
- Create and manage users
|
|
- Assign roles and companies
|
|
|
|
- **Modern UI/UX**
|
|
- Responsive design with Tailwind CSS
|
|
- Gradient themes and animations
|
|
- Clean, intuitive interface
|
|
|
|
## Tech Stack
|
|
|
|
- **Frontend**: React, Vite, Tailwind CSS
|
|
- **Backend**: Node.js, Express.js
|
|
- **Database**: MongoDB
|
|
- **Authentication**: JWT
|
|
- **Containerization**: Docker
|
|
|
|
## Prerequisites
|
|
|
|
- Docker and Docker Compose
|
|
- Node.js 18+ (for local development)
|
|
- Git
|
|
|
|
## Quick Start
|
|
|
|
1. **Clone the repository**
|
|
```bash
|
|
git clone https://github.com/yourusername/ininventer.git
|
|
cd ininventer
|
|
```
|
|
|
|
2. **Set up environment variables**
|
|
```bash
|
|
# Copy example files
|
|
cp .env.example .env
|
|
cp frontend/.env.example frontend/.env
|
|
|
|
# Edit .env with your configuration
|
|
# IMPORTANT: Change all default values, especially:
|
|
# - MONGO_INITDB_ROOT_USERNAME
|
|
# - MONGO_INITDB_ROOT_PASSWORD
|
|
# - JWT_SECRET
|
|
# - SUPERADMIN_EMAIL
|
|
# - SUPERADMIN_PASSWORD
|
|
```
|
|
|
|
3. **Start with Docker Compose**
|
|
```bash
|
|
docker-compose up -d
|
|
```
|
|
|
|
4. **Access the application**
|
|
- Frontend: http://localhost:3000
|
|
- Backend API: http://localhost:5000
|
|
- MongoDB: localhost:27017
|
|
|
|
5. **Initial Login**
|
|
- Use the credentials you set in SUPERADMIN_EMAIL and SUPERADMIN_PASSWORD
|
|
- **Important**: Change the password immediately after first login
|
|
|
|
## Environment Configuration
|
|
|
|
### Required Environment Variables
|
|
|
|
See `.env.example` for all available options. Key variables:
|
|
|
|
- `MONGO_URI`: MongoDB connection string
|
|
- `JWT_SECRET`: Secret key for JWT tokens (use a long random string)
|
|
- `SUPERADMIN_EMAIL`: Initial admin email
|
|
- `SUPERADMIN_PASSWORD`: Initial admin password
|
|
- `NODE_ENV`: Environment (development/production)
|
|
|
|
## Development
|
|
|
|
### Local Development Setup
|
|
|
|
1. **Backend**
|
|
```bash
|
|
cd backend
|
|
npm install
|
|
npm run dev
|
|
```
|
|
|
|
2. **Frontend**
|
|
```bash
|
|
cd frontend
|
|
npm install
|
|
npm run dev
|
|
```
|
|
|
|
### Project Structure
|
|
|
|
```
|
|
ininventer/
|
|
├── backend/ # Express.js API
|
|
│ ├── models/ # MongoDB schemas
|
|
│ ├── routes/ # API endpoints
|
|
│ ├── middleware/ # Auth & error handling
|
|
│ └── utils/ # Helper functions
|
|
├── frontend/ # React application
|
|
│ ├── src/
|
|
│ │ ├── components/ # React components
|
|
│ │ ├── contexts/ # Context providers
|
|
│ │ └── styles/ # CSS files
|
|
├── nginx/ # Nginx configuration
|
|
├── docker-compose.yml # Docker composition
|
|
└── README.md
|
|
```
|
|
|
|
## Deployment
|
|
|
|
See `DEPLOYMENT.md` for detailed production deployment instructions.
|
|
|
|
## Security Notes
|
|
|
|
- Never commit `.env` files or any file with real credentials
|
|
- Always use strong, unique passwords
|
|
- Regularly update dependencies
|
|
- Use HTTPS in production
|
|
- Enable MongoDB authentication
|
|
|
|
## License
|
|
|
|
This project is licensed under the MIT License.
|