DocsGet started
Getting started
Install Sluurp, make an app and run it.
Sluurp is a single executable. It stores data in a folder of SQLite files and serves an API, an admin and your app. There is nothing else to install.
Sluurp is free for non-commercial use. Using it in a business needs a business licence: one payment per server group (a single server or a swarm).
Install
On macOS and Linux:
curl -fsSL https://raw.githubusercontent.com/SluurpHQ/releases/main/install.sh | shOn Windows, in PowerShell:
irm https://raw.githubusercontent.com/SluurpHQ/releases/main/install.ps1 | iexBoth put the sluurp binary in ~/.sluurp/bin. To install a given release, set SLUURP_VERSION=v0.3.0. To install to another folder, set SLUURP_INSTALL.
Create an app
sluurp create my-appThis makes my-app/ and installs its packages. It contains:
routes/: pages rendered on the server (a home page, a page in Markdown, and a todo list kept live in every open tab)functions/: an endpointschema.json: thetodoscollection- the first components of the kit
Leave out the name and create asks for one. To install the packages later, pass --no-install.
Run it
cd my-app
sluurp superuser you@example.com
sluurp serve --public .superuser asks for a password and creates your administrator. You can also skip it and create one in the admin the first time you open it.
The server answers on three paths:
| Path | What |
|---|---|
/ | your app (the --public folder) |
/api/ | the REST, realtime and sync API |
/_/ | the admin: collections, records, rules, logs, SQL, backups, jobs |
Add a collection
Create a collection in the admin, or define it in schema.json:
{
"collections": [{
"name": "todos",
"schema": [
{ "name": "title", "type": "text", "required": true },
{ "name": "done", "type": "bool" },
{ "name": "author", "type": "relation", "relation": "users" }
],
"rules": {
"list": "author = @request.auth.id",
"create": "author = @request.auth.id",
"update": "author = @request.auth.id"
}
}]
}sluurp serve applies the app’s schema.json (inside the folder or next to it) when it starts. It adds new collections and fields and drops nothing.
To apply a schema yourself, run sluurp schema apply schema.json. To also remove what is no longer in the file, add --drop.
Add a page
A React page that lists the todos and stays current as they change anywhere:
import { createRoot } from "react-dom/client";
import { useLive } from "@sluurp/react";
function Todos() {
const { rows } = useLive("todos", { sort: "-created_at" });
return <ul>{rows.map((t) => <li key={t.id}>{t.title}</li>)}</ul>;
}
createRoot(document.getElementById("app")!).render(<Todos />);Add an index.html that loads ./main.tsx, and a package.json that names React, then run bun install. You don’t install @sluurp/react or @sluurp/client: the server provides them to every page, and writes their types into .sluurp/ for your editor. sluurp serve --public ./my-app bundles the page and updates it in the browser each time you save.
From here, try a page rendered on the server in routes/, a function the page can call with “use server”, or live data with sync.
Serve from a git repository
--public also takes a repository URL. Sluurp clones it into the current folder and serves it from there. On the next run, it pulls the clone first.
sluurp serve --public https://github.com/you/your-app- To serve a subfolder, add it to the URL:
…/repo/reports. - To serve a branch or tag, add it after
@:…/repo@v2. - Without a subfolder, the app is the repository’s root, or its
app/folder if the root isn’t one.
Your own git does the fetching, so private repositories work wherever git clone does. Sluurp never overwrites local changes in the clone.
Deploy
sluurp compilebuilds a single binary that holds the server and your app.sluurp pushstores the app as a version that never changes, andsluurp deploypoints a channel at it.sluurp rollbackputs a channel back on the version it served before.
See Deploying for servers, HTTPS and backups.