Skip to content

CamilleTyped Rails API for TypeScript front-ends

Define your API schema once in Ruby. Get typed TypeScript request functions and runtime response checks for free.

At a glance

An endpoint defined in Ruby, where data is a controller action:

ruby
get :data do
  params(
    id: Number
  )
  response(
    name: String
  )
end
typescript
data(
  params: {id: number}
): Promise<{name: string}>

If the front-end calls data, it must supply an id, and Camille requires the response to contain a string name. The two ends can no longer disagree about types.