Skip to content

kevi-t/Ecommerce_API

Repository files navigation

Ecommerce API

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.

Project Structure

alt text

Technologies used

  • Django: A Python web framework
  • DRF: A powerful and flexible toolkit for building Web APIs

Prerequisites

Setup Instructions

  1. Clone the Repository:
        $ git clone https://github.com/kevi-t/Ecommerce_API 
  2. Set Up Virtual Environment:
        $ python -m venv venv 
  3. To activate the environment: source venv/bin/activate & On Windows use
        $ venv\Scripts\activate
  4. Install Dependencies:
        $ pip install -r requirements.txt
  5. Configure local settings add your secret keys for the Google account,Django secret and Africa Talk Sms gate way
  6. Configure Environment Variables: Create a .env file in the root directory and add necessary environment variables; Google,AfricaTalking SECRET_KEY,DATABASE_URL
  7. Run Migrations:
        $ python manage.py migrate
  8. Run the Development Server:
        $ python manage.py runserver

Test Coverage

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.

Key Features in This README.md:

  1. Project Structure: Clearly outlined, showing how the project is divided into modules.
  2. Setup Instructions: Step-by-step guide to get the API up and running locally.
  3. API Endpoints: Sample endpoints for the main modules (customer, order).

Testing the API on Postman

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/

Expected Sample Outputs

Register Endpoint

alt text

Login Endpoint

alt text

Place order Endpoint

alt text

Order List Endpoint

alt text

OpenID connect endpoint

alt text

Process flow Diagram

ecommerce_api process flow diagram

Deployment

  • Vercel: Deployment of my Django App
  • Railway: Deployment of my Postgre database service

Resources

About

A Django-based demo REST API service designed to showcase key features of an eCommerce platform

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published