WEB ATELIER (UDIT) Β· Learning by doing, with theory, practice and shared reflection

Deployment: Shipping to the World

Draft

URL: https://ruvebal.github.io/web-atelier-udit/lessons/en/react/react-deployment/

πŸ“‹ Table of Contents

β€œ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

# 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.”