SentryFlow is a robust API monitoring and management system designed to help developers track, analyze, and optimize their API usage. It provides real-time metrics, rate limiting, authentication, and comprehensive logging to ensure your APIs are secure, performant, and reliable.
- API Key Management: Create, manage, and revoke API keys with fine-grained permissions
- Rate Limiting: Implement sliding window and token bucket rate limiting algorithms
- Real-time Monitoring: Track API usage, response times, and error rates in real-time
- User-specific Analytics: View metrics and usage patterns for individual users
- Comprehensive Logging: Log all API requests with detailed information for auditing and debugging
- Interactive Dashboard: Visualize API performance and usage through intuitive charts and graphs
- Alerts and Notifications: Get notified when API usage exceeds thresholds or errors occur
SentryFlow consists of three main components:
- Backend API Service: A FastAPI application that handles authentication, rate limiting, and request logging
- Analytics Aggregator: A service that consumes API logs from Kafka and aggregates metrics in ClickHouse
- Frontend Dashboard: A React application that visualizes API metrics and provides management interfaces
- Backend: FastAPI, SQLAlchemy, Redis, Kafka
- Analytics: ClickHouse, Kafka Consumers
- Frontend: React, Chart.js, Tailwind CSS
- Infrastructure: Docker, GitHub Actions
- Python 3.9+
- Node.js 16+
- PostgreSQL
- Redis
- Kafka
- ClickHouse
git clone https://github.com/yourusername/sentryflow.git
cd sentryflow# Create a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
cd backend
pip install -r requirements.txt
# Set up environment variables
cp .env.example .env
# Edit .env with your configuration
# Run migrations
alembic upgrade head
# Start the backend server
uvicorn main:app --reload# In a new terminal
cd aggregator
pip install -r requirements.txt
# Set up environment variables
cp .env.example .env
# Edit .env with your configuration
# Start the aggregator
python batch_consumer.py# In a new terminal
cd frontend
npm install
# Start the development server
npm startFor production deployment, you can use Docker Compose:
# Build and start all services
docker-compose up -d- Register a user account or log in to an existing account
- Navigate to the API Keys section
- Click "Create New API Key" and provide a name for the key
- Copy the generated API key (it will only be shown once)
- Go to the Rate Limit Monitor section
- Configure rate limits for specific endpoints
- Choose between sliding window or token bucket algorithms
- Set appropriate limits and time windows
- Visit the Dashboard to view overall metrics
- Use the User View to analyze specific user behavior
- Check the Logs Explorer for detailed request information
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request