|
| 1 | +# PayLedger |
| 2 | + |
| 3 | +PayLedger is a portfolio-grade simulated digital-wallet and merchant-payment |
| 4 | +platform. It is intentionally not a real-money processor: it must not collect |
| 5 | +real card data, real KYC documents, production secrets, or customer credentials. |
| 6 | + |
| 7 | +The project demonstrates a Spring Boot modular monolith with PostgreSQL, |
| 8 | +Flyway, Keycloak-compatible JWT security, immutable double-entry accounting, |
| 9 | +wallet holds, merchant payments, settlement, reconciliation, operations |
| 10 | +workflows, audit/outbox foundations, a TypeScript frontend, and containerized |
| 11 | +deployment assets. |
| 12 | + |
| 13 | +## What It Shows |
| 14 | + |
| 15 | +- Authenticated customer wallet APIs with server-side ownership checks. |
| 16 | +- Mock KYC and wallet lifecycle controls enforced before money movement. |
| 17 | +- Ledger-backed wallet transfers with idempotency and source-account locking. |
| 18 | +- Available-balance holds for payment authorization. |
| 19 | +- Capture, refund, merchant settlement, and reconciliation workflows. |
| 20 | +- Operations APIs for KYC, wallet, merchant, payment, settlement, and audit |
| 21 | + review. |
| 22 | +- Append-only audit events and transactional outbox records. |
| 23 | +- Actuator health and Prometheus-compatible business metrics. |
| 24 | +- CI for backend tests, frontend build/test/audit, and backend container build. |
| 25 | + |
| 26 | +## Repository Layout |
| 27 | + |
| 28 | +```text |
| 29 | +backend/ Spring Boot API, Java 21, Maven wrapper |
| 30 | +frontend/ TypeScript/Vite PayLedger UI |
| 31 | +infra/compose/ Local and production-oriented Docker Compose files |
| 32 | +docs/ Architecture, API, threat model, ADRs, runbooks |
| 33 | +.github/workflows/ci.yml Backend, frontend, and container CI |
| 34 | +``` |
| 35 | + |
| 36 | +## Local Development |
| 37 | + |
| 38 | +Start the local infrastructure: |
| 39 | + |
| 40 | +```bash |
| 41 | +docker compose -f infra/compose/compose.yaml up -d |
| 42 | +``` |
| 43 | + |
| 44 | +Run the backend test suite: |
| 45 | + |
| 46 | +```bash |
| 47 | +cd backend |
| 48 | +./mvnw test |
| 49 | +``` |
| 50 | + |
| 51 | +Run the frontend: |
| 52 | + |
| 53 | +```bash |
| 54 | +cd frontend |
| 55 | +npm ci |
| 56 | +npm run dev |
| 57 | +``` |
| 58 | + |
| 59 | +The API listens on `18080`, local Keycloak on `18081`, and local PostgreSQL on |
| 60 | +host port `55433`. |
| 61 | + |
| 62 | +## Production-Style Container Check |
| 63 | + |
| 64 | +Build the backend image: |
| 65 | + |
| 66 | +```bash |
| 67 | +docker build -t payledger-api:local backend |
| 68 | +``` |
| 69 | + |
| 70 | +Review the production Compose topology: |
| 71 | + |
| 72 | +```bash |
| 73 | +docker compose --env-file infra/compose/production.env.example \ |
| 74 | + -f infra/compose/compose.prod.yaml config |
| 75 | +``` |
| 76 | + |
| 77 | +The production Compose path runs Flyway in the one-shot `backend-migrate` |
| 78 | +container and starts the API containers with Flyway disabled. |
| 79 | + |
| 80 | +## Demo Path |
| 81 | + |
| 82 | +Use [docs/demo-workflow.md](docs/demo-workflow.md) for a guided walkthrough. |
| 83 | +The scripted scenario covers customer onboarding, KYC approval, wallet funding, |
| 84 | +transfer, payment authorization, capture, refund, settlement, reconciliation |
| 85 | +discrepancy, and operations review. |
| 86 | + |
| 87 | +## Core Documentation |
| 88 | + |
| 89 | +- [Architecture](docs/architecture.md) |
| 90 | +- [API guide](docs/api-guide.md) |
| 91 | +- [API standards](docs/api-standards.md) |
| 92 | +- [Data model](docs/data-model.md) |
| 93 | +- [Development workflow](docs/development-workflow.md) |
| 94 | +- [Deployment runbook](docs/deployment-runbook.md) |
| 95 | +- [Threat model](docs/threat-model.md) |
| 96 | +- [Domain glossary](docs/domain-glossary.md) |
| 97 | +- [ADR index](docs/adr/README.md) |
| 98 | + |
| 99 | +## Safety Boundaries |
| 100 | + |
| 101 | +- Money is persisted as integer minor units, never floating point. |
| 102 | +- Wallet balances are derived from immutable ledger postings. |
| 103 | +- Money movement creates balanced double-entry journals. |
| 104 | +- Financial corrections use reversal/correction entries, not posting edits. |
| 105 | +- External or retriable money-moving commands are idempotent. |
| 106 | +- Customer ownership is derived from JWT `sub` through `customer_identities`. |
| 107 | +- Development credentials are placeholders and must not be used in production. |
0 commit comments