This API provides a simple service for managing customers and their orders, implementing secure authentication using OpenID Connect (OIDC) and sending SMS notifications upon order creation. The application is built using Django and Django REST Framework (DRF) with PostgreSQL as the database, and leverages Africa’s Talking SMS gateway for real-time alerts.
-
Customer Management: Create, update, and view customers, including details such as name, email, and unique codes.
-
Order Management: Create and view orders linked to customers, with details such as item name, amount, and order timestamp.
-
Authentication and Authorization: Secure access to the API using OpenID Connect (OIDC) via django-allauth, enabling seamless integration with identity providers like Google for OAuth2-based authentication.
-
SMS Notifications: Upon successful order creation, the API sends an SMS notification to the customer's registered phone number using Africa’s Talking SMS gateway.
-
Testing and CI/CD: Includes comprehensive unit tests to ensure reliability, with continuous integration and deployment setups for automated testing and deployment.
- Backend: Python, Django, Django REST Framework Database: PostgreSQL
- Authentication: OpenID Connect (OIDC) via django-allauth
- SMS Alerts: Africa’s Talking SMS gateway
- CI/CD: GitHub Actions
-
Clone the repository.
-
Install pipenv:
- On Linux
sudo apt-get install pipenv
- On macOS or Windows
pip install pipenv
- On Linux
-
Setup project environment:
pipenv install
-
Activate the project environment:
pipenv shell
For more information about Pipenv, check: Pipenv: A Guide to The New Python Packaging Tool - Real Pyhton
-
Copy the envsample file to the root folder with the name
.env
. Change settings and configurations on the.env
file:- Database settings: Used PostgreSQL for this project.
- All Auth settings: Google's client_id and client_secret.
- Africa's Talking Settings: username and api key
-
Make changes to your database:
python manage.py migrate
-
Usage:
cd Vitabu-api python manage.py runserver
On your browser, run the following link: http://localhost:8000/accounts/login. Tap on Google to sign in with Google to access the API.
The documentation of the API created using Django Rest Framework (DRF) is on the file api.md
.
Want to make TradersIn better?
- Fork the project.
- Create a new branch to work on
git checkout -b <feature_branch>
- You can name the branch with the prefix
feature_
- Add your changes and push them to the branch:
git push
- Open a pull request
Lionel Gicheru LinkedIn