How I Structure my Go Applications for Scale
Вставка
- Опубліковано 2 бер 2024
- GoTTH Stack: github.com/tomdoesTech/gotth
GoTTH Stack video: • Introducing The GoTTH ...
🌎 Follow me here:
Discord: / discord
Twitter: / tomdoes_tech
Facebook: / tomdoestech
Instagram: / tomdoestech
TikTok: / tomdoes_tech
☕ Buy me a coffee: www.buymeacoffee.com/tomn - Розваги
Great video Tom. I was just looking for something like this, straightforward. I am a Typescript developers, and I know the main concepts of development, just wanted to see how it is applied in Go, specially in microservices environments
869 views in 2 days? What??? This video is awesome, deserves more
My audience doesn't really care much about Go I don't think
Tom is a genius 😉
Not this Tom
I need to Go and get one of these hats
Got to be sun safe
Love the hat
Thanks, my wife got it for me
You can make one main handler struct and specific struct if you need it
Not sure I know what you mean?
❤❤
can you make a short video showing how you set up your config.go
Yeah possibly, I don't think I have a good story around config though
You changed your stack?
can you make a video how to structure go app with clean architecture, nice video btw!
I know nothing about clean architecture
@@TomDoesTech its simply that u will have service layer, controller layer, cause right now i see that u handle all logic in handler func , right ?
@@001ibuyvn Yeah, everything is in the handler, except for when it calls the store. I don't know why I'd add a controller or service to it, doesn't seem like they would add any value
I have no interest in golang but I came for the hat
Do you think it's a good idea to put all stores in one struct and pass only one pointer to that struct into constructors instead of all stores you need separately (userStore, companyStore etc.)? And the same container for services (if you have services layer) to pass it by reference to handlers' constructors
It's not a bad idea, if that's how you want to do it I don't see any reason why you couldn't do it that way
@@TomDoesTech don't you use service layer ever? In so called "clean architecture" they usually have controllers-services-repos. But I'm also not sure If I actually need it. May be those services start making sense when you work on a big project in big teams?
@@aleksandrpetrov3938 I don't know what a service layer would add to this to be honest. The store kind of works like a service layer. I also don't know what "clean architecture" is
@@TomDoesTech they usually put business logic inside services. Also they can be called "usecases". So the controller just recieves and unmarshals data from client, validates it. Service does all business logic using one or different repos. Also it could use methods of other services. Then service gives some result back to controller and controller handles sending proper response back to client.
Why change your JavaScript decision for go? Why don't use rust or zig to replace go?
I've never worked for a company that uses Rust or Zig, otherwise I'd happily use them
sombrero man
It's just a beach hat but the sides have folded up for some reason
missing pkg i think
Yeah, I could put some stuff in pkg but I don't find it really adds any value