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.
• ecommerce_rest_api/: Main Django project settings and configurations.
• customer_service/: Contains logic and routes for customer-related functionality.
• order_service/: Contains logic and routes for managing orders.
• account_service/: Manages user account creation, authentication, and profile updates.
• manage.py: Django’s utility script for tasks like running the server, making migrations, etc.
• .env: Environment variables file for sensitive data such as database credentials, secret keys, and API keys.
• Python 3.x
• Pip
• Virtualenv (optional but recommended)
• PostgreSQL or any compatible database
• Google Account
• Africa Talk SMS gateway
- Clone the Repository: git clone https://github.com/yourusername/ecommerce-api.git then: cd 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 locally on settings add your secret keys for the Openid connect account(Google:https://console.cloud.google.com/getting-started) and Africa Talk Sms gate way:https://account.africastalking.com/apps/sandbox
- Configure Environment Variables: Create a .env file in the root directory and add necessary environment variables; SECRET_KEY=your_secret_key, DEBUG=True, DATABASE_URL=your_database_url
- Run Migrations: python manage.py migrate
- Run the Development Server: python manage.py runserver The server will be running at http://127.0.0.1:8000/.
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 services.
- Setup Instructions: Step-by-step guide to get the API up and running locally.
- API Endpoints: Sample endpoints for the main services (customer, order, account).
To simplify testing the API, you can import the provided Postman collection: Clone the repository and import the postman collection file: ecommerce-api-postman-collection.json
Open Postman, click on Import, and select the downloaded .json file.
You will now have access to all the API endpoints with pre-configured requests in Postman.
• Customer Service: POST[ /api/ecommerce/customer/register/): Creates a new customer.
• Order Service: POST[ /api/ecommerce/order/place-order/): Creates a new order.
• Account Service: POST /api/ecommerce/account/login/: Logs in a user and returns an authentication token.