/fastapi-cqrs-mediator

Applying CQRS pattern with Python FastAPI.

Primary LanguagePython

User Service

Simple CRUD Web API that follows CQRS and Mediator patterns.

List of endpoints

Endpoints

GET /healthcheck/

curl -X "GET" "http://localhost:5000/api/healthcheck/"
{"status": "ok"}

POST /api/v1/users/

curl -X 'POST' \
  'http://0.0.0.0:5000/api/v1/users/' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "email": "mymail@gmail.com",
  "phone": "+0000000",
  "hashed_password": "strongpassword"
}'
{
  "id": 1,
  "email": "mymail@gmail.com",
  "phone": "+0000000",
  "hashed_password": "$2b$12$h/bkjN5WRJiBO6tTr/Ju1uDEiREZ0eBVb4e4EF8sIUSLkTN.WDCuC"
}

GET api/v1/users/

curl -X "GET" "http://0.0.0.0:5000/api/v1/users/1"
{
  "id": 1,
  "email": "mymail@gmail.com",
  "phone": "+0000000",
  "hashed_password": "$2b$12$h/bkjN5WRJiBO6tTr/Ju1uDEiREZ0eBVb4e4EF8sIUSLkTN.WDCuC"
}

DELETE api/v1/users/

curl -X 'DELETE' \
  'http://0.0.0.0:5000/api/v1/users/1' \
  -H 'accept: application/json'
{
  "id": 1,
  "email": "mymail@gmail.com",
  "phone": "+0000000",
}

Dependencies

Infrastructure

Key python libs

TODO

  • Write tests
  • Add Exception handlers