defiQUG 4f637ede8c Implement Phase 1a, 1b, 1c: Database, Auth, and API Endpoints
Phase 1a - Database Setup:
- Add PostgreSQL connection pooling with pg client
- Create 8 SQL migrations for all database schemas
- Implement migration execution system with tracking
- Add environment configuration for database and JWT settings

Phase 1b - Authentication & Authorization:
- Implement password hashing with bcrypt
- Create JWT token generation (access + refresh tokens)
- Implement RBAC with 5 roles (Admin, Manager, Analyst, Auditor, Viewer)
- Create auth middleware for authentication and authorization
- Add auth routes (login, register, refresh, logout, profile)

Phase 1c - API Endpoints (Full CRUD):
- Transaction endpoints with evaluation and batch processing
- Account management (treasury and subledger accounts)
- User management (admin-only)
- FX contract management
- Compliance endpoints (rules, results, thresholds)
- Reporting endpoints (summary, compliance, audit logs)
- Health check endpoints with database status

Phase 1d - Data Seeding:
- Create database seeding system with roles, permissions, users
- Add sample data (treasury accounts, FX contracts)
- Implement admin user creation from environment variables

All endpoints protected with authentication and role-based access control.
2026-01-23 18:48:59 -08:00

Brazil SWIFT Operations Platform

Regulator-grade cross-border payment rules engine and treasury management console compliant with Brazilian Banco Central (BCB) requirements, ISO 20022, and international AML/KYC standards.

Architecture

This is a monorepo built with:

  • pnpm workspaces for package management
  • Turborepo for build orchestration
  • TypeScript for type safety
  • React + Tailwind CSS for the frontend

Packages

  • packages/types - Shared TypeScript types and interfaces
  • packages/utils - Common utilities (currency, dates, validation, E&O)
  • packages/rules-engine - Brazil regulatory rules engine
  • packages/iso20022 - ISO 20022 message handling
  • packages/treasury - Treasury & subledger management
  • packages/risk-models - Capital, reserves, LCR stress allocation
  • packages/audit - Audit logging & compliance reporting
  • apps/web - React frontend application

Getting Started

Prerequisites

  • Node.js >= 18.0.0
  • pnpm >= 8.0.0

Installation

pnpm install

Development

pnpm dev

Build

pnpm build

Testing

pnpm test

Type Checking

pnpm type-check

Features

  • Brazil regulatory compliance (BCB requirements)
  • ISO 20022 message support (pacs.008, pacs.009, pain.001)
  • Multi-transaction batch processing
  • Treasury & subledger management
  • Risk, capital & liquidity stress allocation
  • AML & anti-structuring detection
  • IOF tax calculation
  • FX contract validation
  • Audit logging & compliance reporting
  • Errors & Omissions (E&O) +10% uplift

License

Private - Internal Use Only

Description
No description provided
Readme 404 KiB
Languages
TypeScript 98.8%
Shell 0.8%
CSS 0.2%
JavaScript 0.1%