Creating Documentation

Teasim has first-class support and follows OpenAPI schema by default.

Allowing any Teasim server to generate a Swagger page and serve as documentation automatically by using just 1 line of the Teasim Swagger plugin.

To generate the Swagger page, install the plugin:

bun add @Teasimjs/swagger

And register the plugin to the server:

import { Teasim } from "teasim";
import { swagger } from "@teasim/swagger";

const app = new Teasim().use(swagger());

For more information about Swagger plugin, see the Swagger plugin page.

Route definitions

schema is used to customize the route definition, not only that it will generate an OpenAPI schema and Swagger definitions, but also type validation, type-inference and auto-completion.

However, sometime defining a type only isn't clear what the route might work. You can use schema.detail fields to explictly define what the route is all about."/sign-in", ({ body }) => body, {
  body: t.Object(
      username: t.String(),
      password: t.String(),
      description: "Expected an username and password",
  detail: {
    summary: "Sign in the user",
    tags: ["authentication"],

The detail fields follows an OpenAPI V3 definition with auto-completion and type-safety by default.

Detail is then passed to Swagger to put the description to Swagger route.