Type-safe routes for Express and Koa


typera - Type-safe routes


Typera helps you build backends in a type-safe manner by leveraging [io-ts] and
some TypeScript type inference magic. It works with both [Express] and [Koa].

Upgrading to version 2? See the

Features of typera in a nutshell:

- A purer approach to building your apps: Each route handler is an async
  function that takes a request and returns a response. Mutable req or res
  objects? Never again!

- Automatically parses request inputs like route params, query params, headers
  and request body into typed values.

- Infer the types of responses (status code, body, headers), allow type checking
  them according to your expectations.

- Middleware are fully typed. This means that you no longer have to guess what's
  available in req, or whether a middleware short-circuits and returns a
  response. Instead, everything is type checked!

- It's straightforward to start adding fully typed routes to an existing Express
  or Koa app. Old routes can be migrated gradually.

- Built-in support for automatically generating an OpenAPI definition from your
  app with typera-openapi.

Typera is a really thin layer on top of Express or Koa. Most of its code is
TypeScript typings, and the actual runtime stuff is minimal.

See the documentation for tutorial,
examples, API reference and more!


Run yarn to install dependencies.

Running the test suite

Run yarn test.


You need Python 3 to build the docs.

  1. ```
  2. python3 -m venv venv
  3. ./venv/bin/pip install mkdocs-material
  4. ```

Run a live reloading server for the documentation:

  1. ```
  2. ./venv/bin/mkdocs serve
  3. ```

Open http://localhost:8000/ in the browser.


  1. ```
  2. $ yarn lerna version <major|minor|patch>
  3. $ yarn lerna publish from-git
  4. ```

Open https://github.com/akheron/typera/releases, edit the draft release, select
the newest version tag, adjust the description as needed.

[io-ts]: https://github.com/gcanti/io-ts
[express]: https://expressjs.com/
[koa]: https://koajs.com/