Help us shape the future of Go! Take the 2026 Go Developer Survey

bifrost

package module
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

README

Bifrost GoDoc Build GoReport Security Coverage Status CodeWiki

A low-latency and high-throughput API gateway library in Go

Reasons to use Bifrost

  1. Low latency and high throughput.
  2. Allows writing middlewares in native Go.
  3. Easy to integrate with existing Go services.
  4. Easy migration from Nginx. Leverage your Nginx experience.
  5. Built as an SDK/library instead of an artifact.

Feature highlights

  1. Support for writing middleware in Go.
  2. Low latency and high throughput (powered by the Hertz framework).
  3. Millisecond-level graceful reload for route updates without interrupting requests.
  4. Get gateway configurations from local files or configuration centers.
  5. Built-in Prometheus monitoring.
  6. Built-in OpenTelemetry tracing.
  7. Supports HTTP1.1/HTTP2/H2C/Webosocket/GRPC protocols.
  8. Multiple built-in balancer algorithm (round_robin, random, weighted, chash) and allow to build your own

Comparative Analysis

Bifrost Nginx
SDK for building your own gateway ✅ ❌
Write your middlewares in native Go (not TinyGo) ✅ ❌
Rich built-in middlewares ✅ ❌
Millisecond-level graceful reloads for dynamic configuration updates ✅ ❌
Blue-green deployment for services ✅ ❌
High connection pool reuse rate ✅ ❌
Easy integration with existing Go programs ✅ ❌
Built-in Prometheus monitoring ✅ ❌
Built-in OpenTelemetry tracing ✅ ❌
Native k8s service discovery ✅ ❌
Built-in web application firewall and support OWASP Core Rule Set ✅ ❌
HTTP2 upstream support ✅ ❌
Multiple configuration providers ✅ ❌
Standardized and User-Friendly Configuration ✅ ❌
Multiple built-in balancer algorithm and allow to build your own ✅ ❌
High concurrency and low latency ✅ ✅
GRPC Load Balancer ✅ ✅
Background task support ✅ ✅

Overview

flow

servers: Server configuration, supports middlewares, controlling which port to expose
routes: Route configuration, controls request path forwarding rules to specific services
services: Service configuration, controls service details such as protocol information
upstreams: Upstream configuration, manages load balancing rules for backend hosts

Get Started

Set up a high-performance API gateway in 5 minutes

Documents

  1. Configuration
  2. Providers
  3. Routes
  4. Middlewares
  5. Directive

Credit

  1. CloudWeGo

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(opts ...Option) error

Run starts the Bifrost application. It handles CLI parsing, configuration loading, and process lifecycle management (Master/Worker modes, Hot Reload).

Types

type Option

type Option func(*options)

func WithFlags

func WithFlags(flags ...cli.Flag) Option

WithFlags adds custom CLI flags.

func WithInit

func WithInit(fn func(config.Options) error) Option

WithInit registers an initialization hook that runs after config loading and before the application starts (Master or Worker).

func WithVersion

func WithVersion(version string) Option

WithVersion sets the application version.

Directories

Path Synopsis
client
hertz/h2c command
hertz/http command
standard/grpc command
standard/h2c command
standard/http command
examples
config command
gateway command
simple command
timing command
internal
pkg/hzadaptor
Package hzadaptor provides utilities for adapting between Hertz protocol types and Go's standard library types.
Package hzadaptor provides utilities for adapting between Hertz protocol types and Go's standard library types.
pkg
ai
log
telemetry/metrics
Package metrics provides OpenTelemetry metrics integration for Bifrost.
Package metrics provides OpenTelemetry metrics integration for Bifrost.
server
bifrost command
hertz command
standard command
testserver command
testserver/grpc command

Jump to

Keyboard shortcuts

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