Lands the previously-untracked rago app: a Rust port of Lago billing with the three audit fixes from the 2026-09-03 railyard audit baked in: - CRITICAL: deterministic Stripe idempotency key (UUIDv5 of invoice id, sent as 'Idempotency-Key: payment-<id>') replacing the random-UUID-per- attempt pattern that allowed retry double-charges - HIGH: unique index on events(organization_id, external_subscription_id, transaction_id) with idempotent ON CONFLICT DO NOTHING insert; duplicate transaction_id surfaces as an API validation error, not a 500 - HIGH: partial unique index on invoice_subscriptions(subscription_id, charges_from_datetime, charges_to_datetime) WHERE recurring, with insert_subscription_invoice_guarded returning Created|AlreadyBilled, wired into bill_subscription and the scheduler Includes real-Postgres #[sqlx::test] suites (rago-db idempotency/parity, rago-jobs rebill/clock, rago-graphql admin1-5, rago-api rest_crud).
97 lines
2.8 KiB
TOML
97 lines
2.8 KiB
TOML
# apps/rago — Rust port of Lago's Go `events-processor` ("Rago").
|
|
#
|
|
# Faithful, behaviour-preserving port of github.com/getlago/lago/events-processor.
|
|
# This is its OWN standalone cargo workspace (like apps/rit, apps/relay), so a
|
|
# root `cargo build` never pulls it into another app's build graph.
|
|
#
|
|
# Build/test from here only: cd apps/rago && cargo build
|
|
[package]
|
|
name = "rago"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
license = "MIT"
|
|
description = "Rago — faithful Rust port of Lago's high-throughput Kafka events-processor"
|
|
rust-version = "1.80"
|
|
|
|
[lib]
|
|
name = "rago"
|
|
path = "src/lib.rs"
|
|
|
|
[[bin]]
|
|
name = "rago"
|
|
path = "src/main.rs"
|
|
|
|
[features]
|
|
default = []
|
|
# The in-memory (Badger→redb) CDC cache path (LAGO_USE_MEMORY_CACHE=true).
|
|
memcache = []
|
|
|
|
[dependencies]
|
|
# --- async runtime (Go goroutines → tokio) ---
|
|
tokio = { version = "1", features = ["full"] }
|
|
tokio-util = "0.7"
|
|
futures = "0.3"
|
|
async-trait = "0.1"
|
|
|
|
# --- serialization (encoding/json → serde) ---
|
|
serde = { version = "1", features = ["derive"] }
|
|
serde_json = "1"
|
|
|
|
# --- errors (fmt.Errorf/%w → thiserror/anyhow) ---
|
|
thiserror = "1"
|
|
anyhow = "1"
|
|
|
|
# --- ids / time (google/uuid, time.Time → uuid, chrono) ---
|
|
uuid = { version = "1", features = ["v4", "serde"] }
|
|
chrono = { version = "0.4", features = ["serde"] }
|
|
|
|
# --- decimals (used by expression-core & value formatting) ---
|
|
bigdecimal = { version = "0.4", features = ["serde-json"] }
|
|
|
|
# --- Postgres (pgx/gorm → sqlx) ---
|
|
sqlx = { version = "0.8", default-features = false, features = [
|
|
"runtime-tokio-rustls",
|
|
"postgres",
|
|
"uuid",
|
|
"chrono",
|
|
"json",
|
|
] }
|
|
|
|
# --- Redis (go-redis → redis) ---
|
|
redis = { version = "0.27", features = [
|
|
"tokio-comp",
|
|
"tokio-rustls-comp",
|
|
"connection-manager",
|
|
] }
|
|
|
|
# --- Kafka (franz-go → rdkafka / librdkafka). Builds bundled librdkafka via
|
|
# its own build script (no system cmake required in this env). ---
|
|
rdkafka = { version = "0.39", features = ["tokio"] }
|
|
|
|
# --- Embedded KV for the in-memory cache (Badger → redb, pure Rust) ---
|
|
redb = "3"
|
|
|
|
# --- lago-expression: the SAME native Rust engine the Go `expression-go`
|
|
# FFI binding wraps. Not published to crates.io — pulled from the repo. ---
|
|
expression-core = { git = "https://github.com/getlago/lago-expression" }
|
|
|
|
# --- tracing / OpenTelemetry (OTel + Datadog-via-OTLP) ---
|
|
tracing = "0.1"
|
|
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
|
|
tracing-opentelemetry = "0.31"
|
|
opentelemetry = "0.30"
|
|
opentelemetry_sdk = { version = "0.30", features = ["rt-tokio"] }
|
|
opentelemetry-otlp = { version = "0.30", features = ["grpc-tonic", "trace"] }
|
|
|
|
# --- Sentry (getsentry/sentry-go → sentry) ---
|
|
sentry = { version = "0.34", default-features = false, features = [
|
|
"backtrace",
|
|
"contexts",
|
|
"panic",
|
|
"rustls",
|
|
"reqwest",
|
|
] }
|
|
|
|
[dev-dependencies]
|
|
tempfile = "3"
|