Skip to main content

What is TrailBase?

TrailBase is an open-source, single-executable Firebase alternative that combines the simplicity of SQLite with the power of modern web technologies. Built on Rust, SQLite, and Wasmtime, TrailBase provides a complete backend solution with type-safe REST APIs, realtime subscriptions, authentication, and an admin UI - all in one binary.
TrailBase delivers sub-millisecond latencies that eliminate the need for dedicated caches, ensuring you never deal with stale or inconsistent data.

Key Features

Type-Safe APIs

Automatically generated REST APIs with JSON Schema validation and code generation for virtually any language

WebAssembly Runtime

Extend functionality with custom logic using JavaScript, TypeScript, or Rust compiled to WebAssembly

Realtime Subscriptions

Built-in support for streaming data changes to clients in real-time

Authentication & Authorization

Complete auth system with OAuth2, password-based login, email verification, and fine-grained ACLs

Admin Dashboard

Web-based admin UI for managing users, tables, APIs, and configurations

Multi-Database Support

Work with multiple SQLite databases simultaneously with separate migration paths

Vector Search

Built-in support for vector embeddings and semantic search via sqlite-vec

Geospatial Support

Native geospatial capabilities with PostGIS-compatible functions

Why TrailBase?

Simplify Your Stack

TrailBase helps you simplify with fewer moving parts. Instead of managing multiple services (database, API server, cache, queue, auth service), you get an easy-to-self-host, single-executable backend for your mobile, web, or desktop application.

Performance That Matters

With sub-millisecond latencies, TrailBase eliminates common performance bottlenecks:
  • No need for dedicated Redis/Memcached caches
  • No stale or inconsistent data from cache invalidation issues
  • Direct SQLite access provides blazing-fast queries
  • Perfect for edge deployments and resource-constrained environments

Developer Experience

TrailBase prioritizes developer experience with:
  • Zero dependencies: Single binary with everything included
  • Type safety: Generate client libraries in TypeScript, Dart, Rust, Python, Go, Kotlin, Swift, and C#
  • Database migrations: Built-in migration system for schema versioning
  • Hot reload: Development mode with automatic reloading
  • Extensibility: WebAssembly runtime for custom server-side logic

Architecture Overview

TrailBase’s architecture is designed for simplicity and performance:
┌─────────────────────────────────────────────────────────┐
│                    TrailBase Server                     │
│  ┌────────────┐  ┌────────────┐  ┌─────────────────┐  │
│  │  Admin UI  │  │ Record APIs│  │  Auth & OAuth2  │  │
│  └────────────┘  └────────────┘  └─────────────────┘  │
│  ┌────────────────────────────────────────────────┐    │
│  │         WebAssembly Runtime (Wasmtime)         │    │
│  │    JS/TS/Rust custom endpoints & functions     │    │
│  └────────────────────────────────────────────────┘    │
│  ┌────────────────────────────────────────────────┐    │
│  │              SQLite Databases                  │    │
│  │  • Main DB  • Logs DB  • Queue DB              │    │
│  │  • Vector Search  • Geospatial  • Full-text    │    │
│  └────────────────────────────────────────────────┘    │
└─────────────────────────────────────────────────────────┘

Core Components

TrailBase uses SQLite as its database engine with:
  • Multiple databases: Separate databases for main data, logs, and queues
  • Extensions: sqlite-vec for vector search, sqlean for additional functions
  • STRICT tables: Type safety at the database level
  • WAL mode: Write-Ahead Logging for better concurrency
Automatically generated REST APIs from database schemas:
  • CRUD operations: Create, Read, Update, Delete
  • Filtering & sorting: Query parameters for complex queries
  • Pagination: Efficient data fetching with offset/limit
  • JSON Schema: Auto-generated schemas for type-safe clients
  • Access control: Table and column-level permissions
Extend TrailBase with custom logic:
  • Wasmtime-based: Fast, secure WebAssembly execution
  • Multiple languages: JavaScript, TypeScript, or Rust
  • Custom endpoints: Add new HTTP routes
  • Database access: Query databases from WASM code
  • Component model: Install pre-built components like auth UI
Complete auth solution with:
  • Password authentication: Argon2 hashing
  • OAuth2 providers: Google, GitHub, Apple, Microsoft, and more
  • Email verification: Built-in email sending
  • JWT tokens: Secure, stateless authentication
  • User management: Admin CLI and UI tools

Project Structure

When you run TrailBase, it creates a traildepot directory with the following structure:
traildepot/
├── data/               # SQLite database files
│   ├── main.db        # Primary application database
│   ├── logs.db        # Request/access logs
│   └── queue.db       # Background job queue
├── migrations/        # Database migration files
│   └── main/         # Migrations for main database
├── backups/          # Automated database backups
├── uploads/          # Local file uploads (supports S3)
├── secrets/          # JWT keys and sensitive config
│   └── keys/
├── wasm/             # WebAssembly components
├── config.textproto  # Server configuration
└── metadata.textproto # Additional metadata
The traildepot directory is portable - you can copy it between environments or back it up as a single unit.

Use Cases

TrailBase is perfect for:
  • Mobile & web apps: Full-featured backend in a single binary
  • Internal tools: Rapid development with admin UI
  • Edge deployments: Run close to users with minimal resources
  • Data analysis: SQLite-compatible with programmatic access
  • Prototypes & MVPs: Get started quickly without infrastructure complexity
  • Self-hosted alternatives: Replace Firebase, Supabase, or PocketBase

Client Libraries

TrailBase provides official client libraries for multiple languages:

License

TrailBase is free software under the Open Software License 3.0 (OSL-3.0). The license’s narrow definition of “derivative work” means:
  • ✅ Your application code is not subject to copyleft
  • ✅ You can build commercial applications
  • ✅ Works for web, mobile, desktop, and services
  • ✅ Modifications to TrailBase itself must be shared
Client libraries are dual-licensed under the permissive Apache-2.0 license.
For exceptions or enterprise licensing, contact [email protected]

Next Steps

Quickstart

Get TrailBase running in under 5 minutes

Installation

Detailed installation instructions for all platforms

Build docs developers (and LLMs) love