You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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