Skip to content

yash200611/Inventory_Manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Device Inventory Manager

A comprehensive device inventory management system with a Flask backend and React frontend.

πŸ—οΈ Architecture

  • 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

πŸ“ Project Structure

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

πŸš€ Quick Start

1. Start the Backend

cd backend
python3 -m pip install -r requirements.txt
python3 app.py

The backend will start on http://localhost:5000

2. Start the Frontend

cd frontend/project
npm install
npm run dev

The frontend will start on http://localhost:5173

πŸ’Ύ Data Storage

How Your Data is Stored

The application stores all data locally in CSV files in the backend/ directory:

  1. devices.csv - Device inventory

    • id: Unique identifier (UUID)
    • device_type: Type of device (Laptop, iPhone, etc.)
    • connectivity: Connectivity type (WiFi, Cellular, etc.)
    • serial_number: Unique serial number
    • os_version: Operating system version
    • assigned_user: Currently assigned user
    • status: Device status (available, checked_out, etc.)
    • usage_count: Number of times checked out
    • check_out_date: Last checkout date
    • created_at: Device creation timestamp
    • last_updated: Last update timestamp
  2. users.csv - User information

    • id: Unique identifier (UUID)
    • name: User's full name
    • email: User's email address
    • department: User's department
    • role: User's role
    • status: User status (active, inactive)
    • join_date: User join date
  3. history.csv - Action history

    • id: Unique identifier (UUID)
    • device_id: Device ID
    • user: User who performed the action
    • action: Action performed (device_created, checkout, etc.)
    • timestamp: Action timestamp

Data Persistence

  • 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

Data Management

Backing Up Your Data

# Copy the CSV files to a backup location
cp backend/*.csv /path/to/backup/

Restoring Data

# Replace the CSV files with your backup
cp /path/to/backup/*.csv backend/

Exporting Data

# The frontend includes CSV export functionality
# Use the "Export CSV" button in the Devices page

Manual Data Editing

You can edit the CSV files directly in any spreadsheet application:

# Open in Excel, Google Sheets, or any CSV editor
open backend/devices.csv

πŸ”§ API Endpoints

Devices

  • GET /devices - Get all devices
  • GET /devices/{id} - Get specific device
  • GET /devices/search?q={query} - Search devices
  • POST /devices - Add new device
  • PUT /devices/{id} - Update device
  • PUT /devices/{id}/checkout - Checkout device
  • PUT /devices/{id}/checkin - Checkin device
  • GET /devices/recommendations - Get device recommendations

Users

  • GET /users - Get all users
  • POST /users - Add new user

History

  • GET /history/{device_id} - Get device history

🎯 Features

Device Management

  • βœ… Add, edit, and delete devices
  • βœ… Check out/in devices with automatic tracking
  • βœ… Search and filter devices
  • βœ… Device status tracking
  • βœ… Usage statistics
  • βœ… Serial number validation

User Management

  • βœ… Add and manage users
  • βœ… Role-based access control
  • βœ… Department organization
  • βœ… User status tracking

Analytics & Reporting

  • βœ… Device status overview
  • βœ… Usage analytics
  • βœ… History tracking
  • βœ… CSV export functionality

User Experience

  • βœ… Modern, responsive UI
  • βœ… Real-time updates
  • βœ… Error handling with fallbacks
  • βœ… Loading states
  • βœ… Form validation

πŸ”’ Security & Data Integrity

  • 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

πŸ› οΈ Development

Backend Development

cd backend
python3 -m pip install -r requirements.txt
python3 test_api.py  # Test the API

Frontend Development

cd frontend/project
npm install
npm run dev
npm run build  # Build for production

Testing

# Test backend API
cd backend
python3 test_api.py

# Test frontend
cd frontend/project
npm run lint

πŸ“Š Data Migration

From Other Systems

If you have data in other formats, you can convert it to the CSV format:

  1. Excel/Google Sheets: Export as CSV and place in backend/
  2. JSON Data: Convert to CSV format matching the schema
  3. Database Export: Export to CSV and place in backend/

To Other Systems

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

🚨 Troubleshooting

Backend Issues

  • 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

Frontend Issues

  • 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

Data Issues

  • Missing data: Check CSV file permissions
  • Corrupted data: Restore from backup or restart backend
  • Duplicate entries: Check for duplicate serial numbers or emails

πŸ“ˆ Scaling Considerations

For Larger Datasets

  • Consider migrating to a database (PostgreSQL, SQLite)
  • Implement pagination for large device lists
  • Add caching for frequently accessed data

For Multiple Users

  • Add user authentication and authorization
  • Implement role-based access control
  • Add audit logging for compliance

For Production

  • Use a production WSGI server (Gunicorn)
  • Add environment variables for configuration
  • Implement proper logging and monitoring

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test thoroughly
  5. Submit a pull request

πŸ“„ License

This project is open source and available under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors