
RustBill
Open-source billing, subscription, and license management API built with Rust for speed and reliability.
RustAxumPostgreSQLSQLxStripeXenditLemonSqueezy
⚡
Getting Started
Install, configure, first API call
Architecture
Crates, schema, auth design
API Reference
Every endpoint documented
Guides
Payment, webhooks, deployment
Features
Subscription Management
Monthly, quarterly, and yearly billing cycles with plan changes, proration, and automated lifecycle management.
Multi-Provider Payments
Stripe, Xendit, and LemonSqueezy integrations with unified checkout sessions and webhook handling.
Invoice Generation
Auto-generated invoices with PDF export, configurable numbering sequences, and full status tracking.
License Management
Key generation, per-device activation tracking, feature-based licensing, and public verification endpoints.
Usage-Based Billing
Event ingestion, tiered pricing models, per-unit metering, and usage analytics.
Dunning and Recovery
Automated multi-step payment failure recovery: reminder, warning, final notice, and suspension.
Credits and Coupons
Store credit balances, percentage and fixed-amount discount codes, and credit note generation.
Webhooks
Inbound provider webhooks with signature verification, plus outbound event dispatch to your systems.
Analytics
Sales ledger, revenue metrics, customer health scores, and partitioned event tables for fast queries.
Tech Stack
| Component | Technology |
|---|---|
| Language | Rust (Edition 2021, 1.82+) |
| Web Framework | Axum 0.8 + Tower middleware |
| Database | PostgreSQL 17 via SQLx (compile-time checked queries) |
| Auth | Session cookies, Bearer API keys, Keycloak SSO |
| Payments | Stripe, Xendit, LemonSqueezy (feature-gated) |
| Lettre (SMTP) | |
| printpdf | |
| Scheduling | tokio-cron-scheduler |
| Testing | axum-test with 27 integration test files |
| Deployment | Docker multi-stage build, systemd, reverse proxy |
Architecture
RustBill is organized as a Cargo workspace with two crates:
rustbill-core— Domain logic: billing lifecycle, subscriptions, invoicing, payments, licenses, customers, products, dunning, notifications, analyticsrustbill-server— HTTP layer: Axum route handlers organized as vertical slices, middleware, auth extractors
Payment providers are behind feature flags so you only compile what you need. All monetary arithmetic uses rust_decimal. Database queries are verified at compile time via SQLx.
Last updated on