Infra Basics

Goal
Bridge the gap between AI development and production. Learn to wrap models in APIs, create web interfaces, and deploy containerized applications.
Estimated Time Impact
12-17 hours total
Web Stack(5h)
FastAPI(5h)
Docker/DevOps(4.5h)
1. The Web Stack
Core Concepts
video
beginnerHTML, CSS, JS Crash Course
video
beginnerDOM Manipulation Tutorial
Understand the technologies that power web applications to build interfaces for your AI models.
Key Topics:
- HTML/CSS: Structure and styling of web pages.
- JavaScript: Interactivity and API calls.
- DOM: Dynamically updating content without page reloads.
Action Items:
- Build a simple HTML form for user input.
- Use JavaScript to handle form submission.
- Display mock results dynamically using DOM manipulation.
2. Serving AI with FastAPI
Core Concepts
video
intermediateFastAPI Full Course
Transform Python AI models into production-ready web services.
Key Topics:
- FastAPI: Endpoints, Path Operations, Pydantic Models.
- Integration: Loading models efficiently (startup event).
- CORS: Allowing frontend communication.
Action Items:
- Create a FastAPI app with a prediction endpoint.
- Load your trained model once at startup.
- Connect your frontend from Module 1 to the API.
3. DevOps & Deployment
Core Concepts
tutorial
beginnerDocker 101
video
beginnerSSH Practical Tutorial
video
intermediateSSH Concepts: How It Works Behind the Scenes
Package your application for consistency and deploy it to the cloud.
Key Topics:
- Docker: Containers, Dockerfiles, Docker Compose.
- SSH: Secure remote server management.
- Deployment: Cloud servers (DigitalOcean/AWS) vs. PaaS (Railway/Render).
Note: For deeper networking concepts essential for secure deployments, see the Systems & Networking module.
Action Items:
- Write a
Dockerfilefor your FastAPI app. - Build and run the container locally.
- Deploy to a cloud provider (e.g., DigitalOcean Droplet or Railway).
Dockerfile Example:
FROM python:3.10-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
Completion Checklist
- Build an HTML page with interactive JavaScript.
- Create a FastAPI app with Pydantic validation.
- Serve an AI model via HTTP API.
- Build and run a Docker container.
- Deploy to a cloud server (or PaaS).
Capstone Exercise: Build and deploy a complete AI app (Frontend + Backend + Docker).
Common Pitfalls
- CORS Errors: Add
CORSMiddlewareto FastAPI. - Slow Predictions: Load models at startup, not per request.
- Large Images: Use
.dockerignoreand slim base images. - Connection Issues: Check security groups and port mappings.