[HN Gopher] Show HN: A Full-Stack Web Framework for Go
       ___________________________________________________________________
        
       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!
        
       Author : matthewmueller
       Score  : 208 points
       Date   : 2022-05-13 19:01 UTC (3 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | dinvlad wrote:
       | 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...
        
       | tompston wrote:
       | 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
        
       | mavbo wrote:
       | 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?
        
         | ammanley wrote:
         | I only browsed for a wee bit, so take this with some salt, but
         | it _looks_ like the framework is running a JS VM isolate
         | alongside the Go server struct[1], which gets called with
         | whatever script file is being rendered. Since it looks like the
         | render files are, at least in the case of Svelte, individually
         | compiled JS files that are SSR rendered via the V8 isolate, I
         | _believe_ you're correct that there is no CSR (though there
         | might still be JS-hydrated code if the Svelte component
         | included something involving an interactive component).
         | 
         | I think the idea is to ingest a JS "template" and spit out the
         | rendered HTML+JS, kind of like traditional SSR templates, but
         | it could be possible to shoe-horn in an entire client-side
         | router that gets initialized as a DOM object somewhere.
         | 
         | EDIT: I could be wrong, please correct me if so.
         | 
         | [1] https://github.com/rogchap/v8go
        
       | anthropodie wrote:
       | 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.
        
       | [deleted]
        
       | ehaughee wrote:
       | 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.
        
       | rnewton wrote:
       | Your site's DNS is currently not resolving. Should provide
       | alternate install instructions for cases like this.
       | 
       | https://www.whatsmydns.net/#A/livebud.com
        
       | dmix wrote:
       | > 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.
        
       | dimgl wrote:
       | 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.
        
       | jdauriemma wrote:
       | If you ever ship an Airflow integration, consider this an
       | official request to call it Air Bud.
        
         | [deleted]
        
       | jacktheturtle wrote:
       | 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!
        
       | mav88 wrote:
       | Looks awesome. livebud.com isn't resolving though so I can't
       | install.
        
       | lifeplusplus wrote:
       | I thought of building my own framework then I remembered dealing
       | with http headers, ssl, and http2
        
       | emehrkay wrote:
       | The install link doesnt work. I wanted to view what it did before
       | I ran it `livebud.com/install`
        
       | dougbarrett wrote:
       | 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.
        
       | dgb23 wrote:
       | This is a very ambitious project and from the looks of it, it
       | makes a ton of good decisions.
        
       | mstef9 wrote:
       | 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
        
       | throwamon wrote:
       | 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.)
        
       | onionisafruit wrote:
       | 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?
        
       ___________________________________________________________________
       (page generated 2022-05-13 23:00 UTC)