Overview
Discover what makes TrailBase powerful
TrailBase is a self‑hosted, single‑executables backend designed to replace Firebase with a lightweight, high‑performance stack. Built in Rust, it bundles an Axum HTTP server, SQLite for storage, and Wasmtime to execute user‑supplied WebAssembly modules. The result is a type‑safe REST and realtime API surface that can be consumed by any client language—JavaScript, Dart, Rust, Go, Python, C#, Swift, and Kotlin—all available as official client libraries. The application ships with an optional admin UI that leverages SSR for instant data exploration, but the core can be controlled purely via configuration and migration files, keeping the runtime footprint minimal.
Language
Web Framework
Database
Runtime
Overview
TrailBase is a self‑hosted, single‑executables backend designed to replace Firebase with a lightweight, high‑performance stack. Built in Rust, it bundles an Axum HTTP server, SQLite for storage, and Wasmtime to execute user‑supplied WebAssembly modules. The result is a type‑safe REST and realtime API surface that can be consumed by any client language—JavaScript, Dart, Rust, Go, Python, C#, Swift, and Kotlin—all available as official client libraries. The application ships with an optional admin UI that leverages SSR for instant data exploration, but the core can be controlled purely via configuration and migration files, keeping the runtime footprint minimal.
Technical Stack & Architecture
- Language: Rust (core, server, CLI tooling)
- Web Framework: Axum – asynchronous HTTP handling with zero‑copy request parsing
- Database: SQLite (full‑SQL engine, ACID guarantees) accessed via the
rusqlitecrate - Runtime: Wasmtime – JIT compilation of custom endpoints written in WebAssembly, enabling dynamic business logic without recompiling the server
- Admin UI: React/SSR rendered through Axum’s
tower-httpintegration; optional, but provides CRUD and schema editing - Deployment: A single static binary (Linux/MacOS/Windows) or Docker image (
trailbase/trailbase) that listens on a configurable port; no external services required
The architecture follows a “micro‑service in one” model: the binary contains all runtime components, configuration is read from a TOML/YAML file, and migrations are applied on startup. Because SQLite runs in‑process, the entire stack remains a single process, which simplifies scaling to a single node while still delivering sub‑millisecond latencies.
Core Capabilities
- Type‑safe APIs: The server automatically generates REST and websocket endpoints from the database schema, exposing JSON payloads with compile‑time type guarantees.
- Realtime Subscriptions: Clients can subscribe to table changes via websockets; the server pushes delta events instantly, eliminating the need for external message brokers.
- Custom Endpoints: Developers can write business logic in any WebAssembly‑compatible language (Rust, AssemblyScript, C), compile to
.wasm, and drop it into theendpoints/folder. The server loads these modules at runtime, exposing them as HTTP routes. - Auth & RBAC: Built‑in email/password authentication, JWT issuance, and role‑based access control that can be extended via custom Wasm modules.
- Migration & Schema Management: Declarative migrations written in SQL are tracked and applied automatically, ensuring schema drift is minimized across environments.
Deployment & Infrastructure
TrailBase’s single‑binary approach removes the need for a database cluster or serverless platform. For production, it is recommended to run the binary behind a reverse proxy (Nginx/Traefik) with TLS termination. The Docker image is lightweight (~50 MB), making it ideal for edge deployments or local development. Horizontal scaling can be achieved by running multiple instances behind a load balancer; SQLite’s file‑based nature requires shared storage or stateless data replication if instances need to share state.
Integration & Extensibility
- Webhooks: The API can trigger outbound HTTP calls on CRUD events, enabling integration with third‑party services.
- Plugin System: By compiling plugins to WebAssembly, developers can extend authentication flows, validation logic, or data transformation without altering the core binary.
- SDKs: Each client SDK provides thin wrappers around the REST endpoints, handling authentication tokens and realtime subscriptions automatically.
- CLI: A command‑line tool lets developers scaffold projects, run migrations, and manage secrets, streamlining the dev experience.
Developer Experience
TrailBase emphasizes minimal friction: a single executable, zero‑config Docker images, and auto‑generated documentation from the schema. The client libraries follow idiomatic patterns for each language, reducing boilerplate. Documentation is organized around the core concepts—schema definition, migrations, custom endpoints—and includes example projects for each SDK. The community is active on GitHub and Discord; issues are triaged quickly, and pull requests for new language clients or feature extensions are welcomed.
Use Cases
- Mobile & Web Apps: Fast, type‑safe backend for Flutter, React Native, or Vue.js frontends that require realtime data.
- Desktop Applications: Rust or Go desktop apps can embed the same API client, sharing logic across platforms.
- Edge Services: Deploy a lightweight instance on a Raspberry Pi or Cloudflare Workers (via Wasmtime) to serve localized data.
- Rapid Prototyping: Spin up a new project in minutes, define the schema, and start coding business logic in WebAssembly without waiting for a database deployment.
Advantages Over Alternatives
- Performance: Benchmarks show 11× faster than PocketBase and ~40× faster than Supabase, thanks to Rust’s low overhead and SQLite’s in‑process execution.
- Footprint: A single 50 MB binary versus multi‑service stacks, reducing attack surface and simplifying CI/CD.
- Flexibility: WebAssembly endpoints allow dynamic logic updates without downtime, while still maintaining type safety.
- Licensing: Open Source License (OSL 3.0) gives commercial freedom without the constraints of proprietary SaaS.
- Developer Control: Full access to source, database, and runtime means no vendor lock
Open SourceReady to get started?
Join the community and start self-hosting TrailBase today
Related Apps in development-tools
Hoppscotch
Fast, lightweight API development tool
code-server
Self-hosted development-tools
AppFlowy
AI-powered workspace for notes, projects, and wikis
Appwrite
All-in-one backend platform for modern apps
PocketBase
Lightweight Go backend in a single file
Gitea
Fast, lightweight self-hosted Git platform
Weekly Views
Repository Health
Information
Explore More Apps
Mail-in-a-Box
One‑click mail server for personal control
WriteFreely
Minimalist, distraction‑free blogging platform
Gatus
Developer‑oriented health dashboard for services
Dovecot
Secure, high‑performance IMAP server
ownCloud
Secure, self‑hosted file sharing and collaboration
Tamari
Your personal recipe manager and meal planner
