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 clone
on your local directory - Create a
.env
file in your root directory and populate per.env.example
- Run
docker compose up --build
to spin up the docker containers
- We have the following services:
web
for our django/graphql microservicepgdb
for the postgres databasenginx
for our reverse proxyhuey
for background asynchronous taskredis
for storing task queues
- Navigate to
http://127.0.0.1:8080/
to confirm it is running successfully - All python commands to the
web
service will be prepended withdocker compose exec web
e.gdocker compose exec web python manage.py shell
- Run prepend
manage.py runscript init_db
to populate db with products
- Root directory refers to the location where
manage.py
file is
- Run
git clone
on your local directory - Install
uv
tool from this link https://docs.astral.sh/uv/getting-started/installation/ - Create a new virtual environment by running
uv venv .venv
in your root directory - Activate the environment by running
source .venv/bin/activate
- Install packages using the command
uv sync
- Create a
.env
file in your root directory and populate per.env.example
- Create a local postgres db for app functioning and update
DATABASE_URL
in.env
file accordingly
- We use dj-database-url to configure django database values
- Run migrations
python manage.py migrate
- Run
python manage.py runscript init_db
to populate db with products - Run
python manage.py runserver
to run the backend - Install redis on your system and run
python manage.py run_huey
to run the background task process - Navigate to
http://127.0.0.1:8000/
to confirm it is running successfully