Acctz Ledger
Acctz Ledger is the financial data layer of the Acctz platform — a PostgreSQL-backed general ledger and book of record with double-entry accounting, multi-tenant isolation, and a Node.js REST API.
Overview
The ledger provides:
- Double-entry bookkeeping with append-only journal entries
- Bank feed integration for transaction imports
- Reconciliation workflows with period locking
- Financial reporting (P&L, Balance Sheet, Trial Balance)
- Full audit trail for compliance and traceability
- Real-time UI updates via a PostgreSQL → Firestore sync service
Project Structure
The ledger spans three repos:
repos/
├── db/ # PostgreSQL schema — Flyway migrations, Docker Compose
├── node/ # Node.js/Fastify REST API and Firestore sync service
└── core/ # Shared TypeScript models and utilities
See the workspace guide for how to clone and build all repos together.
Architecture Principles
- PostgreSQL as source of truth — all writes originate here
- Append-only financial data — corrections are new entries, never edits
- Single transactional system of record — ACID guarantees for double-entry integrity
- Strong tenant isolation — Row Level Security enforced at the database engine level
- Explicit auditability — immutable audit log, append-only by trigger and permission
- Real-time reads via Firestore — sync service keeps the UI read layer current
Quick Start
tip
If you have the workspace scripts set up, these two commands do everything:
acctz start # starts PostgreSQL and pgAdmin
acctz create-db # runs Flyway migrations and seeds from Firestore
See the workspace scripts guide for setup instructions.
Prerequisites
- Docker & Docker Compose
Step by Step
# 1. Start PostgreSQL and pgAdmin
acctz start
# 2. Run Flyway migrations and seed from Firestore
acctz create-db
# 3. Start the Node.js REST API and sync service
cd node
npm run start
Access Points
| Service | URL |
|---|---|
| Node.js REST API | http://localhost:3000 |
| pgAdmin | http://localhost:5050 |
Database
PostgreSQL 18 with four domain schemas (iam, ledger, banking, audit), UUIDv7 primary keys, Row Level Security for tenant isolation, and Flyway-managed migrations. See the Schema Design page for the full ERD, Firebase integration flow, RBAC model, and setup instructions.
Further Reading
- Architecture Plan - Backend architecture and design principles
- Schema Design - PostgreSQL schema, multi-tenancy, UUIDv7, Firebase integration
- Book of Record - Double-entry accounting concepts
- Feature Breakdown - Comprehensive feature list