Deploying the Frontend
The frontend application is deployed on Vercel for optimal performance and seamless continuous deployment.
Vercel Deployment
Prerequisites
- A Vercel account
- Access to the project repository
- Environment variables ready
Environment Variables
Configure this environment variable in your Vercel project settings:
REACT_APP_API_URL=your_backend_api_url
Note: All environment variables in React must be prefixed with REACT_APP_ to be accessible in the application.
Deployment Process
- Connect your GitHub repository to Vercel
- Vercel will automatically detect the React application
- Configure your environment variable in the Vercel dashboard
- Deploy!
Automatic Deployments
- Pushes to
maintrigger production deployments - Pull requests create preview deployments
- Failed builds block merging to main
Continuous Integration
GitHub Actions Workflow
The repository includes a comprehensive linting and style checking workflow:
name: Lint and Style Check
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
lint:
name: Run Linters and Formatters
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Check component file extensions
run: |
# Validates .jsx extension usage
# Details in the File Naming section below
- name: Run ESLint
run: npm run lint
- name: Check Prettier formatting
run: npm run format:check
- name: Verify import sorting
run: npm run check-imports
Code Quality Checks
The CI pipeline enforces:
-
File Extension Rules
- Files containing JSX must use
.jsxextension - Exceptions for:
- Test files (
*.test.js) - Style files (
styles.js,*.styles.js) - Utility files (
utils/*) - Hook files (
hooks/*) - Constants (
constants.js)
- Test files (
- Files containing JSX must use
-
Code Style
- ESLint rules enforcement
- Prettier formatting validation
- Import statement ordering
-
Build Verification
- Ensures the application builds successfully
- Checks for TypeScript errors
- Validates all dependencies are properly resolved
Monitoring
- View deployment logs in Vercel dashboard
- Monitor application performance with Vercel Analytics
- Track build status in GitHub Actions
Troubleshooting
Common deployment issues:
-
Environment Variables
- Missing
REACT_APP_prefix - Incorrect API URL format
- Environment variables not set in Vercel
- Missing
-
Build Failures
- Dependency installation errors
- Linting/formatting violations
- Invalid JSX file extensions
-
Runtime Issues
- CORS configuration
- API connectivity problems
- Asset loading errors
Rolling Back
To revert to a previous version:
- Go to your project on Vercel
- Navigate to Deployments
- Locate the desired previous deployment
- Click "Promote to Production"
Production Optimization
- Build Command
npm run build
- Output
- Creates optimized production build in
build/ - Minifies all JavaScript and CSS
- Optimizes static assets
- Performance Considerations
- Enable gzip compression
- Implement code splitting
- Optimize asset loading
- Configure proper caching headers