# pradeepkundekar0101/probo architecture

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

- Interactive diagram: https://gitdiagram.com/pradeepkundekar0101/probo
- Repository: https://github.com/pradeepkundekar0101/probo

## Overview

##### Project Type and Purpose
- This project is a full-stack application using a microservices-like architecture. There are distinct user interfaces (the “web” and “admin-web” directories), a core API server (“api-server”), specialized processing services (“engine” and “db-worker”), and a real-time communications layer (“websocket”).
- The presence of market-related terminology such as “market”, “order”, “balance”, and “orderBook” in controllers and components suggests the platform is used for financial market or trading operations. Additionally, the integration of Kafka (in the engine and db-worker), Redis, and AWS indicates a robust, event-driven, and scalable design.

##### Analyzing the File Structure
- Frontend Applications:
– “admin-web” – Likely the administrative panel for managing the platform.
– “web” – The user (client) facing application.
– Both are built with React (TypeScript, as evidenced by .tsx files) and are structured with common design patterns (components, pages, hooks, routes, etc.).
- Backend Services:
– “api-server” – Implements RESTful controllers, routes, and middleware for core business logic and client requests.
– “engine” – Handles advanced processing such as market orders, balance calculations, and orchestrates messaging; it leverages Kafka for event-streaming.
– “db-worker” – Managed database tasks including running Prisma-based migrations and possibly background jobs.
– “websocket” – A dedicated service for real-time data delivery (e.g., order book updates), likely interfacing with the core backend.
- Ops Directory:
– Contains Kubernetes deployment and service manifests (YAML files) along with additional configuration files (like ingress, namespace, and IAM policies).
- Configuration & Utilities:
– Various configuration files (e.g., Dockerfile, docker-compose.yml, tsconfig.json) and utility folders for shared functions and type definitions.

a. Main Components to Include:
- Client Frontends:
- Admin UI (“admin-web”)
- User UI (“web”)
- Backend Components:
- API Server (“api-server”)
- Engine Service (“engine”)
- Database Worker (“db-worker”)
- WebSocket Service (“websocket”)
- Supporting Infrastructure:
- Database (likely a SQL database given Prisma usage)
- Message Broker (Kafka, as configured in “engine” and “db-worker”)
- Cache/Session Store (Redis, referenced in the engine)
- External Services (e.g., AWS integration mentioned in the API and engine services)
- Deployment Environment (containers orchestrated via Docker/Kubernetes with manifests in the “ops” directory)

b. Relationships and Interactions:
- Client frontends (admin and user interfaces) send requests to the API Server.
- The API Server handles authentication and routes client requests to the Engine Service or directly to the database, as needed.
- The Engine Service processes complex business logic (orders, balances, etc.), interacts with Kafka for messaging, utilizes Redis, and communicates with the database.
- The DB Worker performs routine database operations, such as executing Prisma migrations and handling database state changes.
- The WebSocket service establishes real-time communication channels with clients to stream live data (e.g., order books).

c. Architectural Patterns and Design Principles:
- Separation of Concerns: Each service (UI, API, processing engine, database worker, websocket) is isolated to handle a distinct set of responsibilities.
- Modular/Microservices Architecture: Individual services can be deployed and scaled independently.
- Event-Driven Communication: Kafka’s integration ensures that order events and similar triggers are processed reliably in an asynchronous manner.
- DevOps and Deployment Automation: The “ops” folder with YAML files signals a containerized deployment strategy managed by Kubernetes or a similar orchestration tool.

d. Relevant Technologies and Frameworks:
- Frontend: React with TypeScript, Vite, Tailwind CSS.
- Backend: Node.js/TypeScript, Express-like controllers and middleware, Prisma for ORM.
- Messaging: Kafka (producer/consumer implementations).
- Real-Time: WebSocket implementation for live updates.
- Infrastructure: Docker, Kubernetes (deployment manifests), possibly Redis and AWS services.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        adminUI("Admin UI"):::frontend
        userUI("User UI"):::frontend
    end

    %% Backend Services
    subgraph "Backend Services"
        apiServer("API Server"):::backend
        engineService("Engine Service"):::backend
        dbWorker("DB Worker"):::backend
        websocketService("WebSocket Service"):::backend
    end

    %% Infrastructure
    subgraph "Infrastructure"
        database("Database"):::database
        kafka("Kafka Broker"):::broker
        redis("Redis/Cache"):::cache
        aws("External Services (AWS)"):::external
        ops("Deployment & Operations"):::ops
    end

    %% Connections between Frontend and API
    adminUI -->|"sendsRequests"| apiServer
    userUI  -->|"sendsRequests"| apiServer

    %% API Server interactions
    apiServer -->|"delegatesLogic"| engineService
    apiServer -->|"directDBcalls"| database

    %% Engine Service interactions with Infrastructure
    engineService -->|"publishesSubscribes"| kafka
    engineService -->|"readsWrites"| database
    engineService -->|"cachesIn"| redis
    engineService -->|"integratesWith"| aws

    %% DB Worker interactions
    dbWorker -->|"processesEvents"| kafka
    dbWorker -->|"updatesDB"| database

    %% WebSocket Service interactions
    engineService -->|"streamsRealtimeData"| websocketService
    websocketService -->|"pushesUpdates"| userUI
    websocketService -->|"pushesUpdates"| adminUI

    %% Deployment and Ops interactions
    ops -->|"deploys"| apiServer
    ops -->|"deploys"| engineService
    ops -->|"deploys"| dbWorker
    ops -->|"deploys"| websocketService
    ops -->|"manages"| database
    ops -->|"manages"| kafka
    ops -->|"manages"| redis

    %% Click Events
    click adminUI "https://github.com/pradeepkundekar0101/probo/tree/main/admin-web"
    click userUI "https://github.com/pradeepkundekar0101/probo/tree/main/web"
    click apiServer "https://github.com/pradeepkundekar0101/probo/tree/main/api-server"
    click engineService "https://github.com/pradeepkundekar0101/probo/tree/main/engine"
    click dbWorker "https://github.com/pradeepkundekar0101/probo/tree/main/db-worker"
    click websocketService "https://github.com/pradeepkundekar0101/probo/tree/main/websocket"
    click ops "https://github.com/pradeepkundekar0101/probo/tree/main/ops"

    %% Styles
    classDef frontend fill:#FAD7A0,stroke:#333,stroke-width:2px;
    classDef backend fill:#AED6F1,stroke:#333,stroke-width:2px;
    classDef database fill:#F9E79F,stroke:#333,stroke-width:2px;
    classDef broker fill:#E8DAEF,stroke:#333,stroke-width:2px;
    classDef cache fill:#D5F5E3,stroke:#333,stroke-width:2px;
    classDef external fill:#F5B7B1,stroke:#333,stroke-width:2px;
    classDef ops fill:#E6B0AA,stroke:#333,stroke-width:2px;
```
