beancounter

Project Url: monowai/beancounter
Introduction: Collection of services to compute and present financial positions
More: Author   ReportBugs   
Tags:

This service transforms financial transaction data into portfolio positions for valuation against market data.

Check out the demo stack.

Components

Quick Start

Prerequisites

  • Java 21
  • Gradle 8.14+
  • Docker (for containerized services)

Building the Project

Standard Build

Contract stubs flow between modules as regular Gradle artifacts (svc-data and svc-position expose a stubs configuration consumed by jar-client, jar-shell, svc-position and svc-event), so a plain build works from a clean checkout:

# Build everything (clean checkout OK)
./gradlew build

# Run all tests
./gradlew testAll

Individual Module Builds

# Build specific module (Gradle builds any stub producers it needs first)
./gradlew :jar-client:build
./gradlew :svc-data:build

Stub Management

# Optionally publish contract stubs to ~/.m2 (not required for building)
./gradlew publishStubs

Utility Tasks

# Clean all projects
./gradlew cleanAll

# Validate dependencies
./gradlew validateDependencies

# Format Kotlin code
./gradlew formatKotlin

# Lint Kotlin code
./gradlew lintKotlin

Project Structure

Core Libraries

  • jar-common: Shared utilities, models, and contracts
  • jar-auth: Authentication and authorization
  • jar-client: Client libraries for service communication
  • jar-shell: Command-line interface

Services

  • svc-data: Data persistence and market data services
  • svc-position: Portfolio position calculations
  • svc-event: Corporate event processing

Contract Testing

The project uses Spring Cloud Contract for contract testing with a hybrid approach:

  • Shared Context: Most tests share Spring context for ~4-6x faster execution
  • Isolated Context: Complex tests (like Kafka) use isolated contexts for reliability

See CONTRACT_TEST_ARCHITECTURE.md for detailed information.

Development

Running Tests

# Run all tests
./gradlew testSmart

# Run specific module tests
./gradlew :jar-client:test
./gradlew :svc-data:test

# Run with coverage
./gradlew testSmart jacocoTestReport

Code Quality

# Format code
./gradlew formatKotlin

# Lint code
./gradlew lintKotlin

# Check for issues
./gradlew check

Docker Builds

# Build Docker images
./gradlew :svc-data:bootBuildImage
./gradlew :svc-position:bootBuildImage
./gradlew :svc-event:bootBuildImage

CI/CD

The project uses CircleCI with optimized build pipelines:

  • build-and-test: Single ./gradlew build (stub ordering handled by Gradle)
  • package-*: Creates Docker images (main branch only)

See .circleci/config.yml for configuration details.

Apps
About Me
GitHub: Trinea
Facebook: Dev Tools
AI Daily Digest