Just call a function()

Build function-based API with minimal code and end-to-end type safety

Get Started GitHub

For javascript/typescript

await call(x,y)
http://(f)

server.ts

function add(x: number, y: number) {
    return x + y;
};

function greet(name: string) {
    return `Hello ${name}`;
};

export default {
    add,
    greet
}

client.ts

import createClient from "@your-package/api-client";

const client = createClient({
    endpoint: "http://api.domain.com"
});

let result = await client.add(1, 2);
// result: 3

let message = await client.greet("Edith");
// message: "Hello Edith"

Speaks functions

Don't worry about raw HTTP. No path binding, no http verbs, no headers, no data serialization.

With httpc you deal just with functions, arguments and return values.

See how to design a function-based API

No boilerplate code

Handle requests with idiomatic code with no complex wiring and unnatural syntax.

Less code, translates in less effort to produce, evolve, test, refactor and maintain.

httpc - no boilerplate code See how you reduce your code with httpc

Typesafe & autocomplete

Break things when you like to happen. No more missing parameter, type mismatch...

Type definitions provide autocompletion and keep your more productive avoiding frequent doc lookups.

httpc - type safe Learn more about e2e typesafety

Feature packed

Use builtin components with sensible defaults for common concerns like authentication, authorization, logging...

@httpc/kit provides a toolbox with many utilities that cover lots of use cases out of the box.

See about @httpc/kit features

Highly customizable

Rich modular architecture, you can plug into anything and model any behavior.

You can go beyond httpc and manage form submissions, web hooks, rest requests...

Read the Architecture and Extensions

Distribute the client

You can generate and publish a client to provide a ready-to-go experience for 3rd parties.

With a standard package you can easily share the client, manage versions and backward compatibility.

Checkout Generate and Publish

httpc family

Meet the tools making a function-based API an easy task

npm install @httpc/server