Skip to main content

What is Apiser?

Apiser is a collection of typed TypeScript packages designed to streamline backend and frontend application development. It provides type-safe, chainable APIs that make building modern applications easier and more maintainable.

Type-safe models

Build reusable Drizzle ORM models with progressive query flows and automatic type inference

Smart controllers

Create composable request handlers with built-in validation, caching, and error handling

Response utilities

Standardized response formatting with consistent error handling across your API

Schema validation

Universal schema validation powered by Zod with TypeBox support

Key features

Progressive query building

Build database queries step-by-step with clear intent:
const users = await userModel
  .where({ status: esc("active") })
  .findMany()
  .with({ posts: true })
  .select({ id: true, name: true });

Reusable model abstraction

Define your models once and use them everywhere with consistent formatting:
const postModel = model("post", {
  format(row) {
    return {
      ...row,
      createdAt: new Date(row.createdAt),
      updatedAt: row.updatedAt ? new Date(row.updatedAt) : null,
    };
  },
});

Type-safe request handlers

Create handlers with automatic validation and type inference:
const getUserHandler = handler(
  async ({ payload }) => {
    const user = await userModel
      .where({ id: esc(payload.id) })
      .findFirst();
    
    return { user };
  },
  {
    payload: z.object({
      id: z.number(),
    }),
  }
);

Error-safe execution

Handle errors gracefully with safe execution flows:
const result = await userModel.findMany().safe();

if (result.error) {
  console.error(result.error);
} else {
  console.log(result.data);
}

Core packages

@apisr/drizzle-model

Type-safe, chainable model runtime for Drizzle ORM with progressive query building

@apisr/controller

Composable request handlers with built-in validation, caching, and error handling

@apisr/response

Standardized response utilities for consistent API responses

@apisr/schema

Universal schema validation with Zod support

@apisr/logger

Colorful console logging with JSON formatting and stack trace parsing

@apisr/zod

Enhanced Zod utilities for schema validation and type inference

Philosophy

Apiser is built on these principles:
  • Type safety first - Leverage TypeScript’s type system for compile-time guarantees
  • Progressive enhancement - Start simple and add complexity only when needed
  • Composability - Build complex functionality from simple, reusable pieces
  • Developer experience - Clear APIs, helpful errors, and minimal boilerplate
  • Framework agnostic - Works with Elysia, Hono, or any Node.js framework

Get started

Installation

Install the packages you need for your project

Quick start

Build your first application with Apiser in minutes

Drizzle Model Guide

Comprehensive guide for the Drizzle ORM model runtime

Building Controllers

Learn to build type-safe API controllers

Development status

Apiser is in active development and not recommended for production use yet. APIs may change between minor versions. Semantic versioning will be enforced after the v1.0.0 stable release.

Community and support

Apiser is an open-source project. Get help and contribute:
  • GitHub - Report issues and contribute
  • Discord - Join our community for discussions and support
  • Documentation - Comprehensive guides and API references

Next steps

1

Install packages

Choose and install the Apiser packages you need
2

Follow the quick start

Build a complete example application
3

Explore the API

Learn about advanced features and customization options

Build docs developers (and LLMs) love