Lurker News
Hey HN! I want to share my side project with you. It's called Bud and it's a full-stack web framework for Go.

I 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 comments
realrocker1 reply#
Oh wow someone finally went ahead with the server rendered js in Go ! Looks great. I have been experimenting various ways to build web apps in Go: https://github.com/adnaan/gomodest-template. I have landed on pursuing one approach more deeply: server rendered html templates over websockets. Don’t have a lot of documentation right now but here are some examples: https://github.com/goliveview/examples.
matthewmueller1 reply#
Love seeing people experimenting in this space with Go! One of my favorite things about this HN post is everyone is coming out of the woodworks to share their ideas.

What's the advantage of rendering HTML templates over websockets? Is this similar to Hotwire where it sends you HTML fragments over websockets when you, for example, click on a button?

realrocker#
Like you said in another thread, there are two choices here. I took the other choice because I wanted to: 1. not build a new templating language 2. not maintain a custom server side renderer(v8). 3. Keep javascript to the minimum 4. Build for developers who know Go and maybe a little html/css. 5. No special html attributes. It should be just standard html/template i.e easy to delete the websocket stuff if it doesn’t work for you 6. Offer a view library instead of a framework. Go users are likely to be more open to adopting a library.

The approach is similar to hotwire except I only use stimulusjs and not use turbojs. turbojs doesn’t integrate well with html/template. In my approach, you can simply reuse the html templates you have already written with standard html/template package.
Sorry for the rambling, I haven’t gotten around to writing down all of it in a more structured way.

onionisafruit1 reply#
Congratulations on shipping. The demo looks great.

I see views and controllers in the documentation, but the only mention of model is that "model" is a reserved directory. What are your plans for models and persistence?

matthewmueller2 replies#
Thanks for your comment and question @onionisfruit. Top-notch handle too!

>> What are your plans for models and persistence?
I haven't worked out all the details, but it's going to be some blend of https://github.com/xo/xo and https://sqlc.dev/.
Design goals:
1. High-level, type-safe "ORM" that's generated from your database schema.
2. sqlc as a fallback to cover the more complex SQL queries in a type-safe way.
The hard part is going to figuring out how to support extending the ORM with your own custom methods, hooks, computed fields etc.
What do you think?

onionisafruit#
Your design goals look good to me. I think this will be one of the hardest parts to get right, so it's probably wise to save it for later so you can learn from implementing the rest of your design first.
shubham_sinha#
First steps can be to use git diff and select what’s changed. Bulk of the heavy lifting will still be responsibility of ORM (sqlc). Later on this experience can be streamlined.
reddec1 reply#
First of all - great work, thanks. Will follow the progress.

I have been working with Go professionally since 2015 and quite often it makes me feel frustrated due to lack of full-stack web frameworks.
I was thinking to do something like your project, but with focus to full SSR/zero-js. Lucky me, you started it first . Maybe be in some things I will prefer different approach, however, your project already released (and it's excellent) while mine only in prototype. After I read the documentation in your project it feels like you really stepped on a lot of minefields. Great job!
One thing is still bothering me though (or maybe I missed it in docs): how is Bud dealing with relative links? Very often JS writers forgetting about the situation when the application could be served under different root locations. Does Bud have helpers to construct relative URLs without relying on user-provided server url? (I made PoC for that - don't use it in production https://github.com/reddec/gin-template-manager/blob/eb09f4e8...)

matthewmueller#
@reddec, thanks for chiming in.

Having path helpers absolutely needs to happen, something like: https://guides.rubyonrails.org/routing.html#creating-paths-a.... I'll probably get custom routing up before that though because I want to make sure the design covers changes to routes.
There's a whole layer of generated JS/TS that will eventually be built out here.

matthewmueller#
Truth. Website coming soon! This post exploded way more than I expected. Can't complain!

Load more comments