Skip to content

jlagedo/core-ledger

Repository files navigation

image

Core Ledger

A comprehensive fund accounting ABOR (Accounting Book of Records) system for the Brazilian investment fund market. Implements Brazilian regulatory requirements (CVM 175, ANBIMA, etc.).

Overview

Core Ledger is an enterprise-grade monorepo containing:

  • Web Application - Angular 21 frontend with modern signals-based architecture
  • REST API - .NET 10 backend with Clean Architecture
  • Background Worker - .NET 10 service for async processing via RabbitMQ
  • ETL Pipeline - Meltano-based data integration for B3 financial instruments
  • E2E Tests - Playwright test suite with Brazilian financial test data

Project Structure

core-ledger/
├── apps/
│   ├── core-ledger-ui/        # Angular 21 frontend
│   ├── core-ledger-api/       # .NET 10 Web API
│   ├── core-ledger-worker/    # .NET 10 Background Worker
│   └── core-ledger-e2e/       # Playwright E2E tests
├── libs/
│   ├── api-client/            # Generated TypeScript API client (NSwag)
│   └── core-ledger-dotnet/    # Shared .NET libraries
│       ├── CoreLedger.Domain/
│       ├── CoreLedger.Application/
│       ├── CoreLedger.Infrastructure/
│       ├── CoreLedger.UnitTests/
│       └── CoreLedger.IntegrationTests/
├── tools/
│   └── etl/                   # Meltano ETL pipeline
├── docs/                      # Documentation
│   ├── aidebug/               # AI debugging research
│   ├── design-system/         # CSS/SCSS architecture
│   ├── specs/api/             # API specifications
│   ├── specs/ui/              # UI specifications
│   ├── testing/               # Testing documentation
│   ├── etl/                   # ETL documentation
│   └── compliance/            # Compliance documentation
├── CoreLedger.sln             # Root .NET solution
├── nx.json                    # Nx workspace configuration
└── package.json               # Root package.json

Quick Start

Prerequisites

  • Node.js >= 20.9.0
  • npm >= 11.6.2
  • .NET SDK 10.0
  • Docker (for infrastructure services)

1. Install Dependencies

npm install
dotnet restore CoreLedger.sln

2. Start Infrastructure

npm run docker:up
# Starts: PostgreSQL (5432), Redis (6379), RabbitMQ (5672/15672)

3. Run the Applications

# Terminal 1: Start the API
nx serve core-ledger-api

# Terminal 2: Start the UI
nx serve core-ledger-ui

# Open http://localhost:4200 (login: admin / any password)

Development Commands

Nx Commands (Recommended)

# Serve applications
nx serve core-ledger-ui              # Angular dev server (http://localhost:4200)
nx serve core-ledger-ui -c local-auth # With Auth0 authentication
nx serve core-ledger-api             # .NET API (http://localhost:5071)
nx serve core-ledger-worker          # .NET Worker

# Build
nx build core-ledger-ui              # Build Angular
nx build core-ledger-api             # Build .NET API
nx run-many -t build                 # Build all projects

# Test
nx test core-ledger-ui               # Angular unit tests (Vitest)
nx test core-ledger-dotnet           # .NET unit tests
nx e2e core-ledger-e2e               # Playwright E2E tests

# Utilities
nx graph                             # Visualize dependency graph
nx affected -t test                  # Test only affected projects

npm Scripts

npm start                    # Start Angular UI (mock auth)
npm run start:auth           # Start Angular UI (Auth0)
npm run start:api            # Start .NET API
npm run start:worker         # Start .NET Worker
npm run build                # Build all projects
npm run test                 # Test all projects
npm run lint                 # Lint all projects
npm run e2e                  # Run E2E tests
npm run db:migrate           # Run EF Core migrations
npm run docker:up            # Start infrastructure
npm run docker:down          # Stop infrastructure
npm run graph                # Visualize Nx dependency graph
npm run api:export-spec      # Export OpenAPI spec from running API
npm run api:generate-client  # Generate TypeScript API client

.NET Commands

dotnet build CoreLedger.sln
dotnet test CoreLedger.sln
nx run core-ledger-api:migrate       # Run EF Core migrations

Technology Stack

Component Technology
Frontend Angular 21, Bootstrap 5, NgRx Signals
Backend .NET 10, Entity Framework Core, MediatR
Database PostgreSQL 17
Cache Redis
Queue RabbitMQ
ETL Meltano, DBT, Python
Testing Vitest (UI), xUnit (.NET), Playwright (E2E)
Build Nx, Angular CLI, .NET CLI

Architecture

Dependency Graph

core-ledger-e2e → core-ledger-ui → api-client
                → core-ledger-api → core-ledger-dotnet

core-ledger-worker → core-ledger-dotnet

api-client → core-ledger-api (for OpenAPI spec generation)

.NET Clean Architecture

  • Domain - Pure business logic, no external dependencies
  • Application - Use cases with MediatR (CQRS), validators, DTOs
  • Infrastructure - EF Core, PostgreSQL, RabbitMQ integrations
  • API/Worker - Entry points consuming shared libraries

Database Schemas

cadastros  → Funds, assets, investors
carteira   → Operations, positions
passivo    → Investor movements
cota       → NAV, shares, closing
pricing    → Prices and indexes
audit      → Logs and history

API Client Generation

TypeScript API clients are auto-generated from the .NET API using NSwag:

# With API running (http://localhost:5071)
npm run api:export-spec      # Export OpenAPI spec
npm run api:generate-client  # Generate TypeScript client

Import generated clients in Angular:

import { FundosClient, CalendárioClient } from '@core-ledger/api-client';

See API Client Generation Guide for details.

Documentation

Detailed documentation is available in the /docs directory:

Claude Code Instructions

Each project has a CLAUDE.md file with AI-assisted development guidance:

ETL Pipeline

Process B3 financial instruments data:

cd tools/etl
meltano install
export TARGET_POSTGRES_PASSWORD=postgres
bash extract/preprocess_b3_instruments.sh && meltano run b3_instruments_pipeline

See ETL Documentation for details.

Contributing

  1. Create a feature branch from main
  2. Make changes following project code standards
  3. Run tests: npm run test && dotnet test CoreLedger.sln
  4. Submit a pull request

License

Proprietary - All rights reserved

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •