Deployment: Shipping to the World
DraftURL: https://ruvebal.github.io/web-atelier-udit/lessons/en/react/react-deployment/
π Table of Contents
- π― Sprint Goal
- π Position in Journey
- π§ Learning Objectives
- ποΈ Deployment Architecture
- π§ Backend Connections
- π Methodology: Atelier Practice
- π Deployment Checklist
- π Sprint Deliverables
- π οΈ Quick Deployment Guide
- π Lesson Navigation
- π Key Concepts Preview
βCode that isnβt deployed doesnβt exist. Ship it.β
π― Sprint Goal
By the end of this sprint: Your app is live on the internet, automatically deployed on every push, with environment variables properly configured and a custom domain (optional).
π Position in Journey
| Sprint | Focus | Your App Grows |
|---|---|---|
| 11. Testing | Quality | Reliable codebase |
| 12. Performance | Speed | Optimized experience |
| β 13. Deployment | Launch | Live on the web |
| 14. Presentation | Demo | Showcase your work |
π§ Learning Objectives
By the end of this lesson, you will:
- Build a production-ready bundle with Vite
- Deploy to Vercel (or Netlify) from GitHub
- Configure environment variables securely
- Set up automatic deployments on push
- Configure preview deployments for PRs
- (Optional) Connect a custom domain
ποΈ Deployment Architecture
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β YOUR DEPLOYMENT PIPELINE β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β [GitHub Repository] β
β β β
β ββββΊ Push to main βββΊ Production Deploy β
β β β
β ββββΊ Pull Request βββΊ Preview Deploy β
β β
β [Vercel/Netlify] β
β β β
β ββββΊ Build (npm run build) β
β ββββΊ Test (optional: npm run test) β
β ββββΊ Deploy to CDN edge network β
β β
β [Your App] β Live at myapp.vercel.app β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π§ Backend Connections
| Your Backend | Deployment Considerations |
|---|---|
| Laravel API | Set VITE_API_URL to production API URL |
| Hygraph CMS | Add VITE_HYGRAPH_URL and auth token |
| Firebase | Configure Firebase project for production |
Environment Variables
# .env.local (development - NOT committed)
VITE_API_URL=http://localhost:8000/api
VITE_HYGRAPH_URL=https://api-us-west.hygraph.com/v2/xxx/master
# Vercel Dashboard (production - secure)
VITE_API_URL=https://api.yourapp.com
VITE_HYGRAPH_URL=https://api-us-west.hygraph.com/v2/xxx/master
β οΈ Important: VITE_ prefix = exposed to browser. Never put secrets here!
π Methodology: Atelier Practice
The Sprint Rhythm
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β DAY 1: First Deployment β
β β’ Build locally: npm run build β
β β’ Connect GitHub repo to Vercel β
β β’ Deploy! See your app live for the first time β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β DAY 2: Environment & CI β
β β’ Configure environment variables in Vercel β
β β’ Set up GitHub Actions for tests before deploy β
β β’ Test preview deployments on a PR β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β DAY 3: Polish & Share β
β β’ Fix any production-only bugs β
β β’ Add professional README with live link β
β β’ Share with classmates, gather feedback β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Deployment Checklist
Before Deploying
- All tests pass locally
- Build succeeds:
npm run build - No console errors in production build
- Environment variables documented
- Sensitive data NOT in code or public env vars
After Deploying
- App loads correctly at production URL
- All routes work (test deep links)
- API calls reach correct backend
- Auth flow works in production
- Lighthouse score acceptable
AI-Assisted Development Protocol
| Task | AI Role | Your Role |
|---|---|---|
| Debug build errors | Explain the error | Fix and retry |
| Configure env vars | Show best practices | Apply to your project |
| Write GitHub Actions | Draft workflow file | Customize for your stack |
| Fix production bugs | Suggest common causes | Debug and deploy fix |
π Sprint Deliverables
- Live URL for your app (e.g., yourapp.vercel.app)
- Automatic deploys on push to main
- Preview deploys enabled for PRs
- Environment variables configured properly
- GitHub Actions running tests before deploy
- README with live link and deploy status badge
- Reflection: What did you learn about production?
π οΈ Quick Deployment Guide
Vercel (Recommended)
# 1. Install Vercel CLI (optional)
npm i -g vercel
# 2. Deploy from CLI
vercel
# Or: Connect via dashboard
# β vercel.com β Import Git Repository β Select repo β Deploy
Netlify (Alternative)
# 1. Install Netlify CLI (optional)
npm i -g netlify-cli
# 2. Deploy from CLI
netlify deploy --prod
# Or: Connect via dashboard
# β app.netlify.com β Add new site β Import from Git
π Lesson Navigation
| Previous | Current | Next |
|---|---|---|
| Performance | Deployment | Final Presentation |
π Key Concepts Preview
Shipping is a discipline (not a button)
- Build artifacts are different from source code.
- Environments (dev/staging/prod) must be separated.
- Secrets must never be committed.
- Rollback is part of βdoneβ.
Deployment baseline (student projects)
- Production build (
vite build) - Hosted on Vercel/Netlify (or equivalent)
- Environment variables configured
- One CI check (lint/typecheck/tests) before βgreen deployβ
Reflection (Atelier)
π What failed only after deployment (CORS, env vars, base paths, caching)?
π What βinvisible workβ did you underestimate (docs, secrets, CI)?
Koan
βIf it only runs on your laptop, it does not yet run.β
βDeploy early, deploy often. Every deployment teaches you something new.β