bifrost

package module
v0.1.31 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 3 Imported by: 2

README

Bifrost logo

Bifrost

Server-side rendering for React pages from Go: register routes, embed build output, and serve HTML through net/http.

Requirements

  • Go 1.25 or newer
  • Bun on the machine where you develop and where you run production builds; SSR production binaries embed the Bun runtime (static-only apps do not)

Install

go get github.com/3-lines-studio/bifrost

New project

go run github.com/3-lines-studio/bifrost/cmd/init@latest myapp

Templates: minimal (default), spa, desktop — e.g. go run github.com/3-lines-studio/bifrost/cmd/init@latest --template spa myapp.

Production build

  1. In your main package, embed the build tree: //go:embed all:.bifrost

  2. Generate assets (from your module root, pointing at the same main you will build):

    go run github.com/3-lines-studio/bifrost/cmd/build@latest ./main.go
    
  3. go build your app and run it without BIFROST_DEV=1.

go install github.com/3-lines-studio/bifrost/cmd/build@latest installs a binary named build (the directory name); rename or alias if you want bifrost-build on your PATH.

.bifrost directory

If .bifrost is missing for go:embed, repair the placeholder tree:

go run github.com/3-lines-studio/bifrost/cmd/doctor@latest .

Documentation

API, page modes (WithLoader, WithClient, WithStatic, …), redirects, and behavior details: docs.md.

Developing this repository

make check

License

MIT

Documentation

Index

Constants

View Source
const PropHTMLClass = core.PropHTMLClass
View Source
const PropHTMLLang = core.PropHTMLLang
View Source
const (
	React = core.FrameworkReact
)

Variables

This section is empty.

Functions

This section is empty.

Types

type App added in v0.1.4

type App = app.App

func New

func New(assetsFS embed.FS, routes ...Route) *App

func NewWithFramework added in v0.1.11

func NewWithFramework(assetsFS embed.FS, fw Framework, routes ...Route) *App

func NewWithOptions added in v0.1.19

func NewWithOptions(assetsFS embed.FS, opts []ConfigOption, routes ...Route) *App

type ConfigOption added in v0.1.11

type ConfigOption = core.ConfigOption

func WithDefaultHTMLLang added in v0.1.19

func WithDefaultHTMLLang(lang string) ConfigOption

func WithFramework added in v0.1.11

func WithFramework(fw core.Framework) ConfigOption

type Framework added in v0.1.11

type Framework = core.Framework

type PageOption

type PageOption = core.PageOption

func WithClient added in v0.1.4

func WithClient() PageOption

func WithDeferredLoader added in v0.1.30

func WithDeferredLoader(loader core.DeferredPropsLoader) PageOption

func WithHTMLClass added in v0.1.21

func WithHTMLClass(class string) PageOption

func WithHTMLLang added in v0.1.19

func WithHTMLLang(lang string) PageOption

func WithLoader added in v0.1.4

func WithLoader(loader core.PropsLoader) PageOption

func WithStatic added in v0.1.4

func WithStatic() PageOption

func WithStaticData added in v0.1.4

func WithStaticData(loader core.StaticDataLoader) PageOption

type RedirectError

type RedirectError = core.RedirectError

type Route added in v0.1.4

type Route = core.Route

func Page added in v0.1.4

func Page(pattern string, componentPath string, opts ...PageOption) Route

type StaticPathData

type StaticPathData = core.StaticPathData

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL