Show HN: A Full-Stack Web Framework for Go (opens in a new tab)github.com
531 pointsI created a short video to show you how to create a minimal Hacker News clone with Bud: https://www.youtube.com/watch?v=LoypcRqn-xA.
The framework is free, open source and MIT Licensed. You can find it on Github: https://github.com/livebud/bud.
I started working on Bud 2 years ago after watching the introductory Laracast videos about the Laravel web framework. I was just blown away by how productive you can be in Laravel. However, like many of you, I've been so spoiled by Go. I didn't want to go back to writing PHP, so I decided to try creating Laravel for the Go ecosystem.
At this point, I just had the following goal:
• Be as productive as Laravel in a typed language like Go.
I got the first version working in 6 months and tried building a blog from it... It fell flat. You needed to scaffold all these files just to get started. If you're coming from Rails or Laravel you may shrug, this is pretty normal. Unfortunately, I've also been spoiled by the renaissance in frontend frameworks like Next.js. What I love about Next is that it starts out barebones and every file you add incrementally enhances your web application. This keeps the initial complexity under control.
With these newly discovered constraints, I started working on the next iteration. Bud should:
• Generate files only as you need them. Keep these generated files away from your application code and give developers the choice to keep them out of source control.
• Feel like using a modern JS framework. This means it should work with modern frontend frameworks like Svelte and React, support live reload and have server-side rendering for better performance and SEO.
With these new goals, the Bud you see today started to take shape. But along the way, I discovered a few more project goals:
• The framework should be extensible from Day 1. Bud is too ambitious for one person. We're going to need an ambitious community behind this framework.
• Bud should be able to provide high-level APIs for developers while compiling down to performant low-level Go code for production.
• Bud should compile to a single binary. With platforms like Fly.io and Heroku, these days it's easy to not care about this, but I still cherish the idea that I can build a single binary that contains my entire web app and secure copy it up to a tiny server that doesn't even have Go installed.
It's still super early days. You can find the the Roadmap on Github: https://github.com/livebud/bud/discussions/9. I encourage you to contribute your thoughts.
And here's the current documentation for what's already in Bud: https://denim-cub-301.notion.site/Hey-Bud-4d81622cc49942f991.... Comments are enabled for anyone to chime in.
I have big plans for the framework. I hope you'll join me on this journey to build ambitious websites faster with Go!
Comments (99) 32 threads
Earlier commentsI've started using Go at work so definitely interested in using this for side-project web apps to keep me in the Go mindset.
Great questions. I answered some above, so I'll copy some and then answer your other questions below:
>> what's it doing?
Bud server-side renders Svelte files, then hydrates them on the client. This is similar to what most other JS frameworks do, it works like this:
1. Create two builds: one for server, one for browser. Both are built using ESBuild. In development, builds happen lazily upon request, similar to how a CDN like esm.sh would build JS to be imported. This will hopefully allow the build system to scale for larger apps. Vite was my inspiration here, but it's all done in Go.
2. V8 and the Svelte compiler are baked into the bud binary. When a request comes in, V8 evaluates the compiler running the server-built page and returns HTML. That's a mouthful, hopefully that makes sense.
>> what gets sent across the wire?
What gets sent over the wire is HTML. That HTML then has a script tag which requests the client-side version of the page that's used to hydrate the HTML and make the page interactive.
>> How big is the binary for the HN demo?
I just checked the binary size and it's 47.6 MB. It's mostly V8 right now, but will definitely get larger as you add more assets. I haven't tested it yet, but hopefully you'll be able to rsync just the diffs to a server.
>> What's the story for static assets like video or images
You can add them in the public/ directory. There's documentation here: https://denim-cub-301.notion.site/Hey-Bud-4d81622cc49942f991...
---
Let me know if you give Bud a go on your side-project! Happy to go into more depth here, over email hi@livebud.com or on twitter @mattmueller
I started my programming career after following the Rails how to make a blog in 15min youtube video. Always a good choice.
Fun fact: It took DHH a year after he first introduced Rails to get that famous weblog demo up. This stuff takes time :)
I just don't want a NodeJS backend, all our team wants is to use a Golang backend which saves us ton of resources, which means less instances required, which means less $$$ (and Golang is awesome - performant, easy to read and write, easy to code concurrency, type safe without the hassle, built-in test suites/formatter/etc).
I'd love something like Laravel but for Golang+Svelte.
Please hit me up when you give Bud a try over email hi@livebud.com or on twitter @mattmueller. I'd love to hear what you think!
"I think Node is not the best system to build a massive server web. I would use Go for that. And honestly, that’s the reason why I left Node. It was the realization that: oh, actually, this is not the best server-side system ever."
Heavy computation still ties up the event loop in Node.js. We're just not talking about it as much because most people deploy to serverless functions nowadays which can spin up compute upon request. I love serverless and use it with https://standupjack.com, but it comes with it's own tradeoffs!
But then he created deno....
All comments shown.
Couldn't load more comments. Check your connection and try again.