This is the API for Me-Mart, a simple e-commerce application. It provides endpoints for managing users, products, carts, and orders.
- User authentication (signup, login) with JWT
- Product management (create, read, update, delete)
- Shopping cart functionality
- Order management
- API documentation with Swagger and ReDoc
POST /api/signup/: Register a new user.POST /api/login/: Log in a user and get an access token.POST /api/token/refresh/: Refresh an access token.GET /api/users/all/: Get a list of all users (admin only).GET /api/user/: Get the current user's details.PUT /api/user/: Update the current user's details.
GET /api/product/: Get a list of all products.POST /api/product/: Create a new product.GET /api/product/<int:pk>/: Get a single product by its ID.PUT /api/product/<int:pk>/: Update a product.DELETE /api/product/<int:pk>/: Delete a product.
GET /api/cart/: Get the items in the current user's cart.POST /api/cart/: Add an item to the cart.PUT /api/cart/<int:pk>/: Update the quantity of an item in the cart.DELETE /api/cart/<int:pk>/: Remove an item from the cart.
GET /api/order/: Get a list of the current user's orders.POST /api/order/: Create a new order from the items in the cart.GET /api/order/<int:pk>/: Get a single order by its ID.
- Django
- Django REST Framework
- Simple JWT for Django REST Framework
- drf-spectacular for API documentation
- SQLite
-
Clone the repository:
git clone https://github.com/Lftobs/E-commerce.git cd E-commerce -
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate -
Install the dependencies:
pip install -r requirements.txt
-
Run the database migrations:
python manage.py migrate
-
Run the development server:
python manage.py runserver
The API will be available at http://127.0.0.1:8000/api/.
API documentation is available at the following endpoints:
- Swagger UI:
http://127.0.0.1:8000/api/schema/docs/ - ReDoc:
http://127.0.0.1:8000/api/schema/redoc/