# jimgreco/core architecture

> Architecture diagram of the GitHub repository jimgreco/core, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jimgreco/core
- Repository: https://github.com/jimgreco/core

## Overview

##### Project Type and Purpose
- This is not a traditional “full-stack” web application but rather a modular, high-performance trading system (F9 proprietary trading system).
- The system is divided into four main modules:
- buildSrc: Contains code generators and Gradle build scripts for binary encoders/decoders and FIX message support.
- infrastructure: Provides low-level, allocation-free utilities for asynchronous I/O, buffer processing, collections, logging, metrics, and other core utilities.
- platform: Implements the Sequencer architecture including core services like the command shell, bus communication (both in-process and over the network), FIX protocol handling, and various application-level functionalities.
- clob: A demo/trading core implementation that shows how to build a domain-specific trading application on top of the platform.
- The README also emphasizes a command shell architecture that processes commands from files or interactive sessions (Telnet, HTTP REST, WebSocket) which is the central operational paradigm.

##### File Structure to Identify Modules and Architectural Layers
- Top-level directories clearly correspond to the modules (buildSrc, infrastructure, platform, clob).
- Within each module, notice a logical separation:
- In buildSrc: There is separation between groovy and java code along with resource templates (for encoder/decoder templates).
- In infrastructure: There’s a detailed organization into packages like buffer, collections, command, encoding, I/O, logging, messages, metrics, and time utilities. This indicates a layered design where each area is handled by a dedicated component.
- In platform: The code is organized around core system functions such as activation, applications (printer, sequencer, refdata), bus (including several bus implementations like inproc and mold), FIX messaging, I/O (JSON/REST/WebSocket), and shell command processing.
- In clob: It provides a concrete usage example that ties domain-specific logic (trading operations) to the platform facilities.
- Notice supporting artifacts such as checkstyle, PMD configurations, Gradle scripts, and command files (e.g., clob.cmd, vm*.cmd) which support deployment and build processes.

##### Final Recommendations
- Aim for clarity—separate the system into as many distinct components as possible while ensuring their interconnections are easy to follow.
- Every component and dependency is clearly labeled.

Happy diagramming!

## Diagram (Mermaid)

```mermaid
graph TB
  %% External Libraries (side components)
  subgraph "External Libraries"
    agrona["Agrona Library"]
    eclipse["Eclipse Collections"]
  end

  %% Build Module (Code Generators)
  build["Code Generators (buildSrc)"]

  %% Infrastructure Layer (Foundation)
  subgraph "Infrastructure Layer"
    infra["Infrastructure Utilities (Async I/O, Buffers, Logging, Metrics)"]
  end

  %% Platform Services Layer (Core Services)
  subgraph "Platform Services Layer"
    pcore["Platform Core Services"]
    cs["Command Shell (File Loader, Interpreter, Registry)"]
    bus["Bus Communication (InProc, Mold, TCP)"]
    fix["FIX Processing Components"]
    pcore --> cs
    cs --> bus
    bus --> fix
  end

  %% Trading Application Layer (Demo/Trading Core)
  subgraph "Trading Application Layer"
    clob["Trading Application (Clob Demo)"]
  end

  %% Relationships
  build -->|"generates_code_for"| infra
  build -->|"generates_code_for"| pcore
  pcore -->|"depends_on"| infra
  clob -->|"leverages"| pcore
  agrona -->|"supports"| infra
  eclipse -->|"supports"| infra
  agrona -->|"supports"| pcore
  eclipse -->|"supports"| pcore

  %% Click Events
  click build "https://github.com/jimgreco/core/tree/main/buildSrc/src/main/java/com/core/schema"
  click infra "https://github.com/jimgreco/core/tree/main/infrastructure/src/main/java/com/core/infrastructure"
  click pcore "https://github.com/jimgreco/core/tree/main/platform/src/main/java/com/core/platform"
  click cs "https://github.com/jimgreco/core/tree/main/platform/src/main/java/com/core/platform/shell"
  click bus "https://github.com/jimgreco/core/tree/main/platform/src/main/java/com/core/platform/bus"
  click fix "https://github.com/jimgreco/core/tree/main/platform/src/main/java/com/core/platform/fix"
  click clob "https://github.com/jimgreco/core/tree/main/clob/src/main/java/com/core/clob"

  %% Styles
  classDef build fill:#f9f,stroke:#333,stroke-width:2px,color:#333;
  classDef infra fill:#ccf,stroke:#333,stroke-width:2px,color:#333;
  classDef platform fill:#cfc,stroke:#333,stroke-width:2px,color:#333;
  classDef clob fill:#fc9,stroke:#333,stroke-width:2px,color:#333;
  classDef external fill:#ffd,stroke:#333,stroke-width:2px,color:#333;
  
  class build build;
  class infra infra;
  class pcore,cs,bus,fix platform;
  class clob clob;
  class agrona,eclipse external;
```
