TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

I Love Hex Arch/DDD – How to Enforce with Python/Flask?

2 pointsby girafffe_i3 months ago

2 comments

girafffe_i3 months ago
Anyone have experience implementing DDD and Hex architecture with Python enterprise services?<p>I fell in love the abstraction patterns that Hex architecture and DDD provide, especially when upgrading a framework that only affected one layer (REST), or when any outside contract changes you only need to change the adapter or port interface layer since everything depends on Core but core depends on nothing.<p>I love the payoff and risk mitigation of using strong static typed languages for enterprise code and architecture but I recently took over a large Python Flask app. We need to start abstracting layers to replace a 3rd party service with a new one. For hex architecture to work I need to use dependency injection which looks like the main Flask app.py seems the place to wire those up but I don&#x27;t think it can be enforced without strong PR controls and standards.
onjinx3 months ago
I learned a lot from this book: - <a href="https:&#x2F;&#x2F;www.cosmicpython.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.cosmicpython.com&#x2F;</a><p>And was enforcing which layer can do imports from another layer using this tool: - <a href="https:&#x2F;&#x2F;pypi.org&#x2F;project&#x2F;import-linter&#x2F;" rel="nofollow">https:&#x2F;&#x2F;pypi.org&#x2F;project&#x2F;import-linter&#x2F;</a>