Getting started

Sluurp is one executable. It keeps its data in a folder of SQLite files and serves an API, an admin UI and your app. Nothing else needs installing.

Install

On macOS and Linux:

curl -fsSL https://raw.githubusercontent.com/SluurpHQ/sluurp/master/install.sh | sh

On Windows, in PowerShell:

irm https://raw.githubusercontent.com/SluurpHQ/sluurp/master/install.ps1 | iex

Either puts the sluurp binary in ~/.sluurp/bin. SLUURP_VERSION=v0.2.0 picks a release, SLUURP_INSTALL another folder. To build it yourself, see Development.

Run it

sluurp superuser you@example.com a-long-password
sluurp serve --public ./my-app
PathWhat
/your app: the folder given to --public
/api/the REST, realtime and sync API
/_/the admin UI: collections, records, rules, logs, SQL, backups, jobs
/sluurp.jsthe browser client, imported as "sluurp"

From a git repository

--public also takes a repository’s address. It is cloned into the current folder, one commit deep, as git clone would, and served from there; run it again and the clone is brought up to date first.

sluurp serve --public https://github.com/SluurpHQ/sluurp/tree/master/website

A folder inside the repository can follow its address (…/repo/reports), and a branch or tag the end (…/repo@v2). Without a folder, the repository is the app, or its app/ folder if the repository itself is not one. It is your own git that fetches, so a private repository works wherever git clone does. Changes you make in the clone are kept: it is not updated over them.

A first collection

Make one in the admin UI, or write the schema down and apply it. The file is the source of truth: applying it adds what is new and drops nothing.

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 --public ./my-app applies the app’s schema.json (inside the folder or beside it) when it starts, adding what is new and dropping nothing. sluurp schema apply schema.json does the same by hand, and --drop also removes what the file no longer has.

A first page

There is no bundler and no npm install. The page imports sluurp through the import map Sluurp writes into it.

my-app/index.html
<script type="module">
  import { Sluurp } from "sluurp";
  const todos = await new Sluurp().collection("todos").list({ sort: "-created" });
</script>

From here you can add a server-rendered page in routes/, a function the browser can call with “use server”, or data kept current with sync.

Ship it

sluurp compile builds one binary that holds the server and your app. sluurp push and deploy store an app as an immutable bundle and point a channel at it; rollback returns a channel to the version before.