← All projects

Ledger API

A small, production-shaped double-entry ledger API on AWS serverless, defined end to end in TypeScript with AWS CDK v2. API Gateway (HTTP API) → Lambda (Node.js, esbuild-bundled) → DynamoDB (single table).

TypeScript · AWS CDK · Lambda · DynamoDB

  • Money correctness. Integer minor units only (no floats), overflow-checked arithmetic, every transaction’s entries sum to zero, and customer accounts can never go negative.
  • Atomicity and idempotency. Each posting is one DynamoDB TransactWriteItems call. An Idempotency-Key header is required on writes: the same key and body replays the original result; the same key with a different body returns 409.
  • Reversals. A reversal posts the mirror-image entries, links to the original, and can happen exactly once.
  • Testing depth. Domain unit tests, handler tests, DynamoDB adapter tests (mocked SDK), property-based tests (fast-check) that run random sequences of transfers, reversals, and replays and check the books still balance, plus CDK assertion tests for the infrastructure.
  • Least privilege and keyless CI/CD. One Lambda and one hand-written IAM role per route, with no wildcards, no deletes, and no managed policies. GitHub Actions assumes an AWS role through GitHub OIDC; no AWS keys are stored anywhere. cdk-nag runs on every synth.

Stack

TypeScript · AWS CDK · Lambda · DynamoDB

Get in touch

Email is the best way to reach me.

glen@gmbxdigital.com