Open leonardomarcao opened 5 months ago
Hi @leonardomarcao, I apologize for the delay and hope you're doing well!
Thanks for the feedback and for expressing your interest in pycommerce
, I appreciate it! Now, to your questions:
I have a question, in your opinion, how fast is the usage of this structure/architecture project developing a small/medium project size?
For example, imagine I want to add a new entity called Order, what is the flow, and how much time will be spent to develop this? Of course, this depends on more detailed context and I apologize for this, but consider this question generic.
For small projects, this structure is definitely an overkill. You'll lose too much time dealing with all levels of indirection, and the benefit won't pay off if the project doesn't grow, so don't bother with it if that's your case. You can benefit from a less formal structure with fewer layers and still have a good level of independence between them if you keep the discipline and consistency to maintain it organized and decoupled.
In terms of development speed for medium and large-sized projects, the initial setup time can be consuming. However, after implementing the first use case, the subsequent ones will be quick as the structure is already in place as a starting point. It took me a little less than an hour to implement all the layers (tests included) for the Category
entity, as I already had implemented them for the User
entity.
Regarding the development flow, a good framework to follow is to work from the inside out. For example (ignoring the tests):
Let me know if my answer makes sense to you and feel free to ask me more questions!
Thank you for answer my question and clarify my mind.
So, I decided to use your project making some adaptations, look the currently structure:
βββ alembic.ini
βββ app
βΒ Β βββ api
βΒ Β βΒ Β βββ dependencies
βΒ Β βΒ Β βΒ Β βββ address.py
βΒ Β βΒ Β βΒ Β βββ auth.py
βΒ Β βΒ Β βΒ Β βββ blog.py
βΒ Β βΒ Β βΒ Β βββ company.py
βΒ Β βΒ Β βΒ Β βββ crypto.py
βΒ Β βΒ Β βΒ Β βββ document.py
βΒ Β βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βΒ Β βββ jwt.py
βΒ Β βΒ Β βΒ Β βββ mail_service.py
βΒ Β βΒ Β βΒ Β βββ s3_service.py
βΒ Β βΒ Β βΒ Β βββ tenant.py
βΒ Β βΒ Β βΒ Β βββ user.py
βΒ Β βΒ Β βΒ Β βββ vehicle.py
βΒ Β βΒ Β βββ extensions.py
βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βββ middleware
βΒ Β βΒ Β βΒ Β βββ exceptions.py
βΒ Β βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βΒ Β βββ query_params.py
βΒ Β βΒ Β βΒ Β βββ tenant.py
βΒ Β βΒ Β βββ routers
βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βββ root.py
βΒ Β βΒ Β βββ v1
βΒ Β βββ application
βΒ Β βΒ Β βββ config.py
βΒ Β βΒ Β βββ data
βΒ Β βΒ Β βΒ Β βββ default_data.json
βΒ Β βΒ Β βββ dto
βΒ Β βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βΒ Β βββ paginate.py
βΒ Β βΒ Β βββ entities
βΒ Β βΒ Β βΒ Β βββ base.py
βΒ Β βΒ Β βΒ Β βββ enum
βΒ Β βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βββ exceptions
βΒ Β βΒ Β βΒ Β βββ address.py
βΒ Β βΒ Β βΒ Β βββ auth.py
βΒ Β βΒ Β βΒ Β βββ base.py
βΒ Β βΒ Β βΒ Β βββ blog.py
βΒ Β βΒ Β βΒ Β βββ company.py
βΒ Β βΒ Β βΒ Β βββ document.py
βΒ Β βΒ Β βΒ Β βββ tenant.py
βΒ Β βΒ Β βΒ Β βββ user.py
βΒ Β βΒ Β βΒ Β βββ vehicle.py
βΒ Β βΒ Β βββ i18n
βΒ Β βΒ Β βΒ Β βββ exceptions.json
βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βββ interfaces
βΒ Β βΒ Β βΒ Β βββ crypto.py
βΒ Β βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βΒ Β βββ jwt.py
βΒ Β βΒ Β βΒ Β βββ mail_service.py
βΒ Β βΒ Β βΒ Β βββ repositories
βΒ Β βΒ Β βΒ Β βββ s3.py
βΒ Β βΒ Β βΒ Β βββ unit_of_work.py
βΒ Β βΒ Β βββ setup.py
βΒ Β βββ domain
βΒ Β βΒ Β βββ address
βΒ Β βΒ Β βΒ Β βββ city
βΒ Β βΒ Β βΒ Β βββ country
βΒ Β βΒ Β βΒ Β βββ dto.py
βΒ Β βΒ Β βΒ Β βββ entities.py
βΒ Β βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βΒ Β βββ state
βΒ Β βΒ Β βΒ Β βββ usecases.py
βΒ Β βΒ Β βββ blog
βΒ Β βΒ Β βΒ Β βββ dto.py
βΒ Β βΒ Β βΒ Β βββ entities.py
βΒ Β βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βΒ Β βββ usecases.py
βΒ Β βΒ Β βββ company
βΒ Β βΒ Β βΒ Β βββ dto.py
βΒ Β βΒ Β βΒ Β βββ entities.py
βΒ Β βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βΒ Β βββ usecases.py
βΒ Β βΒ Β βββ document
βΒ Β βΒ Β βΒ Β βββ dto.py
βΒ Β βΒ Β βΒ Β βββ entities.py
βΒ Β βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βΒ Β βββ usecases.py
βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βββ tenant
βΒ Β βΒ Β βΒ Β βββ dto.py
βΒ Β βΒ Β βΒ Β βββ entities.py
βΒ Β βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βΒ Β βββ usecases.py
βΒ Β βΒ Β βββ user
βΒ Β βΒ Β βΒ Β βββ dto.py
βΒ Β βΒ Β βΒ Β βββ entities.py
βΒ Β βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βΒ Β βββ usecases.py
βΒ Β βΒ Β βββ vehicle
βΒ Β βΒ Β βββ advertisement
βΒ Β βΒ Β βββ brand
βΒ Β βΒ Β βββ category
βΒ Β βΒ Β βββ dto.py
βΒ Β βΒ Β βββ entities.py
βΒ Β βΒ Β βββ feature
βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βββ model
βΒ Β βΒ Β βββ usecases.py
βΒ Β βββ infra
βΒ Β βΒ Β βββ common
βΒ Β βΒ Β βΒ Β βββ application.py
βΒ Β βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βΒ Β βββ resize_image.py
βΒ Β βΒ Β βββ db
βΒ Β βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βΒ Β βββ models
βΒ Β βΒ Β βΒ Β βββ repositories
βΒ Β βΒ Β βΒ Β βββ unit_of_work
βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βββ providers
βΒ Β βΒ Β βΒ Β βββ crypto.py
βΒ Β βΒ Β βΒ Β βββ data_validation.py
βΒ Β βΒ Β βΒ Β βββ __init__.py
βΒ Β βΒ Β βΒ Β βββ jwt.py
βΒ Β βΒ Β βΒ Β βββ mail.py
βΒ Β βΒ Β βΒ Β βββ s3.py
βΒ Β βΒ Β βββ templates
βΒ Β βΒ Β βββ mail
βΒ Β βββ __init__.py
βΒ Β βββ __main__.py
βββ docker-compose.yml
βββ Dockerfile
βββ docs
βββ heroku.yml
βββ package-lock.json
βββ poetry.lock
βββ README.md
βββ scripts
βΒ Β βββ init.sql
βββ start-dev.sh
I can consider this small today, but it's a whitelabel project that'll be grow-up after some time.
It's working 100%!
Thank you my friend.
That's awesome! At first, I was tempted to follow something similar to what you did in the domain layer, but I decided to go with the current implementation.
Would you mind explaining the role of the application
layer?
Hi Γlefe, how are you?
Congratulations on the repository, this project is beautiful and applies good modern practices.
I have a question, in your opinion, how fast is the usage of this structure/architecture project developing a small/medium project size?
For example, imagine I want to add a new entity called Order, what is the flow, and how much time will be spent to develop this? Of course, this depends on more detailed context and I apologize for this, but consider this question generic.