A django-graphql microservice to model simple store operations
This microservice is deployed in kubernetes cluster at http://174.138.123.164/ with a CI/CD pipeline configured
OIDC Authentication: The microservice uses OpenID Connect (OIDC) for authentication and authorization. It is implemented in a stateless way: instead of storing session data or issuing its own JWTs, the service validates incoming tokens directly against the OIDC provider’s public resources (such as the .well-known configuration and JSON Web Keys). This ensures that only users with valid OIDC-issued tokens can access the service.This exists at this endpoint
Products & Product Categories: The microservice exposes an API endpoint that allow authenticated users to create products and organize them into categories. Categories are structured as a hierarchical tree and can be nested beyond three levels, enabling complex product taxonomies.
Unauthenticated users can query all products using this API endpoint
Average Category Price: The microservice provides an API endpoint that allows all users to calculate the average price of products within a given category.
Order Creation: The microservice provides an API endpoint for authenticated users to create orders for selected products.
Order Alerts: The microservice notifies admins of new orders via email to support dispatch, and sends order confirmations to customers via SMS.
These features can be viewed with annotated screen shots here
- Run
git cloneon your local directory - Create a
.envfile in your root directory and populate per.env.example - Run
docker compose up --buildto spin up the docker containers
- We have the following services:
webfor our django/graphql microservicepgdbfor the postgres databasenginxfor our reverse proxyhueyfor background asynchronous taskredisfor storing task queues
- Navigate to
http://127.0.0.1:8080/to confirm it is running successfully - All python commands to the
webservice will be prepended withdocker compose exec webe.gdocker compose exec web python manage.py shell - Run prepend
manage.py runscript init_dbto populate db with products
- Root directory refers to the location where
manage.pyfile is
- Run
git cloneon your local directory - Install
uvtool from this link https://docs.astral.sh/uv/getting-started/installation/ - Create a new virtual environment by running
uv venv .venvin your root directory - Activate the environment by running
source .venv/bin/activate - Install packages using the command
uv sync - Create a
.envfile in your root directory and populate per.env.example - Create a local postgres db for app functioning and update
DATABASE_URLin.envfile accordingly
- We use dj-database-url to configure django database values
- Run migrations
python manage.py migrate - Run
python manage.py runscript init_dbto populate db with products - Run
python manage.py runserverto run the backend - Install redis on your system and run
python manage.py run_hueyto run the background task process - Navigate to
http://127.0.0.1:8000/to confirm it is running successfully