---
title: Getting started
description: Run Sluurp, make an administrator, serve a folder.
section: Start
order: 1
---

# Getting started

<p class="lead">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.</p>

## Install

On macOS and Linux:

```sh title="Terminal"
curl -fsSL https://raw.githubusercontent.com/SluurpHQ/sluurp/master/install.sh | sh
```

On Windows, in PowerShell:

```sh title="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](/docs/development).

## Run it

```sh title="Terminal"
sluurp superuser you@example.com a-long-password
sluurp serve --public ./my-app
```

| Path | What |
|---|---|
| `/` | 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.js` | the 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.

```sh title="Terminal"
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.

```json title="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.

```html title="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/](/docs/server-components), a function the browser can call with ["use server"](/docs/server-functions), or data kept current with [sync](/docs/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.
