For: Webpage Quality Analyzer (WQA)
Date: October 11, 2025
Platforms: Vercel, Netlify, GitHub Pages
- ✅ Zero-config deployment for Vite projects
- ✅ Automatic HTTPS
- ✅ Edge network with fast WASM delivery
- ✅ Easy environment variable management
- ✅ Built-in analytics
- ✅ Supports custom headers (required for WASM)
npm i -g vercel{
"version": 2,
"buildCommand": "npm run build",
"outputDirectory": "dist",
"framework": "vite",
"headers": [
{
"source": "/(.*)",
"headers": [
{
"key": "Cross-Origin-Opener-Policy",
"value": "same-origin"
},
{
"key": "Cross-Origin-Embedder-Policy",
"value": "require-corp"
},
{
"key": "Cross-Origin-Resource-Policy",
"value": "cross-origin"
},
{
"key": "Cache-Control",
"value": "public, max-age=31536000, immutable"
}
]
},
{
"source": "/assets/(.*).wasm",
"headers": [
{
"key": "Content-Type",
"value": "application/wasm"
},
{
"key": "Cache-Control",
"value": "public, max-age=31536000, immutable"
}
]
}
],
"rewrites": [
{
"source": "/(.*)",
"destination": "/index.html"
}
],
"env": {
"VITE_CORS_PROXY": "https://api.allorigins.win/raw?url="
}
}# Login to Vercel
vercel login
# Deploy to preview
vercel
# Deploy to production
vercel --prodGo to: Project Settings → Environment Variables
Add:
VITE_CORS_PROXY=https://api.allorigins.win/raw?url=- (Optional)
NODE_ENV=production
- Go to Project Settings → Domains
- Add your custom domain
- Update DNS records as instructed
npm i -g netlify-cli[build]
command = "npm run build"
publish = "dist"
[build.environment]
NODE_VERSION = "20"
[[headers]]
for = "/*"
[headers.values]
Cross-Origin-Opener-Policy = "same-origin"
Cross-Origin-Embedder-Policy = "require-corp"
Cross-Origin-Resource-Policy = "cross-origin"
X-Content-Type-Options = "nosniff"
X-Frame-Options = "DENY"
X-XSS-Protection = "1; mode=block"
[[headers]]
for = "/*.wasm"
[headers.values]
Content-Type = "application/wasm"
Cache-Control = "public, max-age=31536000, immutable"
[[headers]]
for = "/assets/*"
[headers.values]
Cache-Control = "public, max-age=31536000, immutable"
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
[dev]
command = "npm run dev"
port = 5173
targetPort = 5173/*
Cross-Origin-Opener-Policy: same-origin
Cross-Origin-Embedder-Policy: require-corp
Cross-Origin-Resource-Policy: cross-origin
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
/*.wasm
Content-Type: application/wasm
Cache-Control: public, max-age=31536000, immutable
# Login to Netlify
netlify login
# Initialize project
netlify init
# Deploy to preview
netlify deploy
# Deploy to production
netlify deploy --prodGo to: Site Settings → Environment Variables
Add:
VITE_CORS_PROXY=https://api.allorigins.win/raw?url=
npm install --save-dev gh-pages{
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"predeploy": "npm run build",
"deploy": "gh-pages -d dist"
},
"homepage": "https://yourusername.github.io/WQA"
}export default defineConfig({
base: '/WQA/', // Your repo name
// ... rest of config
});npm run deploySince GitHub Pages doesn't support custom headers, you need to:
- Use Service Worker (Complex)
- Use meta tags (Limited):
<!-- In index.html --> <meta http-equiv="Cross-Origin-Opener-Policy" content="same-origin"> <meta http-equiv="Cross-Origin-Embedder-Policy" content="require-corp">
Recommendation: Use Vercel or Netlify instead of GitHub Pages.
{
"name": "webpage-quality-analyzer",
"version": "1.0.0",
"description": "React + WASM webpage quality analyzer with Halloween theme",
"author": "Your Name",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/yourusername/WQA"
},
"keywords": [
"webpage-analysis",
"quality-analyzer",
"wasm",
"react",
"vite"
]
}VITE_CORS_PROXY=https://api.allorigins.win/raw?url=
NODE_ENV=production# CORS Proxy URL (required for URL mode)
VITE_CORS_PROXY=https://api.allorigins.win/raw?url=
# Node environment
NODE_ENV=development# Environment variables
.env
.env.local
.env.production
# Build output
dist/
dist-ssr/
# Logs
*.log
# Dependencies
node_modules/
# IDE
.vscode/
.idea/
# OS
.DS_Store
Thumbs.db
# Vercel
.vercel
# Netlify
.netlify
npm run buildnpm run previewOpen: http://localhost:4173
Test Checklist:
- WASM loads successfully
- All 8 profiles work
- URL mode works (with CORS proxy)
- HTML paste mode works
- Configuration panel works
- Export/import works
- Results display correctly
- Mobile responsive
- No console errors
- Halloween theme renders correctly
Vercel: Automatic ✅
Netlify: Automatic ✅
Manual: Add to your server config
// public/sw.js
self.addEventListener('install', (event) => {
event.waitUntil(
caches.open('wqa-v1').then((cache) => {
return cache.addAll([
'/',
'/index.html',
'/assets/index.js',
'/assets/index.css',
]);
})
);
});
self.addEventListener('fetch', (event) => {
event.respondWith(
caches.match(event.request).then((response) => {
return response || fetch(event.request);
})
);
});Register in main.jsx:
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/sw.js');
}<!-- In index.html -->
<link rel="preload" href="/assets/webpage_quality_analyzer_bg.wasm" as="fetch" crossorigin="anonymous">Enable in Vercel dashboard:
- Project Settings → Analytics
- Add
@vercel/analyticspackage:
npm install @vercel/analytics// In main.jsx
import { Analytics } from '@vercel/analytics/react';
ReactDOM.createRoot(document.getElementById('root')).render(
<React.StrictMode>
<App />
<Analytics />
</React.StrictMode>
);npm install @sentry/react// In main.jsx
import * as Sentry from '@sentry/react';
Sentry.init({
dsn: 'your-sentry-dsn',
environment: import.meta.env.MODE,
tracesSampleRate: 0.1,
});
ReactDOM.createRoot(document.getElementById('root')).render(
<Sentry.ErrorBoundary fallback={<ErrorFallback />}>
<App />
</Sentry.ErrorBoundary>
);npm install react-ga4// In main.jsx
import ReactGA from 'react-ga4';
if (import.meta.env.PROD) {
ReactGA.initialize('G-XXXXXXXXXX');
}- HTTPS enabled (automatic on Vercel/Netlify)
- CORS headers configured
- Content-Security-Policy header (optional)
- X-Frame-Options: DENY
- X-Content-Type-Options: nosniff
- No API keys in client-side code
- Environment variables properly configured
- Dependencies up to date (
npm audit)
- Test all features on production URL
- Test on mobile devices (iPhone, Android)
- Test on different browsers (Chrome, Firefox, Safari, Edge)
- Verify WASM loads correctly
- Check CORS proxy works
- Verify all 8 profiles load
- Test error scenarios (invalid URL, timeout, etc.)
- Monitor error logs
- Check analytics for user behavior
- Verify performance metrics (Lighthouse)
- Test with real user feedback
- Monitor CORS proxy reliability
- Review error patterns
- Optimize based on usage data
- Address user-reported issues
- Consider A/B testing variants
- Check browser console for errors
- Verify CORS headers are set correctly
- Check WASM file is in
/assets/folder - Try clearing browser cache
- Verify
VITE_CORS_PROXYenvironment variable - Test proxy URL directly in browser
- Consider backup proxy:
https://corsproxy.io/? - Recommend HTML paste mode to users
- Check Node version (need 18+)
- Clear
node_modulesand reinstall:rm -rf node_modules package-lock.json && npm install - Check for TypeScript errors:
npm run lint - Verify all dependencies installed
- Check
vercel.jsonornetlify.tomlredirects - Verify build output directory is correct (
dist) - Check base path in
vite.config.js
Your deployment is successful when:
- ✅ WASM loads in <3 seconds
- ✅ Analysis completes in <500ms
- ✅ No console errors
- ✅ Mobile responsive (tested on iOS/Android)
- ✅ All 8 profiles work
- ✅ Error messages are user-friendly
- ✅ Lighthouse score >90
Last Updated: October 11, 2025
Platform: Vercel (recommended), Netlify (alternative)
Status: Ready to deploy