Deploy a fully iLEAP-conformant server in minutes. Implement a standard Connect RPC handler — the SDK handles the rest.
A Go SDK and server for logistics emissions data compatible with the iLEAP Technical Specifications. The server translates the iLEAP HTTP protocol (JSON envelopes, filtering, Link header pagination, OAuth2 error formats) into standard Connect RPC calls, so you only need to implement a typed service interface.
- Two interfaces, two options: implement
ILeapServiceHandlerfor data,AuthHandlerfor auth — done. ILeapServiceHandleris the generated Connect RPC interface. Any Connect handler implementation works out of the box.- Filter complexity stays at the HTTP boundary: legacy OData is translated to simple request-local filters (
field_path,value) aligned with iLEAP standalone filtering semantics. - Go Client and Server for PACT Product Footprints with iLEAP extensions.
- Go Client and Server for iLEAP Transport Activity Data.
- Uses
connect.Errorcodes throughout for a single, consistent error model.
$ go get github.com/way-platform/ileap-go@latestclient := ileap.NewClient(
ileap.WithBaseURL(os.Getenv("BASE_URL")),
ileap.WithOAuth2(os.Getenv("CLIENT_ID"), os.Getenv("CLIENT_SECRET")),
)
footprint, err := client.GetFootprint(context.Background(), &ileap.GetFootprintRequest{
ID: "91715e5e-fd0b-4d1c-8fab-76290c46e6ed",
})
if err != nil {
// Handle error.
}
fmt.Println(footprint)Two interfaces, two options:
srv := ileap.NewServer(
ileap.WithServiceHandler(myHandler), // ILeapServiceHandler (generated Connect interface)
ileap.WithAuthHandler(myAuth), // AuthHandler
)
log.Fatal(http.ListenAndServe(":8080", srv))ILeapServiceHandler is the generated Connect RPC interface with three methods: ListFootprints, GetFootprint, and ListTransportActivityData. AuthHandler covers token issuance, validation, and OIDC discovery.
The handlers/ directory provides pre-built implementations that can be plugged directly into the server:
ileapdemo: DemoILeapServiceHandlerandAuthHandlerloaded with sample data and static credentials. Ideal for testing and local development.ileapclerk:AuthHandlerimplementation that delegates authentication to Clerk via the Clerk Frontend API.ileapconnect: Connect RPC client that forwards requests to an existing Connect backend. The client satisfiesILeapServiceHandlerdirectly — point your iLEAP server at a Connect service and get conformance for free.
The ileaptest package exports a reusable conformance test suite that any iLEAP server implementer can run:
import "github.com/way-platform/ileap-go/ileaptest"
func TestMyILeapServer(t *testing.T) {
srv := startMyServer(t)
ileaptest.RunConformanceTests(t, ileaptest.ConformanceTestConfig{
ServerURL: srv.URL,
Username: "admin",
Password: "secret",
})
}Run against a remote server:
$ ILEAP_SERVER_URL=https://demo.ileap.way.cloud ILEAP_USERNAME=hello ILEAP_PASSWORD=pathfinder \
go test -v ./ileaptest/...The project is built using Mage. See magefile.go.
$ ./tools/mage buildFor all available build tasks, see:
$ ./tools/mage$ go install github.com/way-platform/ileap-go/cmd/ileap@latestPrebuilt binaries for Linux, Windows, and Mac are available from the Releases.
Start a local demo server in the background:
$ ileap demo-server --port 8080 &
INFO iLEAP demo server listening address=:8080Log in to the local demo server:
$ ileap auth login \
--base-url http://localhost:8080 \
--client-id hello \
--client-secret pathfinder
Logged in to http://localhost:8080.Fetch a product footprint:
$ ileap footprint 91715e5e-fd0b-4d1c-8fab-76290c46e6ed
{
"companyName": "My Corp",
"created": "2022-03-01T09:32:20Z",
"id": "91715e5e-fd0b-4d1c-8fab-76290c46e6ed",
"organizationName": "My Corp",
"pcf": {
"biogenicCarbonContent": "0.41",
"fossilGhgEmissions": "1.5",
"pCfExcludingBiogenic": "1.63",
"pCfIncludingBiogenic": "1.85",
"unitaryProductAmount": "1"
},
"productDescription": "Bio-Ethanol 98%, corn feedstock (bulk - no packaging)",
"specVersion": "2.0.0",
"status": "Active"
}