How suksham-sharma/probo_v1 works
Main Components
• API Service: Located in the “api” directory, this Node.js/Express backend exposes REST endpoints (see routes for balance, order, orderbook, stocks, and user). It is likely responsible for handling client requests, coordinating with other microservices, and offering the gateway into the backend.
• Database Server (db-server): This component manages the PostgreSQL database (using Prisma ORM as indicated in the “prisma/schema.prisma” file and migration directories). It handles reliable data storage and also makes use of Redis for caching tasks.
• Engine Service: Found under the “engine” directory, the engine encapsulates the core business logic or trading algorithms. It includes integrations (such as with AWS, as seen from the “awsClient.ts”) and appears to be responsible for processing trades, managing task queues (via Redis), and possibly integrating with archival storage.
• WebSocket Server (ws): Housed in the “ws” directory, this service replaces traditional polling with a WebSocket-based approach to provide live, real-time updates to clients.
• Kubernetes Configurations: The “kube” directory contains YAML files that define deployments and services (e.g., for dbserver, engine, websocket server, ingress, Redis, etc.), indicating that the system is designed for dynamic, containerized deployment.
• External Services: Key external technologies include Redis (for caching, Pub/Sub, and asynchronous task processing), Amazon S3 (for durable archival storage), and PostgreSQL (for relational data storage).
Understand the Relationships and Interactions
• The API Service serves as the entry point for client applications. It interacts with both the Engine Service (for processing orders/trades) and the Database Server (for data persistence and retrieval).
• The Engine Service communicates with Redis for task queues and caching, while also interfacing with external services like Amazon S3 for archival storage.
• The WebSocket Service maintains persistent, bidirectional connections with clients, pushing real-time updates such as changes in order status or market data.
• The Database Server not only interacts with incoming queries but is also responsible for executing migrations (through Prisma) and potentially serving archived data.
• Kubernetes manifests suggest that all these services are containerized and orchestrated, enabling dynamic scaling and simplified deployment.
Architectural Patterns and Key Technologies
• Modular Design: Each service (API, Engine, DB, WS) is built as a self-contained module. This supports scalability and independent deployment.
• Asynchronous Task Processing: Redis is heavily utilized for background tasks, Pub/Sub messaging, and caching.
• Real-Time Interactions: The WebSocket service ensures low-latency communication with clients.
• Cloud Integration: Components such as Amazon S3 (and potentially AWS clients within the Engine) indicate the system’s integration with cloud services.
• DevOps and Containerization: Dockerfiles in each module and Kubernetes deployment files emphasize a cloud-native, containerized environment.