Finance API

typed-error rest api

Finance API — Backend Expense Tracker

A typed-error REST API for expenses, with two dates per entry and a duplicate guard.

role
solo developer
status
personal project
scale
31 endpoints · 5 routers
stack
Node.js · TypeScript · Express · MongoDB
type
personal · open source

FIG.01 // EXPENSE-TRACKER · WRITE PATH

A duplicate is a typed error, not a second row

Creating an expense runs a duplicate guard first. A match comes back as a typed 400 a client can branch on; a new expense keeps two dates so late entries don't distort reports.

A duplicate is a typed error, not a second row01 · POSTcreate expenseZod-validated02 · DUPLICATE GUARDsame user + amount ±60sTYPED 400, NOT SILENT03 · STOREexpenseDate + entryDatewhen spent · when recordedMATCH · 400EXPENSE_DUPLICATE_DETECTED04 · REPORTSfilter on expenseDateentryDate explains a gapno matchmatcha client can offer"yes, I meant it"

A typed-error REST API for personal expenses in Node and TypeScript. Each expense keeps two dates: when the money was spent and when it was entered, so late entries don't distort reports. A duplicate guard rejects the same amount from the same user within sixty seconds with a typed EXPENSE_DUPLICATE_DETECTED error rather than silently storing it twice. Every failure returns one of a fixed set of error codes. The 31 endpoints across five routers are documented in an OpenAPI spec.

screens