An open API service indexing awesome lists of open source software.

https://github.com/pjonaszik/rustbase

A multi-tenant Backend-as-a-Service in Rust โ€” realms, apps, collections, auth, hooks, files, realtime, dashboard.
https://github.com/pjonaszik/rustbase

axum baas backend backend-as-a-service multi-tenant rust self-hosted sqlite

Last synced: about 3 hours ago
JSON representation

A multi-tenant Backend-as-a-Service in Rust โ€” realms, apps, collections, auth, hooks, files, realtime, dashboard.

Awesome Lists containing this project

README

          

RustBase

# RustBase

**Multi-tenant backend. Single binary. Real isolation.**

A multi-tenant Backend-as-a-Service in Rust. Drop one executable on a server, run the setup wizard, and you have workspaces, apps, collections, auth, realtime, file storage, a dashboard, and a REST API.

RustBase dashboard sign-in page

[![CI](https://img.shields.io/github/actions/workflow/status/pjonaszik/rustbase/ci.yml?branch=main&label=CI&style=for-the-badge&logo=githubactions&logoColor=white)](https://github.com/pjonaszik/rustbase/actions/workflows/ci.yml)
[![Docs](https://img.shields.io/github/actions/workflow/status/pjonaszik/rustbase/docs.yml?branch=main&label=Docs&style=for-the-badge&logo=readthedocs&logoColor=white)](https://pjonaszik.github.io/rustbase/)
[![Release](https://img.shields.io/github/v/release/pjonaszik/rustbase?include_prereleases&sort=semver&style=for-the-badge&logo=github&logoColor=white)](https://github.com/pjonaszik/rustbase/releases)
[![Licence](https://img.shields.io/badge/licence-MIT%20OR%20Apache--2.0-blue?style=for-the-badge)](#licence)

[![Rust](https://img.shields.io/badge/Rust-1.88%2B-dea584?style=for-the-badge&logo=rust&logoColor=white)](https://www.rust-lang.org)
[![axum](https://img.shields.io/badge/axum-0.8-FFA500?style=for-the-badge&logo=tokio&logoColor=white)](https://github.com/tokio-rs/axum)
[![SQLite](https://img.shields.io/badge/SQLite-WAL-003B57?style=for-the-badge&logo=sqlite&logoColor=white)](https://www.sqlite.org/wal.html)
[![Discussions](https://img.shields.io/badge/Discussions-open-2188ff?style=for-the-badge&logo=github)](https://github.com/pjonaszik/rustbase/discussions)

[![Stars](https://img.shields.io/github/stars/pjonaszik/rustbase?style=for-the-badge&logo=github)](https://github.com/pjonaszik/rustbase/stargazers)
[![Last commit](https://img.shields.io/github/last-commit/pjonaszik/rustbase/main?style=for-the-badge&logo=git&logoColor=white)](https://github.com/pjonaszik/rustbase/commits/main)
[![PRs welcome](https://img.shields.io/badge/PRs-welcome-brightgreen?style=for-the-badge&logo=github)](https://github.com/pjonaszik/rustbase/blob/main/CONTRIBUTING.md)
[![Support](https://img.shields.io/badge/Support%20us-PayPal-00457C?style=for-the-badge&logo=paypal&logoColor=white)](https://www.paypal.com/ncp/payment/5L8KUWE8F2PSU)

๐Ÿ“– [Docs](https://pjonaszik.github.io/rustbase/) ย ยทย  ๐Ÿ› [Issues](https://github.com/pjonaszik/rustbase/issues) ย ยทย  ๐Ÿ’ฌ [Discussions](https://github.com/pjonaszik/rustbase/discussions) ย ยทย  ๐Ÿ”’ [Security](SECURITY.md) ย ยทย  ๐Ÿ“ [Changelog](CHANGELOG.md)

---

## Who this is for

You ship **multiple small apps** under one organisational tenant โ€” agency
projects for several clients, an indie portfolio of side products, a fleet of
internal tools โ€” and you want **real isolation** between them without running a
fleet of containers.

Concretely, RustBase suits you if:

- You'd otherwise deploy one PocketBase per app (and dread the ops).
- You'd otherwise reach for Supabase but don't want a managed Postgres bill,
RLS soup, or Edge Functions running someone else's JS runtime.
- You'd otherwise build "one Postgres + Redis + S3 + auth-service + admin UI"
stack but you ship by yourself and your time is the constraint.

RustBase gives you, in one binary, the multi-tenant primitive
(`System โ†’ Workspace โ†’ App`) baked into the storage layer. Each `App` gets its own
SQLite file. Delete an app โ€” `rm -rf` its folder. Take a backup โ€” `tar` the
folder. No managed services, no orchestration, no container Tetris.

See [Positioning](https://pjonaszik.github.io/rustbase/concepts/positioning)
and [the comparison vs PocketBase / Supabase / Appwrite](https://pjonaszik.github.io/rustbase/guide/comparison)
in the docs for the honest tradeoffs.

## Features

- **Multi-tenant by design** โ€” `System โ†’ Workspace โ†’ App`. Each app's data lives
in its own SQLite file under `data/workspaces//apps//data.db`,
with its own user pool, OAuth providers, files, hooks, and audit log.
- **Three admin tiers** โ€” master, workspace, and app admins, each scoped exactly
to what they manage.
- **Auth that fits a SaaS** โ€” email + password, email OTP (passwordless), TOTP
second factor, and OAuth2 / OIDC (Google, GitHub, Microsoft presets shipped).
- **Realtime** โ€” SSE subscriptions on every collection. Hooks publish on
every create / update / delete.
- **File storage** โ€” local disk or any S3-compatible bucket (AWS, R2, MinIO)
via `object_store`.
- **JS/TS hooks** โ€” embedded QuickJS runtime. Drop a `.js` or `.ts` file into
`data/hooks///` and lifecycle handlers, custom HTTP routes, and
scheduled jobs light up. No Node.js required, ever.
- **Hierarchical policies** โ€” master sets bounds, workspaces tighten, apps pick
values. Auto-clamp + audit when a parent narrows.
- **Audit log per scope**, append-only.
- **Embedded SvelteKit dashboard** at `/_/`, served straight from the binary.
- **Optional Litestream replication** to any S3 endpoint.

## Status

`v0.1` ships the core surface โ€” auth, collections, hooks, files, realtime,
dashboard, CI/release pipeline, multi-arch Docker image. `v0.2` adds the
production-hardening pack (rate limits, JWKS, PKCE, observability). See
[`ROADMAP.md`](ROADMAP.md) for the trajectory and [`CHANGELOG.md`](CHANGELOG.md)
for what landed.

Not yet a fit for: high-write workloads (>100 RPS sustained, the SQLite write
lock kicks in), multi-region deployments, or compliance-sensitive workloads
without an external review. See the [deployment guide](https://pjonaszik.github.io/rustbase/guide/deployment)
for what "production" means here in concrete terms.

## Quick start

### Docker (fastest)

```sh
docker run --rm -p 8080:8080 -v $(pwd)/data:/home/rustbase/data \
ghcr.io/pjonaszik/rustbase:latest
```

### Native binary

Download the binary for your platform from the
[latest release](https://github.com/pjonaszik/rustbase/releases/latest), or
build from source:

```sh
git clone https://github.com/pjonaszik/rustbase.git
cd rustbase
cargo build --release
./target/release/rustbase
```

Then:

1. Open in your browser.
2. The server auto-seeded an `admin` master-admin row at first boot with no
password โ€” the **setup wizard** asks you to set one. Submit it.
3. You're signed in. Create your first workspace and your first app.
4. Hit the REST API: `/api/workspaces//apps//collections/...`.

The full walkthrough lives at
[**docs / first-app**](https://pjonaszik.github.io/rustbase/guide/first-app).

## Build from source

You need:

- Rust โ‰ฅ 1.88 (stable). Install via [`rustup`](https://rustup.rs/).
- [Bun](https://bun.sh/) for the embedded dashboard and the docs site.

```sh
cargo build --release # produces ./target/release/rustbase
cargo test --workspace # โ‰ˆ 20 s
bun --cwd ui run dev # dashboard dev server, proxies API on :8080
bun --cwd docs run dev # docs dev server (VitePress)
```

See [CONTRIBUTING.md](CONTRIBUTING.md) for the full dev guide, hook setup, and
conventions.

## Architecture in 60 seconds

```
System
โ””โ”€โ”€ Workspace (organization boundary โ€” admins live here)
โ””โ”€โ”€ App (data product โ€” collections, records, files, end-users, OAuth live here)
```

Storage layout:

```
data/
system.db # workspaces registry, master admins
workspaces/
/
workspace.db # apps, workspace/app admins, admin refresh tokens
apps/
/
data.db # collections, records, users, oauth, app audit
storage/ # file blobs
hooks/
// # JS/TS hook source
```

One binary. One `data/` folder. Backups are object storage; restores are a
directory copy.

Full mental model: .

## Contributing

Bugs, feature ideas, and PRs are welcome. Please read
[CONTRIBUTING.md](CONTRIBUTING.md) first โ€” it covers the dev workflow,
the conventions the code expects, and how to ship a clean PR.

By participating you agree to the [Code of Conduct](CODE_OF_CONDUCT.md).

For security issues, see [SECURITY.md](SECURITY.md) โ€” please do **not** open a
public issue for those.

## Support us

RustBase is built and maintained on personal time. If it helps you ship โ€” or
if you just want to encourage more work on it โ€” contributions are welcome
through PayPal. The link is a payment link, so you enter the amount yourself
(no fixed tiers, no recurring trap, just a one-off transfer of whatever feels
right):

[**โ†’ Support RustBase on PayPal**](https://www.paypal.com/ncp/payment/5L8KUWE8F2PSU)



Scan to support RustBase via PayPal



Scan to support โ€” opens the PayPal payment page.

Every contribution โ€” code, docs, bug reports, PayPal โ€” keeps the project
moving. Thank you.

## Licence

Dual-licensed under either of:

- MIT License ([LICENSE-MIT](LICENSE-MIT) or
)
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
)

at your option.

Unless you explicitly state otherwise, any contribution intentionally
submitted for inclusion in the work by you, as defined in the Apache-2.0
licence, shall be dual licensed as above, without any additional terms or
conditions.