Hi everyone. I want to show my GitHub project. It's a basic microservices project. I'm using Go to develop it. It's not completed yet.
You can check it out here
https://github.com/aligoren/go_ecommerce_microservice
I'm not good at microservices or Golang. So, I hope I'll better understand Golang and Microservices with this project. It would be nice If I finish this project.
I need to feedbacks to improve my project :)
Thanks :)
Hi there.
You are creating some components for which there is production-ready stuff out there. It may be tempting to just implement it yourself, but using the available stuff frees you to do the thing at hand: creating an ecommerce experience. For example, your broker looks like a reverse proxy, which Traefik is quite good for.
If possible avoid custom authentication logic. It is prone to security errors and another thing to maintain. The current standard is OAuth2, which is a request-response flow between your application (client) and an authentication provider (server). There are providers out there making integration into your app very easy, like Auth0 or Ory. But you can also create a custom OAuth server based on available libraries (quite a time sink).
There is the User struct and its managed by an ORM library, but there's also code that creates SELECT statements with hard coded column names. That makes schema changes laborious. There should only be a single source of truth (the struct). Use the powers of ORM library to construct SELECT. (My personal preference is towards document database, which makes ORM redundant.)
Names and structures should correspond to the domain at hand. For example
Customer
would be more fitting thanUser
. The struct is very bare bones, expand it as necessary, e.g. invoice and delivery addresses. Eric Evans like to make a science of it, see "Domain Driven Design".Another book that I've enjoyed in the past is "Clean Code" by Robert C. Martin. But books aren't all. It seems like you have learned quite a bit in your junior position. Though with a senior at your side (not the web), who would be able to do a thorough review and criticism, I promise there would be a great leap in your expertise.
Happy hacking!