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

Your app works on localhost — but no one can use it. "It works on my machine" is the biggest joke in software.

Today you deploy your app so anyone in the world can open it from their phone. Frontend goes to Firebase Hosting (free, fast CDN). Backend goes to Google Cloud Run. By the end you'll have a real URL to share.

🌐 Deployment Architecture (5–20 min)

💡 Where Each Part Lives

Frontend HTML/CSS/JS → Firebase Hosting (free, global CDN)
Spring Boot API → Docker container → Google Cloud Run (pay per request)
MySQL Database → Google Cloud SQL or PlanetScale (managed database)

💻 Live Coding — Deploy Frontend to Firebase (20–40 min)

# Step 1: Install Firebase CLI
npm install -g firebase-tools

# Step 2: Login
firebase login

# Step 3: Initialize project
firebase init hosting

# Step 4: firebase.json config
{
  "hosting": {
    "public": "frontend",
    "ignore": ["firebase.json", "**/.*"],
    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]
  }
}
# Step 5: Build & Deploy
firebase deploy --only hosting

# Step 6: Dockerize Spring Boot backend
# Dockerfile
FROM openjdk:17-jdk-slim
WORKDIR /app
COPY target/*.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "app.jar"]
# Build and push to Google Container Registry
mvn clean package -DskipTests
docker build -t gcr.io/YOUR_PROJECT/student-api .
docker push gcr.io/YOUR_PROJECT/student-api

# Deploy to Cloud Run
gcloud run deploy student-api   --image gcr.io/YOUR_PROJECT/student-api   --platform managed   --region us-central1   --allow-unauthenticated
🎯 You Code It (40–55 min)
  1. Install Firebase CLI: npm install -g firebase-tools
  2. Run firebase login and authenticate with your Google account
  3. In your frontend folder, run firebase init hosting and select your project
  4. Update your frontend's API_BASE URL to your Cloud Run URL (or keep localhost for now)
  5. Run firebase deploy --only hosting
  6. Open the Firebase URL — your app is live!
  7. Show: Share the Firebase URL with the instructor

📄 Day 13 Cheat Sheet — Deployment

Firebase CLI

npm install -g firebase-toolsInstall
firebase loginAuthenticate
firebase init hostingSetup project
firebase deployDeploy all
firebase deploy --only hostingFrontend only
firebase open hosting:siteOpen deployed site

Docker Commands

docker build -t name .Build image
docker run -p 8080:8080 nameRun container
docker imagesList images
docker psRunning containers
docker push gcr.io/project/namePush to registry

Cloud Run

gcloud run deploy nameDeploy service
--image gcr.io/project/nameContainer image
--allow-unauthenticatedPublic access
--region asia-south1Mumbai region
gcloud run services listView services

application.properties (prod)

spring.datasource.url=${DB_URL}Env variable
spring.profiles.active=prodActivate profile
server.port=${PORT:8080}Cloud Run port
logging.level.root=WARNReduce log noise