Build Type-Safe Applications

Alepha is a convention-driven TypeScript framework for building robust, end-to-end type-safe applications, from serverless APIs to full-stack React apps.

import { run } from "alepha";
import { $action } from "alepha/server";

class Api {
  // define a type-safe API action
  // accessible via HTTP GET /api/greet?name=John
  greet = $action({
    schema: {
      query: t.object({ name: t.text() }),
      response: t.object({ greeting: t.string() }),
    },
    handler: async ({ query }) => ({
      greeting: `Hello, ${query.name}!`,
    }),
  });
}

run(Api);