A scalable microservices-based - Git** - Version control with proper gitignore configuration
Getting Started monitoring and alert system built with Go, Apache Kafka, and PostgreSQL. The system tracks stock prices, analyzes market data, and sends real-time alerts to users based on their portfolio preferences.
This project implements a distributed stock alert system that:
- Monitors stock prices in real-time
- Analyzes portfolio performance and market trends
- Sends automated alerts based on user-defined criteria
- Provides scalable microservices architecture for high availability
The system follows a microservices architecture with event-driven communication:
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ API │ │ Alert │ │ Persistence │
│ Service │ │ Consumer │ │ Consumer │
└─────────────┘ └─────────────┘ └─────────────┘
│ │ │
└───────────────────┼───────────────────┘
│
┌─────────────┐
│ Apache │
│ Kafka │
└─────────────┘
│
┌─────────────┐
│ Analytics │
│ Consumer │
└─────────────┘
- Go 1.25.1 - Core application language
- Gin Framework - HTTP web framework for REST APIs
- GORM - ORM for database operations
- PostgreSQL - Primary database for data persistence
- Apache Kafka - Event streaming platform for real-time data processing
- Kafka Producers - For publishing stock events and user actions
- Kafka Consumers - For processing alerts, persistence, and analytics
- API Service - REST API for user interactions and portfolio management
- Alert Consumer - Processes and sends stock price alerts
- Persistence Consumer - Handles data storage and retrieval operations
- Analytics Consumer - Performs market analysis and trend calculations
- Docker - Containerization of all microservices
- Docker Compose - Local development environment orchestration
- GitHub Actions - CI/CD pipeline for automated testing and deployment
- Docker Hub - Container registry for image distribution
- Go Testing - Comprehensive unit test suite (28+ tests)
- Environment Configuration - Secure environment variable management
- Git - Version control with proper gitignore configuration
- Go 1.25.1 or higher
- Docker and Docker Compose
- PostgreSQL
- Apache Kafka
-
Clone the repository
git clone https://github.com/Anubhav200311/Real-Time-Stock-Alert.git cd Real-Time-Stock-Alert -
Set up environment variables
cp .env.example .env # Edit .env with your configuration: # - ALPHA_VANTAGE_API_KEY=your_api_key # - Database credentials # - Kafka broker configuration
-
Start infrastructure services --> Basically the Entire Project
docker-compose up --build -d
The project includes comprehensive test coverage:
# Run all tests
go test ./... -v
# Run specific package tests
go test ./models -v # Data model tests
go test ./services -v # Business logic tests
go test ./routes -v # API endpoint tests
go test ./db -v # Database testsPOST /users- Create new userGET /users- List all usersGET /users/:id/portfolio- Get user portfolio
POST /portfolio- Create/update portfolioGET /portfolio/:id- Get portfolio details
GET /stocks/:symbol- Get stock informationPOST /alerts- Create price alerts
The project uses GitHub Actions for automated CI/CD:
- Code Checkout - Latest code from main branch
- Go Setup - Configure Go 1.25.1 environment
- Dependency Caching - Cache Go modules for faster builds
- Testing - Run comprehensive test suite
- Build Verification - Compile all microservices
- Docker Build - Create optimized container images
- Registry Push - Publish to Docker Hub
- Automated staging deployment on main branch pushes
- Production-ready Docker images with multi-stage builds
- Environment-specific configuration management
- WebSocket Integration - Replace polling with real-time WebSocket connections for live price feeds
- Enhanced Error Handling - Implement circuit breakers and retry mechanisms
- Monitoring & Observability - Add Prometheus metrics and distributed tracing
- AI-Powered Analytics - Integrate machine learning models for:
- Predictive price analysis
- Market sentiment analysis
- Automated trading strategies
- Risk assessment algorithms
-
Kubernetes Orchestration - Migrate to Kubernetes for:
- Auto-scaling based on market volatility
- Rolling deployments with zero downtime
- Advanced service mesh with Istio
- Multi-region deployment capabilities
-
Advanced Features
- Real-time portfolio optimization
- Social trading and copy-trading features
- Integration with multiple stock exchanges
- Mobile application with push notifications
- Advanced charting and technical analysis tools
- Message Queue Optimization - Implement Kafka Streams for complex event processing
- Database Scaling - Add read replicas and implement database sharding
- Security Hardening - Implement OAuth 2.0, rate limiting, and API encryption
- Performance Optimization - Redis caching layer and CDN integration
System design targets and expectations:
- Designed to handle high concurrent user loads through microservices architecture
- Event-driven processing with Kafka enables scalable message throughput
- Asynchronous alert processing for responsive user experience
- Containerized deployment ready for horizontal scaling
Note: Performance benchmarks will be established during production deployment and load testing phases.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Alpha Vantage API for real-time stock data
- Apache Kafka community for excellent event streaming platform
- Go community for robust ecosystem and libraries
Built with Go, Kafka, and Cloud-Native technologies