Skip to content
ayeshrodzPublic

About

Open-source backend platform on PostgreSQL. One Rust binary: REST + realtime API, auth with roles, files, hooks, SQL console and a multi-project admin dashboard. Self-hosted, scales out. Works with the PocketBase SDKs.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

5 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

237 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

slonbase

Your whole backend, built on PostgreSQL.
slonbase is an open-source backend platform on PostgreSQL: a REST and realtime API, auth with roles, files, hooks and an admin dashboard for many projects, in one Rust binary. Every collection is a real PostgreSQL table.

CI Release Docker image PostgreSQL 14+ Rust Apache 2.0 license

Website Β· Features Β· Quick start Β· Install Β· API Β· Hooks Β· Benchmarks

A tour of the slonbase dashboard: signing in, the overview and a live records grid

A JavaScript client creating and updating a task. The dashboard's grid is live: realtime events arrive as the code runs.

Install

  • One command on a bare Linux server: curl -fsSL https://slonbase.com/install.sh | sudo sh installs PostgreSQL if needed, creates its role and database, installs slonbase and creates your first superuser. The installation guide does every step by hand, and covers packages, Docker and building from source.
  • What changed lately: see the changelog and the releases.
  • More: the tour of the dashboard, benchmarks against PocketBase and PostgREST, and every feature in one list.

Why slonbase

Define your data in a dashboard and get an API, auth, realtime and file storage right away, without writing a backend. slonbase gives you that in a single binary, runs as many isolated projects as you like from one dashboard, and keeps your data in PostgreSQL, the database you can query, replicate, back up and scale with the tools you already trust.

  • 🐘 Real PostgreSQL tables. Every collection is a table. Query it with SQL, join it in reports, replicate it, back it up with pg_dump, or run it on a managed service.
  • ⚑ Realtime for every change. A trigger on each table announces every write, whoever makes it: the API, your SQL, an auth flow or another program. Each subscriber gets only what its rules allow.
  • ↔️ Scales out. Run several instances on one database behind any load balancer. Realtime, schema changes, settings and rate limits are shared through PostgreSQL, so no sticky sessions. Tested layouts (a balancer, PgBouncer, projects on other servers) and the connection budget are in the scaling guide.
  • 🧩 Extend it your way. Hooks, routes, cron jobs and a query builder in JavaScript files, no build step; or a Rust library API.
  • πŸ—‚οΈ Many projects, one server. Host several isolated apps from one installation, each in a database of its own, with a command center for all of them.
  • πŸŽ›οΈ A dashboard that is yours. An SQL console, roles and API keys for your team, an email designer and a sign-in page you lay out yourself, with your name, colours and logo.
  • πŸš€ Fast where it matters. Written in Rust with tokio and axum; filters compile to parameterized SQL that uses your indexes (benchmarks).
  • πŸ“¦ One static binary. A 10 MB download (22 MB on disk) with the dashboard built in. Install it with Docker, .deb/.rpm packages or a plain binary, and finish with a setup wizard.

Features

Data

  • Base, auth and view collections, with 14 field types; live previews of views
  • A filter language for queries and access rules: relation paths, @request.*, @collection.*
  • expand, back-relations, sorting and paging
  • fields with nested paths and plain-text :excerpts of HTML, as in PocketBase
  • Batch requests in one transaction
  • Indexes, including unique and partial ones

Auth

  • Password, OAuth2 (Google, GitHub, Microsoft, OIDC, …), one-time passwords and MFA
  • Verification, password reset and email change
  • New-device sign-in alerts, impersonation

Realtime and files

  • SSE subscriptions with per-subscriber rules, filters and expand
  • Events for every change, made through the API or not
  • File fields on disk or any S3-compatible bucket; thumbnails, protected files, byte ranges

Operations

  • An admin dashboard with live grids, a schema editor and diagram, logs and an SQL console
  • Request logs, rate limits, superuser IP restrictions, Prometheus metrics
  • gzip compression of JSON that never touches tokens
  • Backups (on a schedule, to S3) and one-click restores
  • JavaScript hooks, cron jobs, a query builder, and a Rust library API
  • Migrations in JavaScript, each in a transaction, with automigrate

Note

slonbase is stable: within a major version, upgrades don't break the API, configuration, your data, hooks or migrations (see stability). Back up before upgrading anyway, and bug reports are very welcome.

Already using PocketBase?

slonbase is its own platform (an independent codebase, written from scratch in Rust for PostgreSQL), and its API stays compatible with PocketBase's, the project that inspired it, so you can bring an existing app along. See also how the two differ:

  • the PocketBase JavaScript and Dart SDKs work against slonbase as they are;
  • most pb_hooks and pb_migrations files run unchanged;
  • slonbase import-pocketbase brings over collections, records, files and settings, with users' password hashes, so nobody has to reset a password.

A test suite written with the official SDK runs against both servers in CI to keep it that way, and a differential runner sends both the same requests and compares the answers (compat/). The migration guide lists the differences.

PocketBase is the better choice when you want zero moving parts (one file, SQLite inside), when one small app on one small machine is the whole plan, or when you extend it in Go.

Quick start

On a Linux server (Debian, Ubuntu, Fedora, RHEL, Rocky, Alma): one command installs PostgreSQL if the machine has none, creates the database and its role, installs slonbase from the signed repository and creates your first superuser:

curl -fsSL https://slonbase.com/install.sh | sudo sh

It asks for your email and prints the dashboard address and a generated password. The installation guide shows every step by hand, from a bare server.

With Docker. This starts slonbase and a PostgreSQL 17 server for it:

mkdir slonbase && cd slonbase
curl -fsSLO https://raw.githubusercontent.com/ayeshrodz/slonbase/main/compose.yaml
echo "POSTGRES_PASSWORD=$(openssl rand -hex 24)" > .env
docker compose up -d
docker compose logs slonbase | grep "setup?token"

Open the printed link and create your first superuser. That's it: the dashboard is at http://localhost:8090/_/ and the API at /api/.

On a hosting platform: Render (one click), Railway, Fly.io, Coolify and Dokploy each have a ready-made setup with a database.

Deploy to Render

Other ways: the .deb, .rpm and static binaries are on the releases page, and the apt and dnf repositories are described in the installation guide. PostgreSQL isn't bundled: slonbase connects to any 14+ server, on the same machine, elsewhere, or a managed service.

Then connect from your app with any HTTP client, or with the PocketBase SDKs, which work with slonbase's API:

import PocketBase from "pocketbase";

const pb = new PocketBase("http://localhost:8090");
await pb.collection("users").authWithPassword("ann@example.com", "secret");
const posts = await pb.collection("posts").getList(1, 20, { filter: 'published = true', expand: "author" });

A look around

Records Overview
A collection's records in a live grid Overview
Schema Logs
Schema editor Logs
Projects: the command center SQL console
Every installation side by side: requests per minute, errors, latency, data and configuration The SQL console: tables and columns, a highlighted query and its results, ready to export
Record editor API rules
A record open in the drawer beside the grid API rules
Settings: appearance Email designer
Settings: color mode, thirteen named accents and a preview The email designer: the layout and each template, with a live preview below

The schema diagram: every collection with its fields, and its relations

The schema diagram, drawn from the collections: hover one to follow its relations.

The sidebar holds the sections and your collections, records open in a drawer beside the grid, and a status bar shows the connection, database and API base; light and dark follow GitHub's neutral palette (or your system). It works on phones, ⌘K / Ctrl K jumps anywhere, and it only uses the public API, so anything it does, you can script too.

Documentation

The guides are also on the documentation site, with search: slonbase.com/docs.

  • Installation: Docker, packages, binaries, first-run setup, upgrades
  • Configuration: server options and application settings
  • Scaling: several instances, PgBouncer, projects on several servers, connections
  • Hosting platforms: Render, Railway, Fly.io, Coolify and Dokploy
  • Running in production: reverse proxy, PostgreSQL, several instances, backups, monitoring, security
  • API: endpoints, collections, filters and rules, files, realtime
  • Extending: JavaScript hooks and the Rust library
  • Migrations: collections and data changes in code
  • Projects: several isolated installations, one database each, on one server
  • Migrating from PocketBase: the importer and the differences
  • Benchmarks: slonbase next to PocketBase on the same workloads
  • Design: the decisions behind slonbase
  • Stability: what 1.0 keeps compatible, deprecations and upgrades
  • Changelog

Commands

Command Description
slonbase serve Start the server (default).
slonbase setup Set up without the web wizard.
slonbase health Exit 0 if the local server is healthy (for container health checks).
slonbase superuser upsert|update|delete|otp ... Manage superusers. otp <email> prints a one-time password for signing in with MFA when emails can't be sent.
slonbase import-pocketbase <pb_data or backup.zip> Import a PocketBase installation.
slonbase migrate up|down|create|collections|list ... Apply, revert or write migrations.
slonbase project list|create|delete ... Manage projects; --project <name> runs superuser, import-pocketbase and migrate on one.

slonbase --help lists every option.

Performance

Compared with PocketBase and PostgREST, on the same machine, the same data and the same HTTP workloads, with default settings (method and full results):

Scenario slonbase 2.2 req/s PocketBase 0.40.6 req/s PostgREST 16.5 req/s p99 ms (slonbase / PocketBase / PostgREST)
Health check 44,316 32,270 36,267 2.1 / 6.4 / 2.2
View one record 19,965 11,484 5,197 3.7 / 23.4 / 14.4
List 30 records 7,814 1,610 3,733 7.8 / 67.1 / 13.7
List 30, filtered 7,100 105 3,315 8.2 / 439 / 15.4
List 30, expand a relation 3,906 1,065 n/a 12.6 / 93.3 / n/a
Create a record 7,424 (8,722 with async commit) 4,051 3,828 8.4 / 45.5 / 16.2

32 clients, medians of three 10-second runs on a 4-vCPU VM. slonbase is ahead in every scenario measured, from 1.2 times PocketBase's throughput (sign-in, which bcrypt bounds) to 68 times (filtered lists, where PostgreSQL uses the index). PostgREST is a leaner program that does much less (no sign-in, files, realtime or dashboard): a 15 MB process against slonbase's 40 MB. Writes are ahead of PocketBase with PostgreSQL's default durability, and further ahead when PostgreSQL makes the same trade-off as SQLite's default (synchronous_commit = off; see why). Lists are gzipped, a sixth of the bytes, which this loopback benchmark counts as CPU only. The numbers come from one machine and will differ on yours: the bench README has the caveats and the commands to repeat them.

Contributing

Bug reports, ideas and pull requests are welcome; see CONTRIBUTING.md. The quickest checks:

cargo test                                                    # unit tests
SLONBASE_TEST_DATABASE_URL='postgres://postgres:postgres@127.0.0.1:5432/postgres?sslmode=disable' cargo test   # everything
(cd compat && npm ci) && DATABASE_URL='postgres://...' compat/run.sh slonbase                # the SDK compatibility suite

Please report security problems privately.

License

slonbase is licensed under the Apache License 2.0: free to use, modify, host and sell services around, with an explicit patent grant. The name and logo are covered by the trademark policy. Releases up to 2.3.0 were MIT. Contributions are accepted under a short CLA (you keep your copyright). Everything released under Apache 2.0 stays under it; the maintainer may in future offer separately licensed commercial features or hosted services, which is what the CLA makes possible. See license and contributing terms.

The dashboard vendors Preact (MIT) and htm (Apache-2.0); their licenses are in ui/app/vendor. It ships the IBM Plex Sans and JetBrains Mono fonts (SIL Open Font License 1.1); the licences are in ui/app/fonts. All third-party notices are in NOTICE. slonbase is an independent project inspired by PocketBase (MIT). It is not affiliated with or endorsed by PocketBase or its author, and it wouldn't exist without their work.

About

Open-source backend platform on PostgreSQL. One Rust binary: REST + realtime API, auth with roles, files, hooks, SQL console and a multi-project admin dashboard. Self-hosted, scales out. Works with the PocketBase SDKs.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages