Getting started

Introduction

RiserBob is a lightweight, fully tested HTTP framework built on Bun and TypeScript, inspired by SpongeBob SquarePants, designed for modularity, flexibility, and an improved developer experience.

RiserBob 1.0.0 keeps the moving parts few. You register routes, add middleware where it is needed, validate input with plain rules, and return a standard Response. Everything else is handled for you.

What you get

  • Fast routing with static and dynamic routes such as /users/:id. Static routes always win over dynamic ones.
  • Middleware pipeline with global and per-route middleware, executed in registration order.
  • Built-in auth middleware that reads a token from a cookie, a Bearer header or both, and checks it with your own verifier.
  • Logger and CORS middleware ready to plug in with one line.
  • Validator with a simple rule syntax: required, string, email, min:18 and more.
  • Response helpers for JSON, status codes, headers and redirects.
  • Consistent errors through HttpError and a central error handler.
  • Cookies with signing, rotation and safe defaults in the @riser-bob/cookie package.
  • Modules and a CLI that generate a controller, a router and a module for each feature.
  • Fully tested with Bun's test runner, with unit and end-to-end tests.

A first look

This is a file that you will create yourself if you use the command bun add riser-bob.

index.ts
import { RiserBob } from 'riser-bob' const bob = new RiserBob() bob.spongGet('/', async (spongReq, spongRes) => {  return spongRes.json({ message: 'Welcome to Bikini Bottom! 🍍' })}) bob.spongListen(4000, () => {  console.log('RiserBob is running on http://localhost:4000')})

Requirements

RiserBob runs on Bun 1.3 or newer. TypeScript 5 is a peer dependency.

Where to go next

  • Installation shows how to create a project.
  • Quick start builds your first route in a minute.
  • Routing explains paths, parameters and precedence.
  • Modules shows how a feature is organised.
  • Build a project walks through a complete app, with Mongoose, Drizzle and Sequelize versions.
  • Troubleshooting lists the errors people hit most and how to fix them.