This project is a backend implementation of a distributed stock trading simulator. It consists of several services that interact to simulate real-time stock trading, where users can place buy and sell orders and get updates on stock prices in real-time.
Components:
User Service: Handles user registration and login.
Trading Service: Handles buying and selling of stocks, interacting with user portfolios, and ensuring real-time stock price updates.
Stock Service: Publishes random stock price updates to a Kafka topic.
Middleware: JWT-based authentication to secure routes in the trading service.
Technologies Used
Golang: For building the services.
Kafka: For real-time message streaming of stock prices.
Redis: For caching stock prices.
PostgreSQL: For persisting user data, orders, and portfolios.
Docker: To containerize the services.
JWT: For user authentication.
Getting Started
Prerequisites
Docker and Docker Compose
Golang
Kafka
Redis
PostgreSQL
Setting up the Project
Clone the repository:
git clone https://github.com/JorkDev/stock-trading-simulator
cd stock_trading_simulator
Run the services using Docker Compose:
Ensure that Kafka, Redis, and PostgreSQL are running in containers:
docker-compose up -d
Set up the environment:
In each service directory (user-service, trading-service, and stock-service), initialize Go modules: