AutoMart is a backend e-commerce system built with Django and DRF, featuring product management, sales, purchases, and inventory tracking. It supports real-time notifications and is Docker-ready for seamless deployment.
This e-commerce backend system is built with Django and Django REST Framework (DRF) to manage products, sales, and purchases. It includes JWT-based authentication, with OAuth2.0 configurations also available but not in use. The system features product management, sales/purchase orders, low stock notifications, and scheduled tasks to notify the admin when inventory is low. Docker is used to ease deployment and scalability. You can also access the API documentation via Swagger/DRF docs at 127.0.0.1:8080/en/docs
and test email functionality using Mailpit at http://localhost:8025/
.
The system allows full CRUD operations for managing products in the store. Each product contains fields like name
, description
, price
, and stock
. The unique identifier for products is the SKU
(Stock Keeping Unit). When a product is created or updated, the inventory is adjusted accordingly.
The system manages the sales process by allowing authenticated users to place orders for available products. When a sales order is created, the stock of the product is automatically decreased according to the quantity sold.
Purchases allow the business to restock inventory. When a purchase order is created, the stock of the product is increased by the specified quantity.
The inventory management system is automated to handle stock changes after successful sales and purchases. Additionally, the system periodically checks for products that have low stock levels (e.g., less than 5 units) and generates notifications for the admin.
The system uses JWT-based authentication to secure the API. All endpoints are protected, and only authenticated users can access them. Admin and staff permissions are enforced on critical actions such as product management, order deletion, and purchase creation.
Notifications are created when product stock is low. The notification contains the product name, a message indicating the low stock level, and the current stock value.
Clone the repository:
git clone https://github.com/Abdurahman-hassan/AutoMart
cd AutoMart
Create a virtual environment and activate it:
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
Install the required packages:
pip install -r requirements/requirements.txt
Copy the .env.template
and .admin.template
files to .env
and .admin
, and fill in the required values:
cp .envs/.env.template .envs/.env
cp .envs/.admin.template .envs/.admin
Edit the .env
and .admin
files:
nano .envs/.env
nano .envs/.admin
Set up your configurations for professional JWT. OAuth2.0 configuration is available but not in use.
docker-compose -f docker-compose.dev.yml up --build -d
Run the following command to create a superuser:
just create-admin
Make and apply migrations:
just migrate
Seed the database with initial data:
just seed
Collect static files:
just collectstatic
Build and run Docker containers for Gunicorn production:
just gunicorn-docker up --build -d
Build and run Docker containers for uWSGI production:
just uwsgi-docker up --build -d
Stop Docker containers:
docker-compose down
Access the app at http://localhost:8080/en/
.
Access Mailpit for email testing at:
http://localhost:8025/
Access the API documentation via Swagger at:
http://localhost:8080/en/docs/
justfile
for more commands and information.