The Goal of this project to show python project architecture what is framework-agnostic and following DDD and Clean Code Architecture. All application code is in different layers with strict boundaries. That should help with easier reading and future project changes like.
- Change 3rd party API provider, changes will happen in
Persistence
layer, It should not affect business logic. - Infrastructural changes, they don't affect business logic, it means it should happen in its layer
- Changing framework. For example chosen framework is not support in serverless environments, if project need to be migrated. It should not affect business logic.
- Etc...
All those changes should be more or less easy to do in such architecture chosen in this project.
Project is just for learning purpose to show architecture examples by using DDD and Clean Code Architecture principles. Author didn't mean that chosen solution is silver bullet in software architecture. In software development is none of it. Even though that project is fully functional not all parts are fully done.
All documentation is written as part of code. Suggested order for reading is following.
entity/entities.py
entity/valueobject.py
customtypes/invoice.py
api.py
usecases.py
persistance/repository.py
persistance/mapper/dummy.py
Project is fully functional, made on top of Python version 3.10. By using Starlette framework with Uvicorn combination.
pip install -r requirements.txt
cd src
uvicorn api:app --reload
pytest
Integration tests are in tests.http
The best way how to learn is to practice. Fork this repository and start working with code.
- Finish all missing API endpoints
POST /invoices
is not parsing data from requestGET /invoices
does not existPUT /invoices/<id>/mark-as-paid/
does not exist
- Create
Mapper
for persistence storage like: SQL like storages, Filesytem, memory etc...