A Django REST API for managing an eCommerce system, including customer management, order processing, and user account functionalities. The API provides OAuth2 authentication and supports modular endpoints for different services.
- Python 3.x
- Pip
- PostgreSQLor any compatible database
- Google Account
- Africa Talk SMS gateway
- Clone the Repository:
$ git clone https://github.com/kevi-t/Ecommerce_API
- Set Up Virtual Environment:
$ python -m venv venv
- To activate the environment: source venv/bin/activate & On Windows use
$ venv\Scripts\activate
- Install Dependencies:
$ pip install -r requirements.txt
- Configure local settings add your secret keys for the Google account,Django secret and Africa Talk Sms gate way
- Configure Environment Variables: Create a .env file in the root directory and add necessary environment variables; Google,AfricaTalking SECRET_KEY,DATABASE_URL
- Run Migrations:
$ python manage.py migrate
- Run the Development Server:
$ python manage.py runserver
Run the following command to execute the unit tests: python manage.py test
Continuous Integration (CI): This project uses GitHub Actions for continuous integration.
The workflow is configured to run tests on every push to the repository.
- Project Structure: Clearly outlined, showing how the project is divided into modules.
- Setup Instructions: Step-by-step guide to get the API up and running locally.
- API Endpoints: Sample endpoints for the main modules (customer, order).
To simplify testing the API, you can download and import the provided Postman collection:
Endpoints descriptions:
-
Customer:
POST[/api/ecommerce/customer/register/]: Creates a new customer. POST[/api/ecommerce/customer/login/]: Logs in a user and returns an authentication token. PUT[/api/ecommerce/customer/update/]: update user profile (requires Bearer token).
-
Order:
POST[/api/ecommerce/order/place-order/]: Creates a new order.(requires Bearer token) GET[/api/ecommerce/order/list/]: Fetches the list of orders. (requires Bearer token)
-
OpenID connect/Google Sigin: paste on a browser to obtain the access Token
http://localhost:8000/api/ecommerce/customer/oidc/login/ https://ecommerce-api-alpha-dun.vercel.app/api/ecommerce/customer/oidc/login/
- Django docs: Django documentation