Skip to main content

Infra Basics

Fullstack Dev Environment

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
beginner

HTML, CSS, JS Crash Course

3-4 hours
video
beginner

DOM Manipulation Tutorial

1-2 hours

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:

  1. Build a simple HTML form for user input.
  2. Use JavaScript to handle form submission.
  3. Display mock results dynamically using DOM manipulation.

2. Serving AI with FastAPI

Core Concepts

video
intermediate

FastAPI Full Course

4-6 hours

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:

  1. Create a FastAPI app with a prediction endpoint.
  2. Load your trained model once at startup.
  3. Connect your frontend from Module 1 to the API.

3. DevOps & Deployment

Core Concepts

tutorial
beginner

Docker 101

3-4 hours
video
beginner

SSH Practical Tutorial

1-2 hours
video
intermediate

SSH Concepts: How It Works Behind the Scenes

1-2 hours

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:

  1. Write a Dockerfile for your FastAPI app.
  2. Build and run the container locally.
  3. 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 CORSMiddleware to FastAPI.
  • Slow Predictions: Load models at startup, not per request.
  • Large Images: Use .dockerignore and slim base images.
  • Connection Issues: Check security groups and port mappings.