Skip to Content
Introduction

RustBill

Open-source billing, subscription, and license management API built with Rust for speed and reliability.
RustAxumPostgreSQLSQLxStripeXenditLemonSqueezy


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

ComponentTechnology
LanguageRust (Edition 2021, 1.82+)
Web FrameworkAxum 0.8 + Tower middleware
DatabasePostgreSQL 17 via SQLx (compile-time checked queries)
AuthSession cookies, Bearer API keys, Keycloak SSO
PaymentsStripe, Xendit, LemonSqueezy (feature-gated)
EmailLettre (SMTP)
PDFprintpdf
Schedulingtokio-cron-scheduler
Testingaxum-test with 27 integration test files
DeploymentDocker 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, analytics
  • rustbill-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.

Learn more about the architecture

Last updated on