Docs

Kiralytics documentation

How to set up, use, and get the most out of Kiralytics.

An invoice in Kiralytics is more than a number. It's the smallest durable artefact that ties together: a client, a project, a list of work, a price, a tax treatment, a payment link.

This section covers how to make those things work for you.

The numbering scheme

Every invoice is numbered KLT-YYYYMM-NNNN:

  • KLT — fixed brand prefix
  • YYYYMM — year and month the invoice was allocated (not necessarily issued)
  • NNNN — four-digit counter per (owner, period), starting at 0001 each month

The counter is allocated atomically inside Postgres, so two near-simultaneous inserts cannot collide. The implementation lives in src/lib/server/invoice-number.ts.

When invoices are allocated vs. issued

You can:

  • Save a draft — gets a number, but doesn't appear on the share link or in PDFs
  • Issue — visible to clients via the public link
  • Re-save a draft — keeps the same number
  • Re-issue — same number, refreshed PDF

The first time you save, the number is allocated. There's no "ghost numbering" — drafts count toward your monthly counter. This avoids the surprise of editing a draft, then realizing you burned two numbers that you can't recover.

What's next