A feature-rich full-stack inventory management application with AI-powered image analysis capabilities. Built with FastAPI backend and React frontend, featuring mock computer vision analysis that can be easily replaced with real AI models.
- Store & Product Management: CRUD operations for stores and products
- Image Upload & Analysis: Upload shelf photos with AI-powered detection and counting
- Timeline Visualization: Interactive charts showing inventory trends over time
- Mock AI Pipeline: Realistic dummy data structure ready for real model integration
- Modern UI: Responsive React interface with Tailwind CSS
- Local Storage: SQLite database with local file storage
- FastAPI: Modern Python web framework
- SQLAlchemy: ORM with SQLite database
- Pillow: Image processing
- Mock Image Analyzer: Simulates computer vision pipeline
- React 18: Modern UI framework
- TypeScript: Type-safe development
- Vite: Fast build tool
- Tailwind CSS: Utility-first styling
- Recharts: Data visualization
- Axios: HTTP client
- Lucide React: Icon library
project-root/
├── backend/
│ ├── main.py # FastAPI app entry point
│ ├── app/
│ │ ├── models/ # SQLAlchemy models
│ │ ├── schemas/ # Pydantic schemas
│ │ ├── routers/ # API endpoints
│ │ ├── services/ # Business logic
│ │ └── database.py # DB configuration
│ └── requirements.txt # Python dependencies
├── frontend/
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── pages/ # Page components
│ │ ├── services/ # API services
│ │ └── types/ # TypeScript types
│ ├── package.json # Node dependencies
│ └── vite.config.ts # Vite configuration
├── uploads/ # Image storage (created automatically)
├── app.db # SQLite database (created automatically)
└── README.md
- Python 3.8+
- Node.js 16+
- npm or yarn
-
Navigate to backend directory:
cd backend -
Create and activate virtual environment:
python -m venv .venv .venv\Scripts\activate # On Windows # or source .venv/bin/activate # On macOS/Linux
-
Install dependencies:
pip install -r requirements.txt
-
Start the backend server:
python main.py
The API will be available at
http://localhost:8000
-
Navigate to frontend directory:
cd frontend -
Install dependencies:
npm install
-
Start the development server:
npm run dev
The frontend will be available at
http://localhost:5173
- Navigate to the Dashboard
- Use the quick action buttons to add stores and products
- Or access the API directly at
http://localhost:8000/docs
- Go to the Upload page
- Select a store and product
- Upload a shelf photo
- The system will run mock analysis and show results:
- Item count (1-30 items)
- Confidence score (75-98%)
- Bounding boxes for detected objects
- Segmentation masks (optional)
- Visit the Timeline page
- Filter by store and/or product
- View interactive charts showing:
- Daily inventory counts
- Confidence trends
- Statistical summaries
GET /api/stores/- List all storesPOST /api/stores/- Create storeGET /api/stores/{id}- Get storePUT /api/stores/{id}- Update storeDELETE /api/stores/{id}- Delete store
GET /api/products/- List all productsPOST /api/products/- Create productGET /api/products/{id}- Get productPUT /api/products/{id}- Update productDELETE /api/products/{id}- Delete product
GET /api/scans/- List scans with filtersPOST /api/scans/- Upload image and create scanGET /api/scans/{id}- Get scan detailsDELETE /api/scans/{id}- Delete scan
POST /api/timeline/data- Get timeline dataGET /api/timeline/stats- Get statisticsGET /api/timeline/summary- Get summary data
The system includes a sophisticated mock image analyzer that simulates real computer vision results:
# Example mock output
{
"count": 15,
"confidence": 0.92,
"bounding_boxes": [
{
"x1": 0.1, "y1": 0.2,
"x2": 0.3, "y2": 0.4,
"label": "product",
"confidence": 0.95
}
// ... more detections
],
"segmentation_masks": [
{
"mask_type": "polygon",
"mask_data": [{"points": [...]}],
"label": "product",
"confidence": 0.88
}
// ... more masks
]
}To integrate a real AI model:
-
Replace the MockImageAnalyzer class in
backend/app/services/image_analyzer.py -
Implement the ImageAnalyzer interface:
class RealImageAnalyzer(ImageAnalyzer): async def analyze_image(self, image_path: str) -> AnalysisResult: # Your real AI logic here pass
-
Update the import in
backend/app/routers/scans.py:from app.services.image_analyzer import RealImageAnalyzer image_analyzer = RealImageAnalyzer()
id,name,location,description, timestamps
id,name,sku,description,category, timestamps
id,store_id,product_id,image_path,count,confidence, timestamps
id,scan_id, bounding box coordinates,label,confidence
id,scan_id,mask_type,mask_data,label,confidence
# Backend tests (when implemented)
cd backend
pytest
# Frontend tests (when implemented)
cd frontend
npm test# Backend linting
cd backend
flake8 app/
# Frontend linting
cd frontend
npm run lint- Database not found: The SQLite database is created automatically on first run
- Port 8000 in use: Change the port in
main.py - Dependencies missing: Ensure virtual environment is activated
- Port 5173 in use: Vite will automatically find an available port
- API connection failed: Ensure backend is running on port 8000
- Dependencies missing: Run
npm installin frontend directory
- CORS errors: The backend is configured for
localhost:5173 - Image upload fails: Check file size and format restrictions
- Timeline empty: Upload some scans first to generate data
-
Use a production WSGI server like Gunicorn:
pip install gunicorn gunicorn main:app -w 4 -k uvicorn.workers.UvicornWorker
-
Configure environment variables for production
-
Set up proper file storage permissions
-
Build for production:
npm run build
-
Deploy the
dist/folder to your web server
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.
- Real AI model integration (YOLO, SAM, etc.)
- User authentication and authorization
- Advanced filtering and search
- Export functionality (CSV, PDF reports)
- Real-time notifications
- Mobile app
- Cloud deployment options
- Advanced analytics dashboard
- Integration with external inventory systems