Welcome to InventoryPro! Efficient billing system that also updates inventory stock after a sale. Additionally, it generates statistical sales reports. This simplified system includes product management, inventory control, and sales recording.
- Backend: Django, Django REST Framework
- Frontend: React
- Database: PostgreSQL
- Authentication: Auth0
- Caching: Redis
- Clone the Repository:
git clone https://github.com/RogelioRichmanAstronaut/inventorypro.git cd inventorypro cd inventory_management
- Set Up Virtual Environment:
python -m venv .venv source .venv/bin/activate
- Install Dependencies:
pip install wheel pip install -r requirements.txt
- Run Redis Server:
Ensure Redis is installed and running. You can install Redis by following the instructions here.
redis-server
- Open Another Terminal and run the development server.:
cd inventorypro cd inventory_management python manage.py runserver
- Credentials Superuser backend:
Superuser:
username: danitest
Email: danitest@test.com
password: Dani123!
- Open a New Terminal and Navigate to the Frontend Directory:
cd inventorypro cd frontend-react
- Install Dependencies:
npm install
- Run the Development Server:
npm run dev
- Credentials user Auth0 Frontend:
"username": "testuser",
"password": "TestUser123!",
"email": "testuser@test.com"
inventory_management/
├── api/
│ ├── management/
│ ├── migrations/
│ ├── models.py
│ ├── serializers.py
│ ├── urls.py
│ ├── views.py
│ ├── sql/
│ ├── tests.py
├── inventory_management/
│ ├── settings.py
│ ├── urls.py
│ ├── wsgi.py
├── manage.py
frontend/
├── src/
│ ├── App.tsx
│ ├── CreateProduct.tsx
│ ├── CreateReport.tsx
│ ├── EditProduct.tsx
│ ├── InventoryContext.tsx
│ ├── NewSale.tsx
│ ├── ReportDetails.tsx
│ ├── Reports.tsx
│ ├── Sales.tsx
│ ├── apiService.ts
│ ├── auth/
│ ├── main.tsx
│ ├── vite-env.d.ts
Our database schema consists of the following main tables:
- Product: Stores product details.
- ProductHistory: Tracks product history.
- ProductHistoryMovement: Records product history movements.
- Sale: Records sales transactions.
- SaleItem: Associates products with sales.
- User: Stores user details.
- Auth: Manages authentication tokens.
- SalesReport: Stores sales report data.
- SalesReportItem: Contains items of sales reports.
- API Endpoints: We developed a RESTful API using Django REST Framework (DRF) for product management, sales, and inventory control.
- Authentication: Implemented token-based authentication using Auth0.
- Inventory Control: Managed inventory updates through stored procedures.
- Sales Management: Handled sales recording and inventory updates atomically.
- Sales Reports: Generated statistical reports using PostgreSQL functions.
We used Swagger to document our API endpoints. You can access it at /swagger/
. Example: http://127.0.0.1:8000/swagger/
- Components: We created reusable components for products, sales, and reports.
- State Management: Used React hooks to manage state efficiently.
Implemented routing using React Router for seamless navigation between different views.
Screenshots of the frontend UI:
We ensured atomicity in critical operations like inventory updates using Django transactions and PostgreSQL stored procedures.
- Query Optimization: Optimized queries for large-scale operations.
- Cache Implementation: Used Redis for caching to improve response times.
- Scalability: Designed with horizontal scalability in mind.
If you want to use the provided environment variables, simply follow the steps mentioned in the Project Setup section.
- Update Database Credentials:
Modify the
DATABASES
setting ininventory_management/settings.py
. - Configure Auth0:
Update the Auth0-related settings in
inventory_management/settings.py
:AUTH0_DOMAIN = 'your-auth0-domain' API_IDENTIFIER = 'your-api-identifier' CLIENT_ID = 'your-client-id' CLIENT_SECRET = 'your-client-secret' JWT_ISSUER = f'https://{AUTH0_DOMAIN}/'
This project provides a comprehensive solution for basic inventory management, including product management, inventory control, and sales recording. It ensures robust transaction management and generates valuable sales reports. We hope this system meets your needs and enhances your e-commerce operations. If you have any questions or need further assistance, feel free to reach out!
Utility:
- Developers: Can use it as a template for building their own inventory management systems.
- Businesses: Can adapt it for managing their inventory, sales, and generating reports.
- Educational Purpose: Useful for learning how to integrate Django with PostgreSQL, implement RESTful APIs, and build React frontends with Auth0 authentication.
Thank you for using the inventorypro. We hope it simplifies your inventory and sales management tasks. Feel free to explore and contribute to the project.
This project is licensed under the terms of the MIT license. See the LICENSE file for details.
For more detailed information, please refer to the project documentation or contact the project maintainers.
Developed by Daniel Sandoval.