Skip to main content

Getting Started

Users can connect to the API at beta.fiberapi.io:8080, providing their API key in the process. The domain will resolve to the closest node to the client, based on latency (check out the regions for where this will be).

To check your latency run the following command from the same machine as your client:

ping beta.fiberapi.io

Fiber's API uses gRPC, to make the connection process as easy as possible, utilize following packages:

Programming LanguagePackage
JavaScript / TypeScriptfiber-ts
Golangfiber-go
Pythonfiber-py
Rustfiber-rs
info

We highly recommend using either the Go or Rust packages if you're looking for the best performance.

note

If you want to build your own client (or help with the existing implementations), all you need are the protobuf / gRPC files and a compiler for your language.

Documentation for different gRPC language implementations can be found at https://grpc.io/docs/languages. The Fiber protobuf definitions are at https://github.com/chainbound/fiber-proto.

For examples of how to actually use it (API authentication), refer to the already implemented packages.

Installing

Fiber is available as a package on the following package managers:

go get github.com/chainbound/fiber-go

Connecting

The first step is connecting to a Fiber Node API. As we've seen above, there's one URL configured with latency-based routing to always resolve to the closest instance to your client.

Here's how to use the different packages to connect to Fiber:

import (
"context"
"log"
"time"

fiber "github.com/chainbound/fiber-go"
)

func main() {
client := fiber.NewClient("beta.fiberapi.io:8080", "YOUR_API_KEY")
// Close the client when you're done to make sure API accounting is done correctly
defer client.Close()

// Configure a timeout for establishing connection
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
if err := client.Connect(ctx); err != nil {
log.Fatal(err)
}
}