Tagline: An idempotent, immutable financial transaction engine.
LedgerOne is a senior-level engineering project demonstrating how to build a financial system that guarantees data integrity, concurrency control, and idempotency. It implements a strict double-entry accounting core where Sum(Debits) == Sum(Credits) is always enforced within SERIALIZABLE SQL transactions.
- Backend: NestJS (TypeScript), TypeORM
- Database: PostgreSQL (Strict ACID compliance)
- Frontend: Next.js, Tailwind CSS, Shadcn UI
- Testing: FastCheck (Property-based testing)
- Infrastructure: Docker Compose
- Double-Entry Core: Every transaction must be balanced.
- Idempotency:
Idempotency-Keyheader ensures safe retries. Requests with the same key return the cached response without re-processing. - Concurrency Control: Pessimistic locking and Serializable isolation level prevent race conditions (e.g., double spending).
- Audit Trail: Complete history of all financial movements (Immutable ledger).
- Docker & Docker Compose
- Node.js & pnpm
-
Install dependencies:
pnpm install
-
Start the database:
docker-compose up -d
-
Run migrations (Backend):
cd backend pnpm run migration:run cd ..
(Note: This happens automatically if
migrationsRun: trueis set in app module, but manual run is safer) -
Seed the database (Backend):
cd backend pnpm run seed cd ..
-
Start the application (Frontend + Backend):
pnpm dev
- Frontend: http://localhost:3000
- Backend API: http://localhost:3001
- Monorepo: Managed by pnpm workspaces.
- Strict Mode: The backend uses
SERIALIZABLEisolation validation to fail fast on concurrency conflicts. - Validation: Joi for env vars, Class-Validator for DTOs.