The TRUTH About Golang Backend Frameworks
Вставка
- Опубліковано 4 вер 2023
- 🔍 What is the BEST Go Framework?
Are you tangled in the web of Go backend frameworks, wondering which one to choose for your next project? Look no further! In this eye-opening video, we dig deep into the core of popular Go frameworks like Gin, Chi, httpRouter, Fiber, and echo, and unveil the surprising truth-they're more alike than you think!
There's always a debate between which is the BEST framework. But which one is it really?
Twitch
I stream live on Twitch every weekend
Twitch : / melkey
Join the amazing community on Discord
Discord: / discord
I post memes and host Twitter Tech Spaces
Twitter: / melkeydev
SUBSCRIBE OR GET LAID OFF
╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
#coding #neovim #typescript #programming #vim #softwareengineering #codinglife #webdesign #webdevelopment #webdev #javascript #rustlang #rust #twitch #twitchstreamer #programmerhumor #codinghumor #software #softwareengineer #softwaredeveloper #softwaredevelopment #gymbro #gym #programmerhumor #programming #coding - Наука та технологія
I hope you all enjoyed this video!
I love Go and I love all the Go backend services.
If you enjoyed this video - please consider liking and subscribing. It means the world to me :)
heeey, love your vids, thanks man!
video suggestion for you: tell your story, how you learned to code, school, college, first job, bad jobs, good jobs...
I'd really like it
industry looking for a good framework with go. As framework always come up with best outline practices, code maintainability, etc. but thanks for clearing up my confusion... 🙂
Great video, but why you did not include links in the description?
The node devs are bringing their "javascript problem" with them to go frameworks with Fiber and Echo. Just use chi (which actually uses the std lib handler interface) and learn the go paradigms.
Depends on the project. Always. There is no gate to keep here.
i was using gin and echo i was building small projects and was not enjoying it, then changed to chi and i love it now i cant stop pushing myself to limits currently building a social media app backend in chi
Exactly. JavaScript devs are so afraid of writing code. They just want a framework to give them a cute API that abstracts most of the programming away from them.
The best Go framework is: no framework (?)
@@hamm8934as a JavaScript dev i confirmed this
Important caveat is that Fiber doesn’t use net/http. That one goes against your point about advocating for the standard library. It is a great library regardless, but it brings in some of the JS abstractions with it trying to replicate Express in Go.
Found this out the hard way when troubleshooting and growing my project. With the other frameworks, there were more adaptable modules and associated docs. Mostly because they are closer to net/http with true support of the http response interfaces.
I use golang to not have to use javascript/js framework syntax... lol, any library that tries to replicate that automatically goes into the recycling bin.
"JavaScript framework syntax" is too broad. Which framework are we talking about? And whether it's a JS inspired framework or otherwise, it's a framework-An additional layer of abstraction- built on top of a language, in this case, go. @@depralexcrimson
Vulpix really made me giggle, not gonna lie.
Oh HEY!
YOU MAKE REALLY GOOD GO VIDEOS!
Love the channel!
A little correction- actually the ones based on fasthttp e.g. fiber are not based on http core go library!
I love Chi for that, its just a router built to work with the standard library. Simple and powerfull. I tried Fiber recently and you need to put a little more work to keep an idiomatic codebase but the performance off the server it brings are really nice at first glance.
1:08 you fixed the sound effect volume. amazing. thanks man
Glad to hear!
Both Chi and httprouter are routers, not frameworks. For anything other than routing you will need to bring in whatever you need/want. Gin/Echo/Fiber provide things beyond routing. You can't put them into the same category. Also httprouter isn't the closest to the std. library. What makes you think so? Look at the handler signature alone. httprouter literally provides adapters to be compatible with the std. interface. Chi doesn't require that.
Just wanted to clear things up a bit, as i found this video a bit misleading....
Of echo/ gin/ fiber which do you prefer? I've been using chi for a few weeks and like it but want to understand my options better
@@HypothesisI i honestly can't tell, as i don't really have a preference. I personally used only a router (chi or whatever...) for most of my projects. On the other hand something like Gin is really really convenient, if you want a bit less re-inventing the wheel. Fiber... i'm on the fence about. It's based on fasthttp, which leads to being rather incompatible with the std. lib. I'm not sure if the speed alone is justification enough. It has other good features though.
If you want to understand your options better, the best thing you can do is use them. Play around with them. And not listening to a wild hobo like me ;-).
Yeah, when we started using Go in our company, we used did what we did in the Node world: "Best web-framework for Go" and we got Gin as a result. It was a pleasure to work with. Until it didn't. We needed a feature that Gin couldn't provide at that time.
We had to rip it out and use a different library because our Code was too dependent on Gin. It took a weak to rewrite all parts to remove Gin from our Codebase. This wouldn't have happened if we used std lib compliant handlers from the very beginning. Since then being not compatible with the std lib became a deal breaker for us.
Actually, I tried Fiber for a smaller project, since it claims to be much faster than the std lib. That may be so. I never had the opportunity to fully test it. I did have to give up on the custom web utils, since they're not compatible with fiber.
But Fiber comes with a client too. And I needed to send multiple requests to multiple JSON endpoints at the same time and then merge the results together. Yeah, it didn't work too well. No matter what I tried, it never really turned out okay. WaitGroups, channels ... you name it (and each goroutine created it's own client to boot).
It worked during the testing, but failed in production. Had to rip it out and replace it with std lib HTTP Clients. Did it become slower? Yes. But not enough to justify unstable results (those should be deal breakers anyway, we're past the MongoDB era).
I have used gin for all of my professional go microservices, it works really well. Middlewares and route grouping are the features I use most often. It has enough community support and its much faster than the standard library as per the benchmarks.
Gin is great. I love Chi personally
You wrote that you used gin but gin is slower than fiber why did not you use fiber instead gin?
I like the simplicity and the community gin offers. Also the performance improvement wasn't big enough to make the switch.
in most cases, Fiber is more than enough. crazy fast and easy to learn and use. 🚀
Boom!
That's true, I make mainly backend applications with typescript and node. And for my "degree" (IDK how to say that but I mean that I'm still studying) we are using java and OMG I love the standard library of go and their type system design. The "low level" control that go gives to you for some things. Their simplicity and the tools that come with the language is amazing. Personally I use fiber but because I have chosen to work with it thanks to the "Express inspired" tag, and it works for me and I learned how to use it, so I will keep using it.
Fiber, then used echo primarily cause of pocketbase but will have to get stdlib a shot on my next go around.
At this rate, you should build your own backend framework to compete
YO SHOULD I ?!?!?!?!?
DONT TEMP ME LEWIS
Tried all of those and also iris. I always come back to gin. There's smth really neat about that library
Used Gin, would use it again. Reminds me of Express, and to me Express is almost perfect backend framework :)
Great to hear!
I really like chi, and yes! it's the closest to the standard library
me too brotha
I started javascript and php vanilla.
I believe with both, it is easily possible to write evertyhing you want with it.
I mean... the frameworks and libraries are build using that same language.....
I see a lot of people using packages, frameworks or libraries, and not understanding how they work under the hood
As soon as you create a vanilla construct, they look at you like it's dirty, ugly code, but they dont see that the tools they are using function the exact same way, but prettified with a wrapper function.
I like go. the ease on how you can set up allmost every tool you like is great( Although... string manipulation is still a challenging concept in golang for me :P)
The most important things are already under your fingertips, accessible without any configuring a framework or bundler.
With some extra lines of code, you can easy write the "luxery" that frameworks offer you.
no professional wants to waste their time recreating the wheel
@@packratrust ...and this is why we have abominations like React. I guess not everyone can be professional then; someone has to do the dirty work of actually making the stuff work beneath the 40 layers of abstraction for the script kiddies.
@@ForeverZer0 funny seems like most react haters are so far from frontend and don't know anything about react, what 40 layers, react is dead simple small library, you have js functions that return layout, that's it. If you are thinking it's more professional to write vanilla js and reinvent the wheel for each thing, then i just feel sorry for ppl who will support this mess after you and for time wasted by writing same thing over and over. Maybe you should write your frontend in asm then, it's the only none script real language there.
@@ForeverZer0that's why I always use VanillaJS. I used to develop using JS frameworks, the company had many projects in maintainance... And after 2 years the nightmare begun:
Almost 90% of all projects couldn't run locally, just because of outdated dependencies. We didn't touch ANYTHING in years, it just stopped working.
We were a small team, so maintainance phase is TOO important for us.
That's why, with a lot of effort, we migrate all to VanillaJS. And now, maintenance is 0, because we have 0 dependencies.
It took a long time to build our "perfect" html/css/js templates, but it's something you do once, and you use it forever.
While frameworks will always suffer in the maintainance phase, specially when having many projects.
I don't know about the go frameworks but this is the best go channel.
You're the best thank you
To be fair, I stopped caring about frameworks and their "wars". Until they are well maintained, easy to use and follow the "standard" pattern (so I don't spend more time to learn it, rather implement it from zero) I'm down to any of them... Oh, almost forgot! Have a proper jwt handling system! The only thing that matters for me, if I don't have to touch the ready code in the following few months for the fault of the framework.
If I’m not using the std library with mux routing, I just gin.
I’m moving toward htmx and gin’s ShouldBind method does some beautiful field validation for form data.
I gotta check it out
I’m enjoying go ent framework. Have you taken a look at it?
The only thing I find lacking in the std lib is variables in the url string, but that's a feature that's coming soon
Once you've built a CRUD app with the stdlib you'll see that these routers don't really offer much outside of a sprinkle of syntactic sugar. That isn't to say you shouldn't use them, but I think it's well worth a few hours using only the stdllib and seeing what you can do with it (everything).
The same opinion
Can you make a series on building different apps with just the standard library?
Yeah
Thanks bro, this was good learning for me. Although my current needs simply don't require anything other than Python and maybe a bit of SQL/HTML, maybe one day I might need a better tool.
That's why I love python ecosystem so much when it comes to web frameworks. All inclusive? Django. Rest API with some freedom? FastAPI. Total freedom? Flask.
All these have their use cases and serve a purpose. In go I feel that everything is almost the same and there are no clear benefits to using one tool over the other. I guess given some time they will "split" at some point.
I will consider go if you use different photo for the thumbnails.
great video! go is robust and solid by yourself!
Yes! Thank you!
I've used Gin and the standard library. I ALSO used Revel! Don't use Revel! It uses a separate build tool!
Gin is great!
the new 1.22 routing is really gonna help use straight library for this...
YEP!
I have a video about this coming out soon!!
I like go's extensive standard library but I still believe frameworks is making developers life easier. They abstract things and help you to move faster. when you are writing your own saas application (depending on domain) most of the time you are not interested whats going on under the hood you are interested how fast I can move my mvp and do marketting etc
I don't use Go that often, just for small side projects here and there, and I rarely see a need for bringing in a third party dependency for most things. The only thing I wish was in the std lib http router is support for url parameters like `/users/:id`. If it had that, it would be amazing, although it is very good already
Maybe try gin-gonic next time. It is not much more than the std stuff but it has routing with URI parameters and a lot of other features.
Fiber does this
fiber can do this easily
Haven't tried yet, but that should be out now in Go 1.22. Previously I've used gorilla/mux for some basic routing with variables, otherwise just plain bog standard http.HandlerFunc.
After Go 1.22 we'd use any framework?
thanks for pointing this up .. i will use gin I see how it goes
Awesome - let me know!
wow thanks. I was literally in the situation of going from javascript searching THE framework
Dont do it!!
I use Go Fiber since it reminded me of FastAPI/Express and I get so much hate for it on Reddit like I kicked a puppy since it uses the fasthttp router. I promised myself that as soon HTTP3 with UDP becomes a thing I'll convert away from Fiber which is easy since all frameworks are roughly the same implementation. Is using Fiber really that big of a cosmic sin?
Nope. Choose the right tool for the job. Good performance? An API that makes you productive? Sall good.
Chose it for a project in work involving migrating Python microservices to Go. It worked out great.
Hey Melky, perfect timing. Do you know how to deploy a golang backend that uses go fiber on vercel serverless? I can't find any example online
Is it possible, though? Thought Vercel was for Node only
@@HenriqueNewsted vercel does have a runtime for GO but the docs don't help much, i tried yesterday just copying the hello world example they have and not even that worked...
@@vicentebravocabezas yeah I think the .mod and .sum files have to be at the root of the project and the main.go file gotta be inside the api folder (talking about a nextjs project)
i like fiber, because it have sane default '__'), have adapter to use net/http also, best performance because bufferpool
oh but too bad the default logger is bottleneck, that's why i use other stuff to log (clickhouse directly if structured, or onelog/zerolog/zap)
Go is meant to be simple, straightforward and productive. Many people that comes from other languages struggles with this difference and start looking for frameworks and libraries for everything. This language is very easy to adopt and will turn you into an expert programmer very quickly.
It can certainly turn you into a Go expert very quickly
so i think a beginner for me, just use standard library. if i'm applying to jobs, just follow what framework do they use. is my way thinking right?
I really like axum
Really good information and a yugioh fan? Thumbs up for sure
I’d rather trust go team than 3rd party libs developers in security matters.
No one develops from scratch as we’ve already got rich net/http.
This sets go apart from other languages: you don’t need so many external dependencies to build web apps. For example, beloved Rust: it has absolutely nothing out of the box, and to make even the simplest web app you need to add a list of crates, and be familiar with their apis that don’t follow any common rules and vary greatly from one to another.
I thought that this video was click bait but was not, thanks for that
I'll go with fiber given that i'd be more likely to encounter it more often haha
I’m the 5 th person to comment here
And I guess using standard go is annoying for me bc I came from php and js backend 😂😂
If you came to go to do the same stuff you did on js and php kinda defeats the point of choosing go doesn't it? Just think why you chose go 😅
These were great points, but GoChi sounds like a DragonBall character so it's obviously better.
Quick, get Shenron and revive dead frameworks
GOATED video
Cool video
I don't quite grasp your point, to be honest. What's the downside now of using Echo or Fiber? Because they are wrappers? If you JUST want to write routes and whatever you describe in your video, you still need to consider a lot of things like CSRF, XSS, sessions, logging, etc. These frameworks solve a bunch of these problems and save a lot of time, which is valuable. I wouldn't recommend using the standard library just for the sake of "because it's raw" or whatever the argument here is, which I'm really trying to understand but can't quite wrap my head around
did you reply to the correct video?
The point here is that fundamental frameworks and libraries tend to exhibit similar structures. He merely suggested trying out Go's standard library to discern the distinctions. In the end, gaining an understanding of what a framework can accomplish and how to build one yourself is always beneficial for future endeavors and potential optimizations.
He never said there was a downside, nor did he say use it in production. This is a video for beginners stuck and being indecisive about what framework to use for learning.
He highlighted all these frameworks basically do the same things. And that the choice matters less.
What he said was “explore” the standard library first. He didn’t say never use the frameworks at all.
@MelkeyDev What about BeeGo?
Godamn son
Omegachads just use the standard lib bruh.
Im about done with the basic version of my first web server with some authentication. Im sure once i turn it into a big project, ill eat the crow.
I use oapi-codegen in strict mode as my framework.
you just add a not so well known or maintained library to the list which contrast you point. :)
Which one..?
In this case, I'm creating my own. Let's go to the JS culture in GO hahaha
I've used goa a lot at work, but I would always stick to the standard library for a hobby project
How about for non-hobby projects?
Using a standard lib sounds fun until you have 300 endpoints. I settled on fiber. For any thing less than 50 routes. I use stdlib
Great point!
Holy shit I did so much PHP is this video real or not
Flow router by Alex Edwards. It's tiny, simple, and great.
Hey bro I think you are not read the documentation of fasthttp. It isnt written over net/http golang it has its own worker pull and written over tcp.
I learned go TO NOT LEARN just another framework.
no more frameworks please
Surpriesed gorilla/mux isn't here. Especially since it's being maintained again.
There just too many! It's definitely a good one
Wait what??? I thought gorilla/mux was abandoned since December 2022
too bad I'm not very good at using the standard library
What about .NET and C#?
it's funny how the definition of a framework differs from PHP to any other language
in PHP you have a lot of boiler plate already preset that cover logic you find in at least 80% of cases and you don't want to waste time setting them up, BASSICALLY USING THE "REUSE" WORD TO THE MAX
in other languages you pretty much just have a small wrapper over the basic language, i think most of the time you will waste writing documentation for what does what in each directory
Hey Melkey. Might be out of context for this particular video, but can do a video showcasing how and when you use queues, tools like rabbitmq in Golang (programming in general)? 🥹
not everyone has to do everything from scratch. there are useful middleware provided with the frameworks. its better to learn everything from scratch if you are a beginner but not everyone has the time to implement already existing middleware and other utility functions provided by third party libraries
Yup+!
All my homies use standard library
all my homies
GO TIME
Go is the framework.
Yep!
Given Go 1.22, time to update this video. 🤔
I, believe you are right sir
To put it short: use Chi or accept the c developer ways of making it yourself
Ok I will use gorilla/mux
this is the TLDR right here folks
All of them are just routers with some middleware functionality and some of them use "framework" keyword just because of newcomers coming from JavaScript :)
there is something real about frameworks
If you pay close attention to them and how they work,
you forget to become a real programmer in your language,
for the loss of time that this requires.
It is better to learn the language well and make your own environment.
Gorilla Mux ?? Std>Gorilla>= Chi >others
Go doesn't need frameworks. Never did. You pick nice modules that fits into your requirements, so your application becomes "a framework". And that is exactly what makes everything great.
Yes sir!
Yessssir
real chads write their own framework
Check out go-blueprint
Thank goodness it's the TRUTH.
I only speak the TRUTH
I accept Your Challenge
"The JavaScript problem" LMAO
Chi is super Awesome
Loved the video Melkey 🚀If anyone's looking for more Golang videos, we released a logging tutorial and guides to help the community too 💪
Bro you have issue with angular
no i do not
@@MelkeyDev just guessing since you didn't mention angular but all libraries and frameworks
go-chi da goat
Still found Fiber the best and fastest...
Gin is 40 times faster... than what ?
I'm still looking for the answer too 🙃
martini @@rick_from_yr
I use chi. I secretly think videos like this are slight unhelpful bc someone coming from python,java, js really should be given an answer... strengths of each...and then you should explain why it doesn't matter and how thin they are and why go is different.... I say this because I don't think the std lib message lands until they've dived into programming go, usually using chi or something...Just my opinion - great vid!
Edit: and i only say this bc i just lived this lol
Yes, you are right
Like no one ever was...
As someone migrating to Go, the biggest problem I see in community is not over-engineering, but under-engineering.
A lot of Go developers try to build everything from scratch, which increses the lead time of projects, specially if you work with microservices.
And every new thing you need, you need to build by yourself. What's wrong with using libraries and frameworks? Answer: nothing, it's about choosing your fights. How many security breachs are we deploying just for the sake of "use the std lib".
Under-engineering is a problem just as big as over-engineering.
But sure, let's be purists, what could go wrong? zzzzzz
Btw, I love Go, I just didn't learn yet to like the Go purists community.
muh "use the stdlib then make your own framework" instead of just using a framework
A bit superficial analysis. Obviously if you just look at the core basic functionality, they all look the same. But if you dive a bit deeper you will start noticing clear and important differences among those tools
Okay! Can you share some examples?
The standard library is the way! If I need a better router, I just go with chi, nothing else! Chi Gang! 😎
Beginners should not ask a out frameworks for problem Y, they should ask how to do X in Go.
Yep! But theres definitely good other options :)
So… it’s exactly the same as JavaScript.
Talks about Go, then notes the "JavaScript problem" and only notes front-end frameworks and not one backend framework. Hahahaha.....
what the fuck are you talking about
I got your point but it was just an analogy. A good one, I came from JS too
javascript fked the system
laravel is way more mature than all of these combined.
Can we just stop messing with this dead language
Sure just get rid of Uber, Twitch, Docker, Netflix, Dropbox, Paypal, and of course Google then it will just fade away.
@@OldKing11100 please do
And what should we replace it with ?
@@wolfVFXmc Javascript obviously and none of that garbage typeof fake types. Pure coercion any primitive in an array Javascript.
@@succatashyeah js with thousands memory leaks