Skip to content

Latest commit

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

🔥 Firerust

A lightweight, self-hosted Backend-as-a-Service inspired by Firebase and Supabase. Built with Rust + Axum + SQLite. Zero external services required.


Features

ModuleStatusDescription
AdminCreate / list / delete projects via X-Admin-Key
AuthPer-project JWT auth — register, login, /me
FilesS3-style multipart upload, list, download, delete
DB🚧Collection scaffolding ready; document CRUD coming soon

Requirements

  • Rust ≥ 1.80 (rustup update stable)
  • SQLite shared lib (libsqlite3-dev on Ubuntu)

Quick Start

Download the linux binary from releases and run

./firerust

Run the backend API

# 1. Clone / enter the directorycd firerust-api
# 2. Edit config (at minimum change the keys)
cp config.json config.local.json
$EDITOR config.local.json
# 3. Build and run
cargo run --release -- config.local.json

The server starts on http://0.0.0.0:4000 by default.

Run the web client

cd firerust-client
npx run dev

Configuration — config.json

{
"db_path": "./data/firerust.db",
"secret_key": "change-this-secret-key-in-production-min-32-chars",
"admin_key": "change-this-admin-key-in-production",
"uploads_folder": "./uploads",
"jwt_expiry_hours": 24,
"host": "0.0.0.0",
"port": 4000
}
FieldDescription
db_pathPath to SQLite file. Use :memory: for tests.
secret_keyHMAC-SHA256 secret used to sign JWTs. Min 32 chars.
admin_keyValue that must be sent in X-Admin-Key header for admin routes.
uploads_folderRoot directory for uploaded files. Project sub-folders are created automatically.
jwt_expiry_hoursHow long issued tokens remain valid. Default: 24.
host / portBind address. Default: 0.0.0.0:3000.

Running Tests

# Unit tests (no network, in-memory DB)
cargo test# With log output
RUST_LOG=debug cargo test -- --nocapture

Project Layout

firerust/
├── config.json # Default config
├── Cargo.toml
└── src/
├── main.rs # Router assembly + server startup
├── config.rs # Config loading + validation
├── db.rs # Pool creation + schema migrations
├── error.rs # Unified AppError → HTTP response
├── state.rs # Shared AppState (pool + config)
├── middleware/
│ ├── admin.rs # X-Admin-Key extractor
│ └── jwt.rs # Bearer JWT extractor
├── models/
│ ├── project.rs # Project CRUD
│ ├── auth_user.rs # User CRUD + JWT generation/validation
│ └── file_record.rs # File metadata CRUD
└── routes/
├── admin.rs # Admin project endpoints
├── auth.rs # Auth endpoints
├── files.rs # File upload/download endpoints
└── db_model.rs # DB collection endpoints (stub)

About

A lightweight, self-hosted Backend-as-a-Service inspired by Firebase and Supabase. Built with Rust + Axum + SQLite. Zero external services required.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages