Meterplex is a high-performance, developer-first billing engine that manages plans, tracks usage events, enforces quotas in real time, and maintains auditability. Designed as a modular monolith, it allows you to easily scale from a simple SaaS application to an event-driven microservices architecture.
- π€ Multi-Tenant Identity & Access - Secure JWT authentication, tenant isolation, and Stripe-like API keys (using hashed storage and constant-time comparison).
- π·οΈ Plans & Entitlements - Programmable features (boolean flags, reset quotas, metered features) with snapshotted entitlements to protect existing contracts.
- β‘ Usage Ingestion Pipeline - Guaranteed, idempotent event delivery using the Transactional Outbox Pattern and Kafka event streams with concurrency safety (
SKIP LOCKED). - π’ Atomic Aggregations - Concurrent real-time usage tracking using Postgres raw SQL upserts and atomic Redis caching with auto-expiring TTLs.
- π Audit-Ready Ledgers - Append-only transactional database logs and built-in dead-letter auditing to triage and reprocess failed billing events.
Make sure you have Node.js >= 24, pnpm >= 9, and Docker installed.
Run the Interactive Setup Wizard to automatically install dependencies, start containers, and seed the database in a single step:
git clone https://github.com/chitrank2050/meterplex.git
cd meterplex
pnpm dev:init# Health check (should return status: ok)
curl http://localhost:3000/health
# Open API Swagger / Scalar Documentation
# http://localhost:3000/api/docsFor custom configs, manual setups, or daily commands, refer to the Development Setup Guide.
Meterplex is structured as a modular monolith to combine the operational simplicity of a single deployable unit with strict domain boundary isolation.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β NestJS App β
β β
β ββββββββββββ ββββββββββββ ββββββββββββ β
β β Tenants β β Usage β β Billing β ...more β
β β Module β β Module β β Module β modules β
β ββββββ¬ββββββ βββββββ¬βββββ βββββββ¬βββββ β
β β β β β
β ββββββΌββββββββββββββΌβββββββββββββΌββββββ β
β β Prisma (PostgreSQL) β β
β βββββββββββββββββββββββββββββββββββββββ β
β β β β β
β ββββββΌβββ βββββββΌββββ ββββββΌβββ β
β β Redis β β Kafka β β Cron β β
β βββββββββ βββββββββββ βββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Domain | Technology | Purpose |
|---|---|---|
| Backend | NestJS 11 | Modular application framework |
| Language | TypeScript 6.0 | Type-safe business logic |
| Database | PostgreSQL 18 + Prisma 7 | Data persistence & transactional outbox |
| Messaging | Apache Kafka 4.2 | Async event-driven processing |
| Caching | Redis 8 | Distributed caching & real-time quotas |
Learn more about our design decisions in the Architecture Overview.
π Live Docs: chitrank2050.github.io/meterplex
Deep-dive technical documentation is organized across:
- π Architecture Guides - Core design principles, ER diagrams, and data flow.
- π οΈ Development Guide - Custom configuration, local troubleshooting, and code conventions.
- π‘ API Reference - Request/Response structures and routing details.
- π Release & Changelog - Git hygiene, conventional commits, and automated release pipelines.
Meterplex is licensed under the MIT License.
β If you use Meterplex in your project, a star or credit is appreciated.
β€οΈ Developed by Chitrank Agnihotri
