Skip to content

Latest commit

 

History

History
199 lines (145 loc) · 3.86 KB

File metadata and controls

199 lines (145 loc) · 3.86 KB

Quick Start Guide

Get the SynthoraAI Realtime Stream Processor running in 5 minutes!

Prerequisites

  • Docker and Docker Compose installed
  • Git installed
  • (Optional) Go 1.21+ for local development

1. Clone and Setup

# Clone the repository
git clone https://github.com/SynthoraAI-AI-News-Content-Curator/Realtime-Stream-Processor.git
cd Realtime-Stream-Processor

# Copy environment file
cp .env.example .env

2. Configure Environment

Edit .env and add your API keys:

# Required
GOOGLE_AI_API_KEY=your_google_ai_api_key_here

# Optional (for NewsAPI integration)
NEWS_API_KEY=your_news_api_key_here

3. Start Services

# Start all services with Docker Compose
docker-compose up -d

# Check if services are running
docker-compose ps

4. Verify Installation

# Check health
curl http://localhost:8080/health

# Expected output:
# {
#   "status": "healthy",
#   "timestamp": "2025-11-16T20:00:00Z",
#   ...
# }

5. Test Real-Time Features

WebSocket Connection

// In browser console or Node.js
const ws = new WebSocket('ws://localhost:8080/ws');

ws.onmessage = (event) => {
  const article = JSON.parse(event.data);
  console.log('New article:', article);
};

ws.send(JSON.stringify({
  action: 'subscribe',
  topics: ['government', 'politics']
}));

REST API

# List articles
curl http://localhost:8080/api/v1/articles?limit=5

# Stream a new article
curl -X POST http://localhost:8080/api/v1/stream \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Breaking: Important Government Announcement",
    "content": "Full article content...",
    "url": "https://example.com/article",
    "source": "test-source",
    "priority": "high",
    "published_at": "2025-11-16T20:00:00Z"
  }'

GraphQL Playground

Open http://localhost:8080/playground in your browser and try:

query {
  recentArticles(limit: 5) {
    id
    title
    summary
    source
    topics
    publishedAt
  }
}

6. Monitor Services

7. View Logs

# All services
docker-compose logs -f

# Stream processor only
docker-compose logs -f stream-processor

# Last 100 lines
docker-compose logs --tail=100 stream-processor

8. Stop Services

# Stop all services
docker-compose down

# Stop and remove volumes (clean slate)
docker-compose down -v

Next Steps

  • Production Deployment: See README.md for Kubernetes deployment
  • Configuration: Customize config.yaml for your needs
  • Integration: Connect to your existing SynthoraAI backend
  • Monitoring: Set up alerts in Prometheus
  • Development: See CONTRIBUTING.md to contribute

Troubleshooting

Services won't start

# Check service status
docker-compose ps

# View specific service logs
docker-compose logs <service-name>

# Restart a service
docker-compose restart <service-name>

MongoDB connection issues

# Check MongoDB logs
docker-compose logs mongodb

# Verify MongoDB is healthy
docker-compose exec mongodb mongosh --eval "db.adminCommand('ping')"

Redis connection issues

# Check Redis logs
docker-compose logs redis

# Test Redis connection
docker-compose exec redis redis-cli ping

AI API errors

  • Verify GOOGLE_AI_API_KEY is set correctly in .env
  • Check API quota and limits
  • Review logs: docker-compose logs stream-processor | grep "AI"

Support

Happy streaming! 🚀