A comprehensive device inventory management system with a Flask backend and React frontend.
- Backend: Flask (Python) + Pandas + CSV storage
- Frontend: React + TypeScript + Vite + Tailwind CSS
- Storage: Local CSV files for data persistence
- API: RESTful API with CORS support
Inventory_Manager/
βββ backend/ # Flask backend
β βββ app.py # Main Flask application
β βββ requirements.txt # Python dependencies
β βββ README.md # Backend documentation
β βββ test_api.py # API testing script
β βββ run.py # Startup script
β βββ *.csv # Data files (auto-generated)
βββ frontend/ # React frontend
β βββ project/ # React application
β βββ src/ # Source code
β βββ package.json # Node dependencies
β βββ README.md # Frontend documentation
βββ README.md # This file
cd backend
python3 -m pip install -r requirements.txt
python3 app.pyThe backend will start on http://localhost:5000
cd frontend/project
npm install
npm run devThe frontend will start on http://localhost:5173
The application stores all data locally in CSV files in the backend/ directory:
-
devices.csv- Device inventoryid: Unique identifier (UUID)device_type: Type of device (Laptop, iPhone, etc.)connectivity: Connectivity type (WiFi, Cellular, etc.)serial_number: Unique serial numberos_version: Operating system versionassigned_user: Currently assigned userstatus: Device status (available, checked_out, etc.)usage_count: Number of times checked outcheck_out_date: Last checkout datecreated_at: Device creation timestamplast_updated: Last update timestamp
-
users.csv- User informationid: Unique identifier (UUID)name: User's full nameemail: User's email addressdepartment: User's departmentrole: User's rolestatus: User status (active, inactive)join_date: User join date
-
history.csv- Action historyid: Unique identifier (UUID)device_id: Device IDuser: User who performed the actionaction: Action performed (device_created, checkout, etc.)timestamp: Action timestamp
- Automatic Creation: CSV files are automatically created when the backend starts
- Real-time Updates: All changes are immediately saved to CSV files
- Backup Friendly: CSV files can be easily backed up, versioned, or migrated
- Human Readable: Data can be viewed and edited in any spreadsheet application
# Copy the CSV files to a backup location
cp backend/*.csv /path/to/backup/# Replace the CSV files with your backup
cp /path/to/backup/*.csv backend/# The frontend includes CSV export functionality
# Use the "Export CSV" button in the Devices pageYou can edit the CSV files directly in any spreadsheet application:
# Open in Excel, Google Sheets, or any CSV editor
open backend/devices.csvGET /devices- Get all devicesGET /devices/{id}- Get specific deviceGET /devices/search?q={query}- Search devicesPOST /devices- Add new devicePUT /devices/{id}- Update devicePUT /devices/{id}/checkout- Checkout devicePUT /devices/{id}/checkin- Checkin deviceGET /devices/recommendations- Get device recommendations
GET /users- Get all usersPOST /users- Add new user
GET /history/{device_id}- Get device history
- β Add, edit, and delete devices
- β Check out/in devices with automatic tracking
- β Search and filter devices
- β Device status tracking
- β Usage statistics
- β Serial number validation
- β Add and manage users
- β Role-based access control
- β Department organization
- β User status tracking
- β Device status overview
- β Usage analytics
- β History tracking
- β CSV export functionality
- β Modern, responsive UI
- β Real-time updates
- β Error handling with fallbacks
- β Loading states
- β Form validation
- Unique Constraints: Serial numbers and user emails are enforced as unique
- Automatic ID Generation: UUIDs prevent conflicts
- Timestamp Tracking: All changes are timestamped
- History Logging: Complete audit trail for all actions
- Error Handling: Graceful handling of data corruption
cd backend
python3 -m pip install -r requirements.txt
python3 test_api.py # Test the APIcd frontend/project
npm install
npm run dev
npm run build # Build for production# Test backend API
cd backend
python3 test_api.py
# Test frontend
cd frontend/project
npm run lintIf you have data in other formats, you can convert it to the CSV format:
- Excel/Google Sheets: Export as CSV and place in
backend/ - JSON Data: Convert to CSV format matching the schema
- Database Export: Export to CSV and place in
backend/
The CSV format makes it easy to migrate to other systems:
- Database: Import CSV files into any database
- Cloud Storage: Upload CSV files to cloud storage
- Other Applications: Use CSV files with any application that supports them
- Port 5000 in use: Change port in
app.py - CSV file errors: Delete CSV files and restart (data will be recreated)
- Import errors: Ensure all dependencies are installed
- API connection errors: Check if backend is running on port 5000
- Build errors: Clear node_modules and reinstall
- CORS errors: Backend has CORS enabled by default
- Missing data: Check CSV file permissions
- Corrupted data: Restore from backup or restart backend
- Duplicate entries: Check for duplicate serial numbers or emails
- Consider migrating to a database (PostgreSQL, SQLite)
- Implement pagination for large device lists
- Add caching for frequently accessed data
- Add user authentication and authorization
- Implement role-based access control
- Add audit logging for compliance
- Use a production WSGI server (Gunicorn)
- Add environment variables for configuration
- Implement proper logging and monitoring
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is open source and available under the MIT License.