Skip to content

Inventory Management System developed with Django | Django REST API for backend and Vite | React | Tailwind Css for frontend

Notifications You must be signed in to change notification settings

kevinThulnith/Inventory-Management-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

34 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Python IDLE Django DRF JWT Postgres Vite React Tailwind Axios NodeJS

πŸš€ Inventory Management System

πŸ“¦ A Full-Stack Inventory Management Solution with πŸ” User Authentication and Authorization. ✨ Built with Django | Django REST Framework for the backend and Vite | React | Tailwind CSS for the frontend. Fully ⚑ Optimized Code with πŸ“± Fully Responsive.

Tech Stack

🌟 Key Features

πŸ” Authentication & Security

  • πŸ‘€ User Registration - Create new accounts with validation
  • πŸ”‘ JWT Authentication - Secure login/logout system
  • πŸ›‘οΈ Role-Based Access - Protected routes & endpoints
  • πŸ”’ CSRF Protection - Enhanced security against Cross-Site Request Forgery attacks

πŸ“¦ Product Management

  • πŸ†• CRUD Operations - Add/Edit/View/Delete products
  • 🏷️ Smart Categorization - Organize with nested categories
  • πŸ“Š Real-Time Inventory - Track stock levels & alerts

πŸ’Ό Business Operations

  • πŸ‘₯ Customer Management - Track purchases & history
  • 🏭 Supplier Integration - Manage procurement workflow
  • πŸ’° Sales & Purchases - Complete transaction tracking

πŸ› οΈ Advanced Functionality

  • πŸ” Powerful Search - Filter products by multiple criteria
  • πŸ“ˆ Reporting Dashboard - Visualize sales & inventory data
  • πŸ“± Mobile-Friendly - Works flawlessly on all devices

🎯 Performance & SEO

  • πŸ“± Mobile-First Design - Optimized for all devices
  • πŸš€ SEO Optimized - Enhanced meta tags and semantic HTML
  • πŸ“Š Performance Metrics - Optimized loading times and Core Web Vitals
  • πŸ” Search Engine Friendly - Improved crawlability and indexing

πŸ”₯ Tech Stack

πŸ—οΈ Backend

  • 🐍 Python: Programming language.
  • 🎯 Django: Web framework.
  • πŸ”„ Django REST Framework (DRF): For building RESTful APIs.
  • πŸ” JWT Authentication: Secure user authentication.

🎨 Frontend

  • ⚑ Vite: Fast build tool for React.
  • βš›οΈ React: JavaScript library for building user interfaces.
  • 🎨 Tailwind CSS: Utility-first CSS framework for styling.
  • πŸ”„ Axios: For making HTTP requests to the backend.

πŸš€ Quick Start

πŸ“‹ Prerequisites

  • Python 3.10+
  • Node.js 16+
  • PostgreSQL 12+

Backend Setup

  1. Clone the repository:
git clone https://github.com/kevinThulnith/Inventory-Management-System.git
  1. Create a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: .\venv\Scripts\activate
  1. Install dependencies:
  • install postgressSQL and c++ buid tool first.
pip install -r requirements.txt
  1. Run migrations:
python manage.py migrate
  1. Start the Django development server:
python manage.py runserver

➑️ Backend runs at http://localhost:8000

Frontend Setup

  1. Navigate to the frontend directory:
cd ../frontend
  1. Install dependencies:
npm i
  1. Start the Vite development server:
npm run dev

➑️ Frontend runs at http://localhost:3000

🌐 To Host on Local Network

  1. Get device Ip address
ipconfig getifaddr en0 // in windows ipconfig
  1. Start bachend
py .\manage.py runserver <Device Ip address>:8000
  1. Start frontend

    • change .env file fist
npx vite --host {Device Ip Address}

Configuration: βš™οΈ

  • Database: Configure your database settings in backend/inventory/settings.py. You can use SQLite (default, good for development) or PostgreSQL, MySQL, etc. for production.
  • Environment Variables: Consider using environment variables (e.g., using python-dotenv) for sensitive information like secret keys and database credentials. Don't commit these to your repository! 🀫
  • API Base URL: Update the API base URL in your frontend React components to point to your Django backend (usually http://localhost:8000).

πŸ“‚ Project Structure

πŸ“¦ inventory-management-system
β”œβ”€β”€ πŸ“‚ backend             # Django REST API
β”‚   β”œβ”€β”€ πŸ“‚ core            # Main app (settings, models, views)
β”‚   β”œβ”€β”€ πŸ“‚ products        # Product & Category logic
β”‚   β”œβ”€β”€ πŸ“‚ customers       # Customer management
β”‚   β”œβ”€β”€ πŸ“‚ suppliers       # Supplier management
β”‚   β”œβ”€β”€ πŸ“‚ sales           # Sales tracking
β”‚   └── πŸ“‚ purchases       # Purchase tracking
β”‚
β”œβ”€β”€ πŸ“‚ frontend            # React Frontend
β”‚   β”œβ”€β”€ πŸ“‚ src
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ components  # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ pages       # Page components
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ hooks       # Custom React hooks
β”‚   β”‚   └── πŸ“‚ api        # API service functions
β”‚   └── vite.config.js     # Vite configuration
β”‚
└── πŸ“œ README.md           # You're here!

πŸ” Authentication Flow

  • Register api/user/register/ : Users can create an account by providing their details.
  • Login api/token/ : Users log in with their credentials and receive an authentication token.
  • Protected Routes: Only authenticated users can access product management features.
  • Logout api/token/blacklist/ : Users can log out, and their token is invalidated.

πŸ”— API Endpoints:

The backend provides a RESTful API using Django REST Framework. You can access the API documentation at http://localhost:8000/api/ (or the correct port for your development server) after running the Django server. Example endpoints:

  • /api/categories/ (GET, POST, PUT, DELETE)
  • /api/customers/ (GET, POST, PUT, DELETE)
  • /api/suppliers/ (GET, POST, PUT, DELETE)
  • /api/products/ (GET, POST, PUT, DELETE)
  • /api/sales/ (GET, POST, PUT, DELETE)
  • /api/purchases/ (GET, POST, PUT, DELETE)
  • /api/token/ (POST) - Obtain JWT token
  • /api/token/refresh/ (POST) - Refresh JWT token

Security Headers

X-CSRFToken: <csrf-token>
Authorization: Bearer <jwt-token>

πŸš€ Configuration Steps

CSRF Setup

  1. Include CSRF token in HTML template:
<meta name="csrf-token" content="{{ csrf_token }}" />
  1. Add to API requests:
axios.defaults.headers.common["X-CSRFToken"] = getCookie("csrftoken");

SEO Configuration

  1. Update meta tags in index.html:
<meta name="description" content="Your description" />
<meta name="keywords" content="inventory, management, system" />
  1. Configure social media tags:
<meta property="og:title" content="Your Title" />
<meta property="og:description" content="Your Description" />

πŸ›‘οΈ Security Features

CSRF Protection

  • Django's built-in CSRF middleware for form protection
  • Custom CSRF token handling for API requests
  • Secure cookie handling and validation
  • Protection against cross-site request forgery attacks

SEO Implementation

  • Custom meta tags for better search engine visibility
  • OpenGraph and Twitter Card meta tags for social sharing
  • Semantic HTML structure for better accessibility
  • Optimized page titles and descriptions
  • Mobile-friendly responsive design

πŸ’‘ Why Choose This Project?

  • πŸš€ Modern Stack - Cutting-edge technologies
  • πŸ“ˆ Scalable Architecture - Ready for growth
  • 🎨 Beautiful UI - Tailwind-powered design
  • πŸ”„ Real-Time Updates - Instant data reflection
  • πŸ“± Mobile-Ready - Perfect for all devices

🀝 Contributing

We ❀️ contributions! Here's how:

  1. 🍴 Fork the repository
  2. 🌿 Create a branch (git checkout -b feature/amazing-feature)
  3. πŸ’Ύ Commit changes (git commit -m 'Add amazing feature')
  4. πŸ“€ Push to branch (git push origin feature/amazing-feature)
  5. πŸ”€ Open a Pull Request

Show Your Support: ❀️

If you find Inventory Management System helpful, please consider:

  • Starring the repository on GitHub! ⭐
  • Sharing it with your network.
  • Contributing to the project.

Happy Coding! πŸŽ‰πŸ‘¨β€πŸ’»πŸ‘©β€πŸ’»