rhythmjs

Search documentation

Search guides, the tutorial and every package.

Built for Bunv0.0.13

A small foundation for composable() applications.

Combine onion-style middleware, shared providers, and encapsulated modules into a pipeline you can understand from top to bottom.

$bunx rhythmx new my-app

How it works

One request, one pipeline#

Each middleware wraps the next one. The code before next() runs on the way in; the code after it runs on the way back out.

  1. Requestarrives
  2. Loggingstarts a timer
  3. Guardchecks the caller
  4. Validationparses the body
  5. Handlerdoes the work
  1. Handlerreturns
  2. Interceptorreshapes the result
  3. Authsets the headers
  4. Error handlercatches failures
  5. Responseis sent

Features

Small by design#

Onion execution.
Work before and after downstream middleware with await next().
Typed composition.
Providers and explicit context extensions travel through the fluent API.
Managed dependencies.
Resolve providers in declaration order and dispose in reverse.
Explicit boundaries.
Keep module fields private until you choose to export them.
Bun-native.
Bun.serve, WebSockets, Bun.redis, Bun.CookieMap. No adapters.

Why Rhythm

Philosophy#

A framework should be something you compose, not something you inherit.

The onion is the framework#

Everything in Rhythm is a middleware: a function that does some work, hands control down the chain, and optionally does more work on the way back up.

Types flow with the request#

When a middleware contributes something to the request context, such as a validated body, a session, or a request id, that contribution is visible in the types of every handler that runs after it.

Explicit beats magical#

There are no decorators, no dependency-injection containers, no file-system conventions, and no hidden execution order.

Start building

Begin with the quick start, follow the step-by-step tutorial from a first controller to a production app, read the philosophy behind the design, or create a project with bunx rhythmx new from the starter template for a Nest-style skeleton. If you already know the model, jump to the API reference.