0–5 min
Real Hook
5–25 min
Core Concept
25–45 min
Live Coding
45–55 min
You Code It
55–60 min
Cheat Sheet
🔥 Real-World Hook (0–5 min)

A senior developer once said: "A model that isn't deployed doesn't exist." You can have the world's best AI — if it's sitting on your laptop, it helps nobody.

Deployment used to need a DevOps team. Railway changed that: connect your GitHub repo, set env vars, deploy in 3 minutes. Used by thousands of startups in India.

📈 The Deployment Checklist (5–25 min)

⚠ Never Commit Secrets

Your GROQ_API_KEY must NEVER go into Git. Use .env locally + Railway's env vars panel in production. Add .env to .gitignore before your first commit.

💻 Live Demo — Deploy FastAPI to Railway (25–45 min)

># File structure for deployment
ai-sentiment-api/
├── main.py           # FastAPI app
├── requirements.txt  # pip freeze > requirements.txt
├── Procfile          # tells Railway how to start
├── .env              # local secrets (NEVER commit)
└── .gitignore        # must contain .env
># Procfile — one line, no file extension
web: uvicorn main:app --host 0.0.0.0 --port $PORT
># requirements.txt
fastapi==0.111.0
uvicorn==0.30.1
scikit-learn==1.5.0
groq==0.9.0
langchain==0.2.5
langchain-groq==0.1.6
># .gitignore
.env
__pycache__/
*.pyc
*.pkl
venv/
.DS_Store
># Step-by-step Railway deploy

# 1. Push to GitHub
git init
git add .
git commit -m "feat: add sentiment API"
git remote add origin https://github.com/yourname/ai-sentiment-api.git
git push -u origin main

# 2. Go to railway.app → New Project → Deploy from GitHub
# 3. Set environment variables in Railway dashboard:
#    GROQ_API_KEY = your_key_here
# 4. Railway auto-detects Procfile and deploys!

# 5. Test your live API
curl -X POST https://your-app.railway.app/predict      -H "Content-Type: application/json"      -d "{"text": "Amazing product, very happy!"}"
💡 Docker (Optional but Powerful)

A Dockerfile packages your app + Python + dependencies into a container that runs identically anywhere — dev laptop, Railway, AWS, GCP. Railway can auto-detect a Dockerfile if you provide one.

># Dockerfile
FROM python:3.12-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 8000
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]

📋 You Code It (45–55 min)

✍ Task

Add a GET / root endpoint returning {"message": "AI API is running", "version": "1.0"}. Deploy to Railway. Share the live URL with your cohort.

⚡ Day 14 Cheat Sheet

Procfile
Start command for Railway
--host 0.0.0.0 --port $PORT
Listen on Railway's assigned port
os.getenv("GROQ_API_KEY")
Read secret from env
.gitignore: .env
Never commit secrets
pip freeze > requirements.txt
Lock dependencies
FROM python:3.12-slim
Minimal Docker base image
docker build -t app .
Build image locally
docker run -p 8000:8000 app
Run container locally