DIN 0815/S · PS-10
Number
One authority for gapless sequence numbers — invoice numbers, order refs, offer numbers, PO refs.
Gapless, per-period invoice numbering is a legal requirement in the DACH market, and it is a race condition waiting to happen. Modules ask this service for the next number in a scope instead of each re-implementing a careful counter. Allocation is a single atomic transaction, so concurrent callers never receive a duplicate and never skip a value. A scope’s format renders the number from tokens — {seq}, zero-padded {seq:0000}, {YYYY}, {YY}, {MM}, {DD} — and its period restarts the counter each year, month or day, or never.
Responsibilities
- Independent counters per scope (invoice, order, offer, purchase order…)
- Atomic allocation — no duplicates and no gaps under concurrency
- Token-based formatting, e.g. INV-{YYYY}-{seq:0000} → INV-2026-0001
- Period reset by year, month or day; gapless within the period
- A sensible default format auto-created for an unknown scope
API surface
- POST /api/next
- GET/POST /api/sequences · GET /api/sequences/:scope
- GET /api/health · GET /api/ready · GET /api/metrics
CONSUMED BY MOD-04 Invoice & Billing, MOD-13 Offers, MOD-06 Procurement, MOD-07 Storefront. A Platform Service never depends on a Business Module.