Skip to content

Integro

Seamless API integration with E2E integrity.

Convert your functions into an API server plus a type-safe client in just 2 lines of code.

Quick example

ts
import { createServer } from 'node:http'
import { createController } from 'integro'

export const app = {
  version: () => '0.5.0',
  greetings: {
    sayHey: (name: string) => `Hey, ${name}!`,
  },
}

createServer(createController(app)).listen()
ts
import { createClient } from 'integro/client'
import type { app } from './app'

export const api = createClient<typeof app>()

console.log(await api.version())
// -> "0.5.0"
console.log(await api.greetings.sayHey('Babe'))
// -> "Hey, Babe!"
console.log(await api.greetings('Babe')) // Error: This expression is not callable.
console.log(await api.greetings.sayHey(666)) // Error: Argument of type 'number' is not assignable to parameter of type 'string'.

Released under the MIT License.