If you have existing APIs (REST / GraphQL), we provide a convenient proxy that runs on your infrastructure as a docker container, and forwards requests to your APIs.

This allows you to interact with Inferable without having to make any changes to your existing codebase, or install the SDK in your services.

Code Generation

The specific commands in this video have been updated. Please see the next section for correct examples.

The Inferable CLI can generate wrapper code for existing APIs.

# Install the Inferable CLI
npm i @inferable/cli -g

# Bootstrap a new proxy-container project
inf bootstrap proxy
# 👆 Include the `--cluster` flag if you would like to provision a new Cluster

cd inferable-demo

# Generate Inferable Functions from your API schema
inf generate <openapi | graphql> --schema <path-to-openapi-spec> --base-url <base-url>

If run from within an existing project, the code will be generated in the src/services directory.

Each operation in the schema will produce a separate function which is registered with the service.

Flags

schema (required)

The file path or URL of the OpenAPI specification or GraphQL schema, in JSON or YAML format.

name

The name of the service, used to identify the service in Inferable.

operationId (optional)

The operation ID of the operation to generate code for. If not specified, the code will be generated for all operations in the schema.

dir (optional)

The directory to write the generated code to. If not specified, the code will be written to the current directory (or src/services if run from within an existing project).