Skip to main content

Zero-dependency TypeScript utilities for Bun

Build production-ready Bun applications with type-safe APIs, Redis queues, pub/sub, i18n, caching, and authorization. All with zero dependencies.

// Install
$ bun add semola
// Import
import { Api } from “semola/api”

Quick Start

Get up and running with Semola in just a few steps.

1

Install Semola

Install the package using your preferred package manager:
bun add semola
Semola requires Bun 1.1+ as the runtime environment.
2

Import a module

Import only the modules you need. Semola uses tree-shakeable exports:
import { Api } from "semola/api";
import { Queue } from "semola/queue";
import { Cache } from "semola/cache";
Each module is self-contained with zero external dependencies.
3

Build your first API

Create a type-safe REST API with automatic validation:
import { Api } from "semola/api";
import { z } from "zod";

const api = new Api();

api.defineRoute({
  path: "/hello/:name",
  method: "GET",
  request: {
    params: z.object({ name: z.string() }),
  },
  response: {
    200: z.object({ message: z.string() }),
  },
  handler: async (ctx) => {
    return ctx.json(200, { 
      message: `Hello, ${ctx.params.name}!` 
    });
  },
});

api.serve(3000);

Explore by Module

Semola provides modular utilities for common development needs. Import only what you use.

API Framework

Type-safe REST API with OpenAPI spec generation

Queue

Redis-backed job queue with retries and concurrency

PubSub

Type-safe pub/sub messaging for real-time events

Cache

Redis cache wrapper with TTL support

i18n

Compile-time validated internationalization

Policy

Policy-based authorization with conditions

Errors

Result-based error handling without try-catch

Middleware

Request/response middleware system

OpenAPI

Automatic OpenAPI 3.1.0 spec generation

Why Semola?

Built specifically for Bun with performance and developer experience in mind.

Zero Dependencies

No external dependencies means faster installs, smaller bundles, and fewer security vulnerabilities. Your node_modules stays lean.

Type Safety That Works

Full TypeScript inference from request validation to response serialization. Catch errors at compile time, not in production.

Modular by Design

Tree-shakeable imports mean you only bundle what you use. Import semola/api without pulling in queue or cache code.

Bun-Native Performance

Built on Bun’s native APIs for maximum performance. Consistently ranks among the fastest API frameworks for Bun.

Learn Core Concepts

Understand the principles behind Semola’s design.

Zero Dependencies

Why zero dependencies matter for production apps

Type Safety

How Semola achieves compile-time type safety

Error Handling

Result tuples vs try-catch for cleaner code

Standard Schema

Framework-agnostic validation with Zod, Valibot, ArkType

Ready to build with Semola?

Get started in minutes with our quickstart guide and build production-ready Bun applications.

Start Building