An open, blazingly fast, single-executable Firebase alternative with type-safe REST & realtime APIs, built-in JS/ES6/TS runtime, SSR, auth and admin UI built on Rust, SQLite & V8.
Simplify with fewer moving parts: an easy to self-host, single-executable, extensible backend for your mobile, web or desktop application. Sub-millisecond latencies eliminate the need for dedicated caches, no more stale or inconsistent data.
Try the
demo
online
Email: admin@localhost
password: secret.
For more context, documentation, and a live demo, check out the website: trailbase.io. Questions? Thoughts? - Take a look at the FAQ or reach out. If you like TrailBase or want to follow along, consider leaving a ⭐🙏.
This repository contains all components that make up TrailBase including client libraries, tests, documentation and examples. Only the benchmarks are kept separately due to their external dependencies.
Pre-built static binaries are available as GitHub releases for Linux, MacOS and Windows. On Windows the Docker image can be used.
Client packages for various languages are available via:
You can get TrailBase either as a pre-built static binary (MacOS & Linux), run it using Docker (Windows, MacOS, Linux, ...), or build it from source.
The latest pre-built binaries can be downloaded from GitHub releases and run via:
$ ./trail run
Thanks to trail
being a single static binary, there's no need to install
anything including system dependencies.
This also means that you can confidently update your system and deploy to
different machines without having to worry about prior set-up or shared
library compatibility.
Using Docker, you can run the
following, which will also create and mount a local ./traildepot
asset
directory:
$ mkdir traildepot
$ alias trail="docker run -p 4000:4000 --mount type=bind,source=$PWD/traildepot,target=/app/traildepot trailbase/trailbase /app/trail"
$ trail run
To get a full list of commands, simply run trail --help
.
If you have all the necessary dependencies (Rust, protobuf, node.js, pnpm) installed, you can build TrailBase by running:
# Windows only: make sure to enable symlinks (w/o `mklink` permissions for your
# user, git will fall back to copies).
$ git config core.symlinks true && git reset --hard
# Download necessary git sub-modules.
$ git submodule update --init --recursive
# Install Javascript dependencies first. Required for the next step.
$ pnpm install
# Build the main executable. Adding `--release` will build a faster release
# binary but slow down the build significantly.
$ cargo build --bin trail
To build a static binary you'll need to explicitly specify the target platform, e.g. Linux using the GNU glibc:
$ RUSTFLAGS="-C target-feature=+crt-static" cargo build --target x86_64-unknown-linux-gnu --release
Alternatively, if you want to build a Docker image or don't have to deal with build dependencies, you can simply run:
# Download necessary git sub-modules.
$ git submodule update --init --recursive
# Build the container as defined in `Dockerfile`.
$ docker build . -t trailbase
Contributions are very much appreciated 🙏. For anything beyond bug fixes, let's briefly chat to see how a proposal fits into the overall roadmap and avoid any surprises.
We're not sure yet what the best setup or exact license is for compatibility between OSL-3.0 and more popular licenses or use as a framework. So we'd ask you to sign a simple CLA that retains your copyright, ensures that TrailBase will continue to forever be freely available under an OSI-approved copyleft license, while allowing for some flexibility and sub-licensing as established by much larger, successful projects such as Grafana or Element.
TrailBase is free software under the terms of the Open Software License 3.0 (OSL-3.0).
We chose the OSL-3.0 over other, better known copyleft licenses due to its narrower definition of "derivative work" that only covers modifications to TrailBase itself. This means that your application's original code is not subject to the OSL-3.0's copyleft provisions. This is true whether you connect over the network (e.g. web, mobile, other services, etc.), you're serving static assets, using the runtime to write custom server-side logic or using TrailBase as a framework.
This limited scope is similar to the GPL's classpath or the LGPL's linking exception. The goal is to allow building on top and around of TrailBase without any provisions rubbing off onto your original work, while making sure that fixes and improvements find their way back to the community. These are our intentions - we felt the need to spell them out explicitly because licensing is tricky and we ain't lawyers. Graciously, the license's author provides some more explanations. If you have any concerns, please reach out.
If you require an exception, reach out to [email protected].