DocsGet started

Built on Bun

Bun runs your server code, bundles your pages and installs your packages. The data stays Sluurp’s.

Sluurp is one executable with Bun inside it. Bun does what it does best: running JavaScript, bundling it and installing packages. Sluurp does the rest: the database, rules, sign-in, sync, history and the admin.

What Bun does

  • Runs your server code. Functions, routes, jobs and queues run in Bun’s JavaScript engine, each in its own worker. Everything a function asks of Sluurp for the person calling it, such as ctx.collection("posts").list(), still goes through Sluurp’s rules.
  • Bundles your pages. Bun bundles React apps and pages, and updates them as you save.
  • Installs your packages. sluurp bun add zod runs Bun’s package manager, and sluurp bunx its package runner. Packages that need Node’s APIs, such as database drivers, work in your server code.

Answer a request yourself

A route that exports a handler for a method answers that method itself:

routes/visits.ts
import { SQL } from "bun"

const pg = new SQL(process.env.DATABASE_URL!)

export async function GET() {
  return Response.json(await pg`select count(*)::int as visits from visits`)
}

This route uses Bun’s own Postgres client. Bun also speaks MySQL and SQLite, and drivers from npm work too, such as oracledb for Oracle.

Your data

The database is Sluurp’s SQLite, with full-text search and vector search built in. Your code reaches it through ctx, so collection rules apply to everything a function does for the person calling it.

Bun’s own SQLite (bun:sqlite) can open the same file read-only, for a report or an export. Vector search isn’t available there: search by meaning through ctx, with near.

View as Markdown