Credits

Set up, configure, and run the Reloop credits microservice locally.

Complete Base Setup First

Ensure you've finished the Setup — before proceeding.

Service Overview

Subscription tiers, credit balances, usage tracking, and Stripe billing integration.

PropertyValue
Directoryapps/backend/credits
Port8023
Local URLhttps://local.reloop.sh/api/credits
Swagger UIhttps://local.reloop.sh/api/credits/openapi
StackElysiaJS PostgreSQL NATS

Quick Start

Run from the monorepo root:

bun be:credits:dev

The service starts with hot reloading on port 8023.

Environment Configuration

Variables live in apps/backend/credits/.env. Running bun env:setup from the root auto-populates this file.

PORT=8023
NODE_ENV=development
INITIAL_CREDITS=100
NATS_URL=nats://localhost:4222

Reference Table

VariableRequiredDefault
PORTYES8023
INITIAL_CREDITSYES100
NATS_URLYESnats://localhost:4222

Development Commands

CommandDescription
bun be:credits:devStart dev server with hot reloading
bun run --filter=credits buildCompile production bundle
bun run --filter=credits startRun compiled production build
bun run --filter=credits check-typesTypeScript type-check

Architecture

LayerDetail
CreditsTracks balances and blocks sends when credits reach zero.
StripeManages subscriptions, invoices, and billing webhooks.
EventsPublishes billing.quota-warning and related NATS subjects.
Schemaplan, subscription, credit_ledger in packages/db/src/schema/billing.ts.

Was this page helpful?

Edit this page