A project to practice the language, design patterns and best practices
- install poetry
.env: localhost values for the HOST vars
$ docker compose build
$ docker compose up -d
$ poetry run peterpy
.env: container names (mysql, kafka1) values for the HOST vars
$ docker compose build
$ docker compose up -d
To switch between the 2 methods, stop en remove all containers then build again
$ docker compose watch keep terminal open
$ docker compose logs -f in another terminal
- setup service, health check endpoint
- setup logger using yaml config
- organize routes
- add typing
enforcinghinting only in python - dev tooling, lint formatting etc
- implement Repository Pattern with in memory data
- implement service
- add product to global repository
- add entity encode with to_json method, pass in response
- can't create product same name
- catch not found error, proper response
- setup Postman with automation for list of product creation
- implement Abstract Base Class
- dockerize
- add app restart mechanism on code change (also within docker container)
- add database container to docker setup
- setup Kafka stack, produce message on add product
- connect database
- setup and implement ORM in database-repository
- organize db connection
- setup database-session + commit in aiohttp-middleware (1 commit per request). in middleware try/catch with rollback in catch. app start open connection, app shutdown close connection
- setup dependency injection in app start so handler doesnt need to get repository from the request + and create new service every request (middleware adds product_service to the request.)
- add test-tooling and unit tests
- add pagination to /list
- add custom exceptions (middleware catch Exception, return a fitting response for certain exceptions)
- use sqlalchamy async queries https://docs.sqlalchemy.org/en/20/orm/extensions/asyncio.html for better performance
- setup migrations (use Flyway)
- input validation
- Github Actions (linting, testing)
- ...