A minimal FastAPI portfolio website with a deployed Random Forest microservice. Built to demonstrate production ML serving, CI/CD, and containerization.
- Portfolio pages — Home, Projects, Resume, Blog, Contact
- Live ML Demo — Manufacturing Defect Prediction (Random Forest) via
/predict - Production patterns — FastAPI, Docker, and Google Cloud deployment
- FastAPI + Jinja2
- scikit-learn Random Forest
- Docker
- Google Compute Engine (Always Free)
# Create venv
python3 -m venv .venv
source .venv/bin/activate
# Install
pip install -r requirements.txt
# Train model
python ml/train_model.py
# Run locally
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000GET /— Home pageGET /projects— Projects pageGET /demo— ML demo pagePOST /predict— Defect prediction endpointGET /health— Health checkGET /api/projects— Projects JSON
-
Create an Ubuntu e2-micro VM in
us-west1,us-central1, orus-east1, and allow inbound HTTP traffic. -
SSH to the VM, then install Docker, Docker Compose, and Git:
sudo apt-get update sudo apt-get install -y docker.io docker-compose-v2 git sudo systemctl enable --now docker -
Clone this repository and start the app:
git clone https://github.com/Harshil411/portfolio.git cd portfolio sudo docker compose up -d --build -
Confirm the service is running at
http://YOUR_VM_IP/health.
The included compose.yaml restarts the portfolio after a VM reboot and serves HTTPS automatically when the configured hostname resolves to the VM. Keep the VM in the listed US regions and within the e2-micro/disk/egress free-tier limits.
Render remains available for simple managed deployments, but its free service tier spins down after inactivity.
Random Forest trained on 5,000 synthetic manufacturing sensor samples. Features: temperature, humidity, pressure, vibration, RPM. Accuracy ~0.88.
- Add blog post engine (Markdown-based)
- Add actual resume PDF download
- Add privacy-conscious analytics
- Add custom domain