Skip to content

go-orb/go-orb

Repository files navigation

go-orb Logo License Go.Dev reference Go Report Card Discord

Orb is a framework for distributed systems development, it can be seen as the successor of go-micro.dev/v4.

⚠️ WIP

This project is a work in progress, please do not use yet!

🚀 What's new since v4

Use of wire

With wire we gain:

  • compile-time safety
  • no more globals

It was the main reason for starting orb, wire allows us to decouple the components and plugins.

No more reflect

we have been working hard on removing all usage of reflect.

Multiple Entrypoints

Orb allows you to listen on multiple port's with different protocols: gRPC, HTTP, HTTPS, DRPC, HTTP2, H2C, HTTP3. See the config system entry on howto configure it.

Advanced config system

With orb you can configure your plugins with a config file or environment options.

service1:
  server:
    http:
      gzip: true
      handlers:
        - Streams
      # middleware:
      #   - middleware-1
      entrypoints:
        - name: ep1
          address: :4512
          insecure: true
          h2c: true
  registry:
    enabled: true
    plugin: mdns
    timeout: 350
    domain: svc.orb
service1:
  server:
    grpc:
      insecure: true
      handlers:
        - Streams
      # middleware:
      #   - middleware-1
      # streamMiddleware:
      #   - middleware-S1
      entrypoints:
        - name: ep1
          address: :4512
          health: false
          reflection: false
          # handlers:
          #   - handler-1
          #   - handler-2
          # middleware:
          #   - middleware-1
          #   - middleware-4
  registry:
    plugin: nats
    address: nats://10.0.0.1:4222
    quorum: false

These 2 config's with different options will both work, we first parse the config, get the "plugin" from it and pass a map[any]any with all config data to the plugin.

Both work with a single binary. :)

Proto conform handlers

Return types as a result instead of HTTP req format.

New:

req := HelloRequest{Name: "test"}

// Look at resp, it's now returned as a result.
resp , err := client.Call[HelloResponse](context.Background(), clientDi, "org.orb.svc.hello", "Say.Hello", &req)

Old:

req := c.c.NewRequest(c.serviceName, "Greeter.Hello", in)
out := new(HelloResponse)
err := c.c.Call(ctx, req, out, opts...)
if err != nil {
  return nil, err
}
return out, nil

Send json

go-orb has support for sending nearly anything you throw in as application/json to the Server.

pre encoded / proxy

resp , err := client.Call[map[string]any](context.Background(), clientDi, "org.orb.svc.hello", "Say.Hello", `{"name": "Alex"}`, client.WithContentType("application/json"))

map[string]any{}

req := make(map[string]any)
req["name"] = "Alex"

resp , err := client.Call[map[string]any](context.Background(), clientDi, "org.orb.svc.hello", "Say.Hello", req, client.WithContentType("application/json"))

Structured logging

We like structured logging, this is why we replaced all logging with one based on slog.

go-orb/go-orb is just interfaces

We made sure that go-orb/go-orb (the core) is just a bunch of interfaces as well as some glue code, the most real code lives in go-orb/plugins.

Linted and analyzed

Everything is linted and staticaly analyzed by golangcli-lint, enforced with CI/CD pipelines on github.

Community

Chat with us on Discord.

Development

Quirks

No go-orb/plugins imports here

To prevent import cycles it's not allowed to import go-orb/plugins here.

Lint

We do not accept commits that fail to lint, either use ./scripts/test.sh lint all or install Trunk and it's extension for your editor.

Authors

go-orb

go-micro

A lot of this is copy&pasted from go-micro, top contributors have been:

License

go-orb is Apache 2.0 licensed and is based on go-micro.

About

A framework for distributed systems

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published