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
