The Full-Stack Web Framework for Go

Bud

The Full-Stack Web Framework for Go. Bud writes the boring code for you, helping you launch your website faster.

Video Demo

Watch a video demonstrating how to build a minimal HN clone in 15 minutes with Bud.

Documentation

Read the documentation to learn how to get started with Bud.

Installing Bud

Bud ships as a single binary that runs on Linux and Mac. You can follow along for Windows support in this issue.

The easiest way to get started is by copying and pasting the command below in your terminal:

$ curl -sf https://raw.githubusercontent.com/livebud/bud/main/install.sh | sh

This script will download the right binary for your operating system and move the binary to the right location in your $PATH.

Confirm that you've installed Bud by typing bud in your terminal.

bud -h

You should see the following:

Usage:
    bud [flags] [command]

Flags:
  -C, --chdir  Change the working directory

Commands:
  build    build the production server
  create   create a new project
  run      run the development server
  tool     extra tools
  version  Show package versions

Requirements

The following software is required to use Bud.

  • Node v14+

    This is a temporary requirement that we plan to remove in v0.3

  • Go v1.16+

    Bud relies heavily on io/fs and will take advantage of generics in the future, so while Go v1.16 will work, we suggest running Go v1.18+ if you can.

Your First Project

With bud installed, you can now scaffold a new project:

$ bud create hello
$ cd hello

The create command will scaffold everything you need to get started with bud.

$ ls
go.mod  node_modules/  package-lock.json  package.json

... which is not very much by the way! Unlike most other fullstack frameworks, Bud starts out very minimal. As you add dependencies, Bud will generate all the boring code to glue your app together. Let's see this in action.

Start the development server with bud run:

$ bud run
| Listening on http://127.0.0.1:3000

Click on the link to open the browser. You'll be greeted with bud's welcome page.

Congrats! You're running your first web server with Bud. The welcome server is your jumping off point to learn more about the framework.

CleanShot 2022-05-12 at 22.00.19@2x.png

Next Steps

Check out the Hacker News demo, read the documentation, schedule a quick call or go on your own adventure. The only limit is your imagination.

Recent discussions: Reddit, Hacker News, Twitter

How did Bud come into existence?

I started working on Bud 2 years ago after seeing how productive people could be in Laravel. I wanted the same for Go, so I decided to try creating Laravel for the Go ecosystem. However, my first version after 6 months needed to scaffold many files just to get started. If you are coming from Rails or Laravel, you may shrug and consider this as pretty normal.

Unfortunately, I have been spoiled by the renaissance in frontend frameworks like Next.js that start barebones but every file you add incrementally enhances your web application. This keeps the initial complexity under control.

With this additional inspiration, I worked on the next iteration for the ensuing 18 months.

The goals are now:

  • 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. You shouldn't need to care about the generated code. You may be surprised to learn that Go also generates code to turn your Go code into an executable, but it works so well you don't need to think about it. Bud should feel like this.

  • Feel like using a modern JS framework. This means it should work with multiple modern frontend frameworks like Svelte and React, support live reload, and have server-side rendering for better performance and SEO.

  • 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. Extensibility should be primarily driven by adding code, rather than by adding configuration.

  • Bud should provide high-level, type-safe APIs for developers while generating performant, low-level Go code under the covers.

  • Bud should compile to a single binary that contains your entire web app and can be copied to a server that doesn't even have Go installed.

Contributing

Please refer to the Contributing Guide to learn how to run and test Bud locally.

Comments
  • Error with NPM When Running make install During Contribution Set-Up

    Error with NPM When Running make install During Contribution Set-Up

    I've been extremely impressed by and interested in but (great work @matthewmueller!!) and I wanted to begin contributing to an interesting bug that I saw in the issues. So I cloned bud and was following the instructions in Contributing.md, but I ran into an error when running make install.

    OS: Windows 10 Go Version: 1.18.2 Node.js Version: 16.14.0

    Bud_Make_NPM_Error

  • Error: invalid cross-device link

    Error: invalid cross-device link

    When I did 'bud create ff-bud', I got this error: | rename /tmp/bud-create-3425471412 ff-bud: invalid cross-device link Possibly because /tmp is different partition than the current directory. Rename will work only in same partition?

  • Add Windows Support

    Add Windows Support

    Windows support is currently blocked by:

    • https://github.com/rogchap/v8go/pull/234

    Bud's compiler will also transition to using Go plugins, which also do not have Windows support yet:

    • https://github.com/golang/go/issues/19282 Though we could use something like go-plugin for Windows.

    I haven't tested it yet, but you should be able to use Bud with the Windows Subsystem for Linux (WSL).

    If you get this working, please let us know how!

  • Can + 1 operate when the port is occupied

    Can + 1 operate when the port is occupied

    | listen tcp 127.0.0.1:3000: bind: address already in use

    For example, running on 127.0.0.1:3001 | listen tcp 127.0.0.1:3001: bind: address already in use 127.0.0.1:3002

  • Issue/149

    Issue/149

    This addresses #149.

    Appends the suffix "action" to all actions and the suffix "controller" to all nested controllers.

    I'm sure there's downsides to this approach, so I'm interested in your thoughts. I was able to verify that this solves the problem listed in the issue, both at the root and at other nested levels.

    Tests fail, as assertions expect certain names to exist. I can look at that if you agree with this suffix approach.

  • bud  create app  fail

    bud create app fail

    run create bud_app

    | create: Unable to infer a module name. Try again using the module name.

    For example, bud create --module=github.com/my/app bud_app image

  • Unused import error in generated controller

    Unused import error in generated controller

    I'm attempting to implement persistence. So I create a new folder models. Write a struct. Update the controllers to use that new struct instead of the autogenerated one. Then run bud run. But bud errors out with

    bud/.app/controller/controller.go:10:2: imported and not used: "github/donovanrost/bud-test/models"
    

    I don't think that bud needs to do any code generation with this package. Is there a way to tell bud to ignore it?

  • Too many return values error on loadController()

    Too many return values error on loadController()

    Hi, Firstly this project looks great. Really looking forward to working with it.

    Getting the error...

    bud/.app/controller/controller.go:133:15: too many return values have (nil, error)

    Looks the loadController() is missing a return error definination

    func loadController() *controller.Controller { controllerController, err := controller.Load() if err != nil { return nil, err } return controllerController }

  • run error

    run error

    Hello, After I bud build the project, I remove the *.go and go.mod source files. run ./bud/app in the terminal, but it output the error: unable to find go.mod: file does not exist in "/Users/Works/news"

    ---- for exmaple input the command in the terminal news % ./bud/app unable to find go.mod: file does not exist in "/Users/Works/news"

    Why the app is running and it needs to depend go.mod?

  • ../../../go/pkg/mod/github.com/livebud/bud@v0.1.4/package/scaffold/template.go:28:8: undefined: any

    ../../../go/pkg/mod/github.com/livebud/[email protected]/package/scaffold/template.go:28:8: undefined: any

    ➜  bud-hello bud version
         bud: 0.1.4
      svelte: 3.47.0
       react: 18.0.0
    ➜  bud-hello bud run
    | Listening on http://127.0.0.1:3000
    # github.com/livebud/bud/package/scaffold
    ../../../go/pkg/mod/github.com/livebud/[email protected]/package/scaffold/template.go:28:8: undefined: any
    note: module requires Go 1.18
    ➜  bud-hello go version
    go version go1.17.10 darwin/amd64
    
  • Can't create routes named `index`, `show`

    Can't create routes named `index`, `show`

    Reproduce

    1. Create a new project bud create project
    2. Create a root route (important) bud new controller anything:/ index show
    3. bud new controller index or bud new controller show (with or without views)
    4. bud run will give an error:
    | conjure: generate "bud/.app/main.go". conjure: generate "bud/.app/program/program.go". program: unable to wire. di: unable to wire "bud-app/bud/program".loadApp function. di: unable to find definition for param "bud-app/bud/.app/controller".*Controller in "bud-app/bud/.app/web".*Server . parser: unable to find declaration for "bud-app/bud/.app/controller".Controller in "bud/.app/web/web.go". bud/.app/controller/controller.go:15:2: Index redeclared in this block
    	previous declaration at bud/.app/controller/controller.go:13:2
    
  • feature idea: detect git short version hash during build and embed into binary

    feature idea: detect git short version hash during build and embed into binary

    This PR addresses the first proposed solution to this issue. The second proposed solution is not implemented in this PR, but can be added with further information provided.

  • feature suggestion: `bud run` should launch browser (maybe with a flag to enable?)

    feature suggestion: `bud run` should launch browser (maybe with a flag to enable?)

    When launching the dev server, I have to manually open a browser tab and load the URL. It would be cool if it called out to the OS and simply told it to open the dev server URL. The quick and dirty (on macOS) is to shell out to open $URL but I imagine there's a go module somewhere that does this.

    Even a flag to do it would be fine, as I invoke bud run from a Makefile (make dev).

    c.f.: https://talk.jekyllrb.com/t/automatically-start-browser-on-localhost-4000-after-jekyll-serve/4916/5

  • feature idea: detect git short version hash during build and embed into binary

    feature idea: detect git short version hash during build and embed into binary

    In my apps I usually do something like:

    var Version   string
    
    func main() {
    	os.Exit(httpserver.Run(Version))
    }
    

    Then at build time (in my Makefile) I do this:

    VERSION := $(shell git describe --always --dirty=-dirty)
    GOLDFLAGS += -X main.Version=$(VERSION)
    GOFLAGS := -ldflags "$(GOLDFLAGS)"
    

    This embeds the version string into the app so that I can access it, which is useful for me because then in production I can access this value and put it in my footers and error messages so that I know precisely which commit is running.

    It would be cool if bud build could detect if it's building out of a git repo, and embed the git shorthash into the built binary in this way. It seems that you could skip the ldflags part and simply "hardcode" the git shorthash into the main.go via the main.gotext template at build filesystem generation time.

    Anyway, just an idea, and I'm happy to take a crack at making a patch for this when I have some time, I just wanted to write it down while it's in my head.

  • generated app directory fails linting with golangci-lint

    generated app directory fails linting with golangci-lint

    golangci-lint run --fix
    bud/internal/app/main.go:74:19: Error return value of `budClient.Publish` is not checked (errcheck)
    	budClient.Publish("app:ready", nil)
    

    As part of CI I run a linting of my repository. I suggest adding the line //nolint at the top of the template for bud/internal/app/main.go, as well as any other bud-managed template boilerplate files. This way any linters people use will ignore these files (without having to do special configuration to exclude the bud directory like is already automagically done in the .gitignore.)

  • using 'change.me' placeholder in go.mod causes network connections to hostname 'change.me'

    using 'change.me' placeholder in go.mod causes network connections to hostname 'change.me'

    When using example/placeholder strings that are interpreted as domain names, the domain example.com should be used.

    https://github.com/livebud/bud/blob/d9c7ff63a929c9c308921ae35a929f19c5b101c9/internal/cli/create/create.go#L116

Elastic Stack Docker + Sample Go AppElastic Stack Docker + Sample Go App
Elastic Stack Docker + Sample Go AppElastic Stack Docker + Sample Go App

?? Elastic Stack Docker + Sample Go App Test Elastic Stack which includes Elasticsearch, Kibana, Filebeat and Metricbeat. It comes with a very simple

Jan 14, 2022
goTempM is a full stack Golang microservices sample application built on top of the Micro platform.
goTempM is a full stack Golang microservices sample application built on top of the Micro platform.

goTempM is a full stack Golang microservices sample application built on top of the Micro platform.

Sep 24, 2022
stack-rpc 快速开发包
stack-rpc 快速开发包

Micro 快速开发工具包 项目进行中 本仓库旨在提供面向 stack-rpc 生产环境的快速开发包。 目录 快速开始示例 控制台示例 以最常见的登录流程为例,实现一个场景简单,但包含微服务各种治理能力的示例 Hipster Shop示例 参考GoogleCloudPlatform/microser

Dec 29, 2022
micro-draft-manager is a microservice that helps you to manage unstructured data in your application with sorting and full-text search

micro-draft-manager is a microservice that helps you to manage unstructured data in your application with sorting and full-text search. For example, y

Nov 24, 2021
Modern microservice web framework of golang
Modern microservice web framework of golang

gogo gogo is an open source, high performance RESTful api framework for the Golang programming language. It also support RPC api, which is similar to

May 23, 2022
Rpcx-framework - An RPC microservices framework based on rpcx, simple and easy to use, ultra fast and efficient, powerful, service discovery, service governance, service layering, version control, routing label registration.

RPCX Framework An RPC microservices framework based on rpcx. Features: simple and easy to use, ultra fast and efficient, powerful, service discovery,

Jan 5, 2022
Starter code for writing web services in Go

Ultimate Service Copyright 2018, 2019, 2020, 2021, Ardan Labs [email protected] Ultimate Service 2.0 Video If you are watching the Ultimate Service v

Dec 30, 2022
GoLang utility packages to assist with the development of web micro-services.

GoTil Golang utility packages to assist with the development of web micro-services. Installation As a library. go get github.com/ccthomas/gotil Usage

Nov 26, 2021
Flamingops - Handle your web services consommation with golang
Flamingops - Handle your web services consommation with golang

How to use this repo as a template for your project I - Introduction This reposi

Mar 31, 2022
Go Micro is a framework for distributed systems development

Go Micro Go Micro is a framework for distributed systems development. Overview Go Micro provides the core requirements for distributed systems develop

Jan 3, 2023
Micro-service framework in Go
Micro-service framework in Go

Kite Micro-Service Framework Kite is a framework for developing micro-services in Go. Kite is both the name of the framework and the micro-service tha

Jan 9, 2023
NewSQL distributed storage database based on micro service framework
NewSQL distributed storage database based on micro service framework

QLite 是基于微服务的 NewSQL 型数据库系统,与传统的一体化数据库不同,该系统将本该内置的多种数据结构(STL)拆分成多个服务模块,每个模块都是独立的一个节点,每个节点都与其主网关进行连接,从而形成分布式存储结构。

Jun 19, 2022
Kratos is a microservice-oriented governance framework implements by golang
Kratos is a microservice-oriented governance framework implements by golang

Kratos is a microservice-oriented governance framework implements by golang, which offers convenient capabilities to help you quickly build a bulletproof application from scratch.

Dec 27, 2022
RPC explained by writing simple RPC framework in 300 lines of pure Golang.

Simple GoRPC Learning RPC basic building blocks by building a simple RPC framework in Golang from scratch. RPC In Simple Term Service A wants to call

Dec 17, 2022
a microservice framework for rapid development of micro services in Go with rich eco-system
a microservice framework for rapid development of micro services in Go with rich eco-system

中文版README Go-Chassis is a microservice framework for rapid development of microservices in Go. it focus on helping developer to deliver cloud native a

Dec 27, 2022
The Go backend framework with superpowers

Encore - The Go backend framework with superpowers https://encore.dev Overview Encore is a Go backend framework for rapidly creating APIs and distribu

Jan 8, 2023
🦄🌈 YoyoGo is a simple, light and fast , dependency injection based micro-service framework written in Go.
🦄🌈 YoyoGo is a simple, light and fast , dependency injection based micro-service framework written in Go.

???? YoyoGo is a simple, light and fast , dependency injection based micro-service framework written in Go. Support Nacos ,Consoul ,Etcd ,Eureka ,kubernetes.

Jan 4, 2023
Kratos is a microservice-oriented governance framework implements by golang,
Kratos is a microservice-oriented governance framework implements by golang,

Kratos is a microservice-oriented governance framework implements by golang, which offers convenient capabilities to help you quickly build a bulletproof application from scratch.

Dec 31, 2022
Fastglue is an opinionated, bare bones wrapper that glues together fasthttp and fasthttprouter to act as a micro HTTP framework.

fastglue Overview fastglue is an opinionated, bare bones wrapper that glues together fasthttp and fasthttprouter to act as a micro HTTP framework. It

Jun 14, 2022