Production-ready FastAPI service — real-time NLP sentiment analysis with caching, monitoring, and full CI/CD automation.
A production-ready REST API that analyzes movie reviews and classifies sentiment as positive, negative, or neutral — built with real-world DevOps practices: containerization, caching, observability, and automated CI/CD.
| Layer | Technology |
|---|---|
| Framework | FastAPI + Gunicorn + Uvicorn |
| Sentiment Engine | TextBlob (NLP) |
| Caching | Redis |
| Monitoring | Prometheus |
| Containerization | Docker + Docker Swarm |
| CI/CD | GitHub Actions |
- Sentiment analysis — NLP-powered classification with confidence score
- Redis caching — repeated requests served instantly without recomputation
- Prometheus metrics —
/metricsendpoint for real-time observability - Health check —
/healthendpoint for container reliability and orchestration - Fully Dockerized — production-ready with Gunicorn multi-worker setup
- Automated CI pipeline — test → build → push on every commit
| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
Root info |
GET |
/health |
Health check |
GET |
/metrics |
Prometheus metrics |
POST |
/analyze |
Analyze movie review sentiment |
Request
POST /analyze
{
"text": "This movie was amazing!",
"movie_name": "Avengers"
}Response
{
"movie_name": "Avengers",
"text": "This movie was amazing!",
"sentiment": "positive",
"score": 0.91,
"confidence": 91.0
}# Build image
docker build -t movie-api .
# Run container
docker run -p 8000:8000 movie-apiAPI will be available at http://localhost:8000
Push → GitHub Actions → Test → Build Docker Image → Push to Docker Hub
Every push to main triggers:
- Automated test suite
- Docker image build
- Push to Docker Hub registry
User → FastAPI → Redis (Cache) → Sentiment Logic → Response
↓
Prometheus Metrics
Live Swagger Docs: https://raj-spy.github.io/Movie-api/
# Create virtual environment
python3 -m venv venv
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Start server
uvicorn app.main:app --reloadRaj Tayde
- GitHub: @Raj-spy
- Live Project: LLM Drift Monitor