Optimizing Route Registration for a Big Project: Modular Monolith with go-chi & Clean Architecture #991
Unanswered
refaatcrafts
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey everyone,
I'm building a backend API using go-chi and aiming to follow clean architecture principles while maintaining a modular monolith structure. My application includes many different endpoints (like product, category, payment, shipping, etc.), and I'm looking for the best way to register routes in a clean and maintainable manner. and to handle the dependency management and passing it to the down steam components
Currently, I'm using a pattern where the route registration function is part of the handler itself. For example, in my user module, I have a function inside the handlers package that initializes dependencies and registers the route:
In this setup, each module manages its own dependencies and route registration, which keeps the codebase modular and aligns with clean architecture principles.
For context, my project structure is organized like this:
My Questions for the Community:
I’d really appreciate your insights, alternative strategies, or improvements based on your experiences. Thanks in advance for your help
Beta Was this translation helpful? Give feedback.
All reactions