Bunlar - Laravel-Inspired Backend Toolkit for Bun

A high-performance TypeScript backend framework bringing Laravel's developer ergonomics to the Bun runtime—active-record models, radix routing, signed sessions, and CLI scaffolding.

  • Bun
  • TypeScript
  • SQLite
  • Kysely
  • Zod
  • Radix3
  • Argon2id

Problem

Node backend frameworks often demand heavy boilerplate or sluggish startup times, while modern fast runtimes like Bun lack batteries-included developer experience (Active-Record queries, route groups, validation, signed auth).

Solution

Bunlar unites Laravel DX with the raw speed of Bun—zero Node polyfills, radix3 tree routing, Kysely type-safe SQL over bun:sqlite, Zod request validation, and an expressive CLI.

My role

Creator and primary architect - designed API ergonomics, route dispatcher, active-record abstraction, session crypto, and CLI code generators.

Impact

Delivers sub-5ms route compilation, instant hot-reloading with native Bun watch, and a familiar architecture for developers transitioning between PHP/Laravel and TypeScript.

Challenges

Designing an Active-Record query builder that provides clean method chaining without relying on heavyweight reflection or brittle metadata decorators.

Screenshots

The problem

Developers who appreciate Laravel's ergonomics—expressive routing, model query scopes, integrated validation, and signed sessions—often struggle to find equivalent DX when building in JavaScript or TypeScript. Existing Node frameworks either lean toward extreme minimalism (requiring dozens of disparate libraries) or heavy enterprise IoC containers.

The approach

Bunlar is built on the philosophy: Wrap, Don't Recreate. Instead of inventing homemade wheels, it pairs proven industry packages with Bun's native primitives:

  • Radix3 Router: Ultra-fast radix tree routing supporting route groups, prefixes, and composable middleware.
  • Active-Record on Kysely: Familiar model query chaining (User.where("active", 1).get()) running on top of type-safe SQL and bun:sqlite.
  • Integrated Validation: First-class zod support where validation failures automatically respond with structured 422 HTTP payloads.
  • Cryptographic Sessions & Auth: Cookie sessions with native Argon2id password hashing via Bun.password.
  • Cache Engine: Expressive caching with atomic Cache.remember(key, ttl, fn).

Developer CLI

Bunlar includes a developer CLI (bunlar) for routine engineering workflows:

  • bunlar dev [entry] — instant hot reload via Bun watch
  • bunlar route:list — pretty-printed route inspection
  • bunlar make:model, make:controller, make:migration — uniform scaffolding
  • bunlar migrate & migrate:rollback — schema versioning

Outcome

A coherent, delightful backend toolkit designed specifically for the Bun runtime, providing the joy of Laravel development with native compilation speed and TypeScript safety.