Deploying the DevTinder Frontend to Vercel or Netlify Static Hosting for React Apps
Learn how to deploy the DevTinder React frontend to Vercel or Netlify building the app, configuring environment variables, setting up custom domains, and connecting to the backend API.
Deploying the DevTinder Frontend to Vercel or Netlify
The DevTinder frontend is a React app that can be deployed to static hosting platforms like Vercel or Netlify. These platforms are optimized for frontend frameworks and offer free tiers for small projects.
Why Not Deploy Frontend on EC2?
You could serve the frontend build files from EC2 using Nginx, but using a dedicated frontend platform is better because:
- CDN Global edge network for fast loading worldwide
- Free SSL Automatic HTTPS certificates
- Easy deployments Git push to deploy
- Preview deployments Every PR gets a preview URL
- Optimized for React Build optimization, caching, compression
Deploying to Vercel
Step 1: Install Vercel CLI
npm install -g vercel
Step 2: Build the Frontend
cd devtinder-frontend npm run build
This creates a dist/ (Vite) or build/ (CRA) directory.
Step 3: Deploy
vercel
Follow the prompts:
- Set up and deploy: Y
- Project name: devtinder-frontend
- Framework preset: Vite (or Create React App)
- Build command: npm run build
- Output directory: dist (or build)
- Override? N
Step 4: Set Environment Variables
vercel env add VITE_API_URL # Enter: https://your-backend-domain.com/api vercel env add VITE_SOCKET_URL # Enter: https://your-backend-domain.com
Then redeploy:
vercel --prod
Step 5: Connect to Git (Optional)
For automatic deployments on git push:
- Go to https://vercel.com/dashboard
- Import your GitHub repository
- Vercel auto-detects Vite/CRA and configures the build
- Every push to main deploys to production
- Every PR gets a preview deployment
Deploying to Netlify
Step 1: Build the Frontend
cd devtinder-frontend npm run build
Step 2: Install Netlify CLI
npm install -g netlify-cli
Step 3: Deploy
netlify deploy
Follow the prompts:
- Create & configure new site: Y
- Team: Your team
- Site name: devtinder
- Publish directory: dist (or build)
Step 4: Set Environment Variables
Go to Netlify dashboard → Site settings → Environment variables:
VITE_API_URL=https://your-backend-domain.com/apiVITE_SOCKET_URL=https://your-backend-domain.com
Then redeploy:
netlify deploy --prod
Step 5: Connect to Git (Optional)
- Go to Netlify dashboard
- Add new site → Import from Git
- Choose your GitHub repository
- Configure build settings
- Every push to main deploys automatically
Connecting Frontend to Backend
After deploying both:
- Frontend URL: https://devtinder-frontend.vercel.app
- Backend URL: https://api.yourdomain.com (EC2 with Nginx + SSL)
Update frontend environment variables:
VITE_API_URL=https://api.yourdomain.com/api VITE_SOCKET_URL=https://api.yourdomain.com
Update backend CORS:
app.use(cors({ origin: "https://devtinder-frontend.vercel.app", credentials: true }));
Custom Domain
Both Vercel and Netlify allow custom domains:
- Buy a domain (e.g., from Namecheap, GoDaddy)
- Add a CNAME record pointing to your Vercel/Netlify URL
- Add the domain in the platform dashboard
- SSL is automatically provisioned
The Takeaway
Deploying the DevTinder frontend to Vercel or Netlify is straightforward: build the React app, install the CLI, deploy, set environment variables (API URL and Socket URL), and connect to Git for automatic deployments. These platforms provide CDN, free SSL, and preview deployments making them ideal for React apps.
Vercel and Netlify provide a global CDN for fast loading, free automatic SSL, git push to deploy, preview deployments for every PR, and build optimization. EC2 requires manual setup for all of these.
Install vercel CLI (npm install -g vercel), run npm run build in the frontend, then run vercel. Follow the prompts for project name, framework preset, build command, and output directory. Set environment variables with vercel env add, then deploy to production with vercel --prod.
Set VITE_API_URL to the backend domain (https://api.yourdomain.com/api) and VITE_SOCKET_URL to the backend domain in the frontend environment variables. Update the backend CORS to allow the frontend origin with credentials: true.
Go to vercel.com/dashboard, import your GitHub repository. Vercel auto-detects the framework and configures the build. Every push to the main branch deploys to production, and every PR gets a preview deployment with a unique URL.
Buy a domain, add a CNAME record in your DNS settings pointing to your Vercel/Netlify URL, then add the domain in the platform dashboard. SSL is automatically provisioned by the platform.
Ready to master Node.js completely?
Want to upskill yourself, crack your next interview, and get your dream job? Join our comprehensive course to dive deeper with high-quality video tutorials, solve interview questions, and a premium community.
Master Node.js
Want to upskill yourself, crack your next interview, and get your dream job? Join our comprehensive course.

