Fast Christmas is a high-performance, containerized microservice built to deliver real-time car price predictions through a robust FastAPI backend. The project demonstrates a full-lifecycle engineering approach, from an automated machine learning pipeline to secure, observable deployment in a microservices environment.
Automated ML Pipeline & Persistence: Developed a structured training workflow using Scikit-Learn pipelines, incorporating ColumnTransformer for automated numerical scaling and categorical encoding. The final Random Forest Regressor is persisted via joblib for seamless integration into the inference service.
Optimized API latency by implementing a Redis caching layer. The service intelligently caches prediction results based on input feature hashes, significantly reducing redundant compute cycles for recurring queries.
Architected a dual-layer security model utilizing JWT (JSON Web Tokens) for user session management and custom Header-based API Key validation for secure service-to-service communication.
Integrated a comprehensive monitoring suite using Prometheus and Grafana. The service exports real-time performance metrics via prometheus-fastapi-instrumentator and includes custom logging middleware to track request/response lifecycles.
Fully containerized using Docker and Docker Compose, orchestrating the API, Redis, Prometheus, and Grafana into a cohesive, scalable backend.
Implemented global exception handling and structured Pydantic data validation to ensure API stability and consistent error reporting (500-series handling).
Python 3.12, FastAPI, Pydantic, Uvicorn.
Scikit-Learn (Random Forest), Pandas, Joblib.
Redis (Caching), Docker, Docker Compose.
Prometheus, Grafana, Starlette Middleware.
Python-Jose (JWT), Dotenv.
git clone https://github.com/your-username/fastapi-project.git
cd fastapi-projectAPI_KEY=demo-key
JWT_SECRET_KEY=your-secret
REDIS_URL=redis://localhost:6379docker-compose up --build- FastAPI Docs: http://localhost:8000/docs
- FastAPI Metrics: http://localhost:8000/metrics
- Prometheus UI: http://localhost:9090
- Grafana UI: http://localhost:3000