Hacker News Re-Imagined

Show HN: A Full-Stack Web Framework for Go

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!

  • 530 points
  • 10 days ago

  • @matthewmueller
  • Created a post

Show HN: A Full-Stack Web Framework for Go


@dinvlad 10 days

Replying to @matthewmueller 🎙

Very interesting, and using all of the latest tech. I was literally dreaming about combining Remix + Cloudflare Workers + Golang the other day. The only problem is Go would need to be compiled into WASM for that [0]. But this would provide one of the best experiences both in terms of development and performance/latency.

[0] https://community.cloudflare.com/t/support-golang-natively-f...

Reply


@abdouls 7 days

As someone who uses (and loves) Laravel, this looks very promising! I've been looking for an alternative to Laravel in NodeJS but found nothing at the same level of it. Looking forward to using Bud in an upcoming project (will be a REST API backend in Go).

Reply


@DoctorOW 10 days


@tompston 10 days

Whoa, this looks insane!

_shameless plug_

I kind of made an almost similar thing can generate custom boilerplate for backend servers a while ago -> https://github.com/tompston/gomarvin

Reply


@mavbo 10 days

Glad to see progress in this space.

I couldn't find anything describing the paradigm used for the JavaScript frontend. From the video, it looks like things are fully server side rendered, i.e. no client side routing as-in SvelteKit or Next.js? Are the Svelte components hydrated+interactive after page load? In my experience so far with SvelteKit and other SSR+SPA frameworks, there are too many tradeoffs with hydrating then opting to CSR for subsequent navigation. I like the browser's built-in implementation of navigating between pages because it preserves things like mutations to the document and scroll position out of the box, with no additional JavaScript. If you collapse a comment in this thread, navigate back to the home page, then use your browser's back button, the comment you collapsed should still be collapsed. In my experience with SPA CSR, you'll need to track and restore the JavaScript state driving that collapse on your own (a combination of the window.history object and CSR hooks), since navigating back to the page is a full client side re-render of the page.

I've found Svelte+React have good support for TypeScript, especially for guaranteeing the types of props passed to components, are there plans to support this? With controllers in Go and Views in Svelte/React, is there any way to help with correctness of data passed as props to the Svelte components?

Reply


@anthropodie 10 days

Great work.

The last bit about single binary is quite interesting. I could easily deploy app to my raspberry Pi without worrying about bundling things. I know Go can do this but it's nice that framework aligns with Go philosophy.

Reply


@ehaughee 10 days

This looks cool. I know effectively nothing about Svelte so some of these questions may be coming from that ignorance....but can you talk more about the embedded V8 instance (what's it doing?) and also what gets sent across the wire? Is it the usual HTML and JS or is there any server-side rendering going on? How big is the binary for the HN demo? What's the story for static assets like video or images?

I've started using Go at work so definitely interested in using this for side-project web apps to keep me in the Go mindset.

Reply


@rnewton 10 days

Your site's DNS is currently not resolving. Should provide alternate install instructions for cases like this.

https://www.whatsmydns.net/#A/livebud.com

Reply


@dmix 10 days

> Build a Minimal Hacker News Clone in 15 Minutes with Bud

I started my programming career after following the Rails how to make a blog in 15min youtube video. Always a good choice.

Reply


@ValtteriL 9 days

Interesting project, good luck with it!

Can you elaborate how you were spoiled by Go and don't want to go back to writing PHP?

Reply


@dimgl 10 days

I think using Svelte was a mistake. That being said, I'm pretty impressed with the effort here. Looking forward to seeing how this framework evolves. Cheers.

Reply


@realrocker 9 days

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.

Reply


@jdauriemma 10 days

If you ever ship an Airflow integration, consider this an official request to call it Air Bud.

Reply


@jacktheturtle 10 days

dude this looks awesome! can't wait to dive into this and learn a bit more.

i come from a ruby, js and python background using frameworks like: react, django, rails, etc. always wanted to excuse to use GO and this might be it!

Reply


@cjohansson 9 days

I'm experimenting with something similar as well, I'm curious - how do you solve HTTPS support since it's a built-in web-server?

Reply


@novoreorx 9 days

Great project, which UIKit do you use? Is it Tailwind or something?

Reply


Congratulations on the launch!

I've been using Kenny Grant's Fragmenta[1] for past 3 years and I haven't had need for anything else because I like SSR with Go and aim to keep JS as minimal as possible. I assume you're trying to address the need of those who want a Go back-end but with modern JS front-end?

I hope that you get to answer the queries in other comments regarding the design decisions reg CSR & V8 while using SSR.

[1] https://github.com/fragmenta

Reply


@tekkk 9 days

Wow is this like Go version of SvelteKit? Except without SSR so it serves only static files? I just thought about the same thing recently and I'm glad somebody made it! IMO Go is better fit for server backend than Node.js, especially with I/O.

Reply


@winnipeg 10 days

Great effort in a great lang.

Constructively speaking:

Hacker culture could benefit from less frameworks to more low code/no code platforms (which is a space with more fertile ground)

Reply


@mav88 10 days

Looks awesome. livebud.com isn't resolving though so I can't install.

Reply


@lifeplusplus 10 days

I thought of building my own framework then I remembered dealing with http headers, ssl, and http2

Reply


@throw_m239339 10 days

Nice, with generics, some things that were hard are easier to do when it comes to polymorphism thus code re-use.

Go community has been pretty "anti-framework" (AKA "just use net/http" when it clearly doesn't solve every problems..., "don't put request scoped variables in context" when it's the very purpose of that interface...) and there was a lot of drama around some framework creators, unlike any other web language community I have seen by the way (remember Martini and the insane backlash? Iris and the constant drama, was that Iris, I don't even remember the name...) so it will be pretty interesting to see the reception for that framework.

One advice to the author, congrats but don't call your framework "framework", it's like the go community hate that word, just say "a set of useful libraries to help web development", it seems like euphemisms are easier to swallow for some...

Reply


@emehrkay 10 days

The install link doesnt work. I wanted to view what it did before I ran it `livebud.com/install`

Reply


@pphysch 9 days

Cool project but I think building a full stack web framework in a language without features like operator overloading is a fool's errand.

Yes, Go has nice standard templating and HTTP serving libraries, and nice dependency management. These are all important features for a web framework.

No, it will never be productive as its competitors in the web framework space, because you simply cannot write expressions like `order.customer.region` that intelligently hit the database, because you can't override the dot operator. Instead you have to write unreadable crap like `regionController.Show(userController.Show(order.customer).region)` which is infinitely less "productive" than the former, for obvious reasons. Oh, you can `go generate` the *.Show definitions from a simple struct definition (or with 1.18 generics)? Too bad the final product is still unusable!

Use Go where it excels and connect it to your Ruby/Python/Typescript web backend over gRPC or HTTPS.

Reply


@dougbarrett 10 days

This is really cool! I tried building something more basic than this a few years back, but this looks a lot more mature. I'll definitely be following and testing it out on a few small projects.

Reply


@reddec 9 days

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...)

Reply


@dgb23 10 days

This is a very ambitious project and from the looks of it, it makes a ton of good decisions.

Reply


@mstef9 10 days

People interested in this might also find my project Pagoda [0] interesting. It's a full-stack web dev starter kit for Go, rather than a framework with any strict patterns or lock-in. It leverages Echo (web) and Ent (ORM) but they can be easily swapped out, if desired.

It also has HTMX [1] integration to create slick/modern UI behavior without writing any JS.

[0] https://github.com/mikestefanello/pagoda [1] https://htmx.org

Reply


@throwamon 10 days

Any plans to implement something like Phonenix LiveView? I've never used Go, but from what I've read I suppose it should work really well given Go's concurrency model. (The name "Livebud" gave some hope as well.)

Reply


@sunfmin 9 days

People interested in this might also find my project interesting: https://docs.goplaid.dev, https://github.com/goplaid/

Reply


@onionisafruit 10 days

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?

Reply


About Us

site design / logo © 2022 Box Piper