indrayyana / go-fiber-boilerplate

A boilerplate for building RESTful APIs using Golang, Fiber, and GORM PostgreSQL
MIT License
113 stars 19 forks source link

Implement Dependency Injection using Google Wire #5

Open indrayyana opened 1 month ago

indrayyana commented 1 month ago

Currently, the application manually initializes and wires dependencies in the Routes file. This approach can become difficult to maintain as the application grows and dependencies become more complex.

Implementation Plan:

  1. Each service (EmailService, UserService, TokenService, AuthService, etc) will have a provider defined in a new wire.go file, specifying how these services are initialized.
  2. A wire_gen.go file will be automatically generated by Google Wire to manage dependencies.
dhfherna commented 1 month ago

Can you provide more details about the need for this issue?

indrayyana commented 1 month ago

Hi @dhfherna,

I've added a detailed description above.

Please review the updated description and let me know if you need any additional clarification.

Abiji-2020 commented 1 month ago

@indrayyana I would like to work on this issue. By creating a new file wire.go which will wires dependencies in the services currently mentioned in them. Shall I implement the file in router package?

indrayyana commented 1 month ago

@Abiji-2020 Yes, that covers the requirements for now.

Abiji-2020 commented 1 month ago

Then. I am working on this issue.