Complete guide for deploying the XAH Payroll frontend to Netlify.
Last Updated: 2026-01-07 Deployment Platform: Netlify Team: GOOD MONEY COLLECTIVE Deployer: Ghostrayu Branch: main
- Prerequisites
- Quick Deployment
- Configuration
- Environment Variables
- Build Settings
- Troubleshooting
- Post-Deployment
- ✅ Netlify account (linked to GitHub)
- ✅ Member of GOOD MONEY COLLECTIVE team on Netlify
- ✅ GitHub repository access (Ghostrayu/xahpayroll)
- ✅
netlify.tomlin repository root (already configured) - ✅
frontend/package.jsonwith build script - ✅
frontend/vite.config.tswith proper build configuration
- ✅ Backend deployed and accessible (Render deployment)
- ✅ Backend URL for CORS configuration
- ✅ XRPL network decision (testnet or mainnet)
- Login to Netlify: https://app.netlify.com
- Select Team: Switch to "GOOD MONEY COLLECTIVE" team
- New Site: Click "Add new site" → "Import an existing project"
- Connect GitHub: Select "GitHub" as Git provider
- Repository: Choose
Ghostrayu/xahpayroll - Configure:
- Branch:
main - Base directory:
frontend - Build command:
npm run build - Publish directory:
frontend/dist
- Branch:
- Environment Variables: Add required variables (see section below)
- Deploy: Click "Deploy site"
# Install Netlify CLI globally
npm install -g netlify-cli
# Login to Netlify
netlify login
# Link to GOOD MONEY COLLECTIVE team
netlify link
# Deploy to production
cd /path/to/xahpayroll
npm run deploy
# Or deploy preview
npm run deploy:previewThe netlify.toml file is already configured at the repository root with:
[build]
base = "frontend"
command = "npm run build"
publish = "dist"
[build.environment]
NODE_VERSION = "18"
NPM_VERSION = "9"
# React Router SPA redirects
[[redirects]]
from = "/*"
to = "/index.html"
status = 200
force = false
# Security headers
[[headers]]
for = "/*"
[headers.values]
X-Frame-Options = "DENY"
X-Content-Type-Options = "nosniff"
X-XSS-Protection = "1; mode=block"
Referrer-Policy = "strict-origin-when-cross-origin"
Permissions-Policy = "geolocation=(), microphone=(), camera=()"
# Static asset caching
[[headers]]
for = "/assets/*"
[headers.values]
Cache-Control = "public, max-age=31536000, immutable"Key Features:
- ✅ Automatic React Router SPA support
- ✅ Security headers (DENY, nosniff, XSS protection)
- ✅ Optimized static asset caching
- ✅ Node.js 18 environment
Add these in Netlify dashboard: Site settings → Environment variables
| Variable | Value | Description |
|---|---|---|
VITE_BACKEND_URL |
https://your-backend.onrender.com |
Backend API endpoint (Render deployment) |
VITE_XRPL_NETWORK |
mainnet or testnet |
XRPL network configuration |
VITE_BACKEND_URL=https://xahpayroll-backend.onrender.com
VITE_XRPL_NETWORK=mainnetVITE_BACKEND_URL=https://xahpayroll-backend-staging.onrender.com
VITE_XRPL_NETWORK=testnet- Go to Site settings → Environment variables
- Click Add a variable → Add a single variable
- Enter key:
VITE_BACKEND_URL - Enter value:
https://your-backend.onrender.com - Click Create variable
- Repeat for
VITE_XRPL_NETWORK - Trigger redeploy for changes to take effect
All frontend environment variables MUST start with VITE_ to be accessible in the React app. This is a Vite requirement.
❌ Wrong: BACKEND_URL=...
✅ Correct: VITE_BACKEND_URL=...
| Setting | Value |
|---|---|
| Base directory | frontend |
| Build command | npm run build |
| Publish directory | frontend/dist |
| Node version | 18 |
| Package manager | npm 9 |
The build command executes:
cd frontend
npm install
npm run build # Runs: tsc && vite buildBuild Output:
- TypeScript compilation:
tsc(type checking) - Vite production build:
vite build(outputs todist/) - Code splitting: XRPL core, wallet integrations, React vendor
- Asset optimization: Minification, tree-shaking, chunk splitting
Build Time: ~2-3 minutes (cold build)
Error:
Error: Cannot find module '@/components/...'
Cause: TypeScript path alias not resolved during build
Solution: Verify vite.config.ts has correct alias:
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
}Error: Network errors when calling backend API
Cause: VITE_BACKEND_URL not set or incorrect
Solution:
- Verify environment variable is set in Netlify dashboard
- Ensure URL includes protocol:
https://... - Check backend CORS allows frontend domain
- Trigger redeploy after adding variables
Error: Xaman wallet QR codes not working
Cause: Wrong network configuration
Solution:
- Verify
VITE_XRPL_NETWORKmatches backend configuration - Ensure Xaman app is on same network (testnet/mainnet)
- Check backend has correct XAMAN_API_KEY/SECRET
Error: Refreshing pages returns 404
Cause: SPA redirect not configured
Solution: Verify netlify.toml has redirect rule:
[[redirects]]
from = "/*"
to = "/index.html"
status = 200Issue: Preview works but production doesn't
Cause: Different environment variables for contexts
Solution:
- Go to Site settings → Environment variables
- Ensure variables are set for All scopes (not just specific contexts)
- Or explicitly set for Production context
After successful deployment, verify:
- Site loads: Visit production URL, no console errors
- Routing works: Navigate between pages, refresh works
- Backend connection: API calls succeed (check Network tab)
- Wallet integration: Xaman QR codes generate correctly
- Network config: Correct testnet/mainnet configuration
- Security headers: Check headers in browser DevTools
- Asset caching: Static assets have proper cache headers
- Authentication: Test Xaman sign-in flow
- Worker Dashboard: Verify payment channels load
- NGO Dashboard: Test worker management and channel creation
- Payment Flow: Test channel creation and closure (testnet only)
- Mobile: Test Xaman deep linking on mobile devices
Netlify automatically provides:
- ✅ Global CDN distribution
- ✅ Automatic HTTPS
- ✅ Brotli/Gzip compression
- ✅ HTTP/2 support
- ✅ Smart CDN caching
Lighthouse Score Target: >90 for all metrics
- Domain settings: Site settings → Domain management
- Add domain: Click "Add domain alias"
- DNS Configuration: Point DNS to Netlify:
- A record:
75.2.60.5 - CNAME:
[your-site].netlify.app
- A record:
- SSL Certificate: Netlify auto-provisions Let's Encrypt certificate
- HTTPS Enforcement: Enable "Force HTTPS"
For domain: app.xahpayroll.xyz
Type Name Value
A @ 75.2.60.5
CNAME www xahpayroll.netlify.app
Backend CORS Update: Add custom domain to backend CORS_ORIGINS:
CORS_ORIGINS=https://app.xahpayroll.xyz,https://xahpayroll.netlify.appNetlify automatically deploys when:
- Commits pushed to
mainbranch - Pull requests merged (if configured)
Build trigger: GitHub webhook → Netlify build → Deploy
# CLI deployment (requires netlify login)
npm run deploy # Production
npm run deploy:preview # PreviewIf deployment fails:
- Go to Deploys tab
- Find last successful deployment
- Click ... → Publish deploy
VITE_BACKEND_URL=https://xahpayroll-backend.onrender.com
VITE_XRPL_NETWORK=mainnetDomain: xahpayroll.netlify.app or custom domain
Backend: Production Render deployment (mainnet)
Wallet: Xaman mainnet accounts
Create separate site for staging:
VITE_BACKEND_URL=https://xahpayroll-backend-staging.onrender.com
VITE_XRPL_NETWORK=testnetDomain: xahpayroll-staging.netlify.app
Backend: Staging Render deployment (testnet)
Wallet: Xaman testnet accounts
Enable Netlify Analytics for:
- Page views and unique visitors
- Top pages and referrers
- Bandwidth usage
- 404 errors
Cost: $9/month per site
Monitor via Netlify dashboard:
- Build time: Should be <5 minutes
- Deploy time: Should be <30 seconds
- Bundle size: Track over time (target: <500KB initial)
netlify.toml includes security headers:
X-Frame-Options: DENY- Prevents clickjackingX-Content-Type-Options: nosniff- Prevents MIME sniffingX-XSS-Protection: 1; mode=block- XSS protectionReferrer-Policy: strict-origin-when-cross-origin- Referrer controlPermissions-Policy- Restricts geolocation, microphone, camera
Netlify automatically:
- Provisions SSL certificates
- Redirects HTTP → HTTPS
- Renews certificates automatically
- ✅ Never commit
.envfiles - ✅ Use Netlify dashboard for secrets
- ✅ Rotate credentials regularly
- ✅ Use different credentials for staging/production
Team Settings: https://app.netlify.com/teams/good-money-collective/settings
Members: Ensure team members have appropriate access:
- Owner: Full control (billing, team, sites)
- Collaborator: Deploy and configure sites
- Controller: Limited access
Best Practices:
- Use team context for all XAH Payroll deployments
- Share environment variables via team settings
- Document deployment processes in team wiki
Free Tier (likely sufficient for MVP):
- ✅ 100GB bandwidth/month
- ✅ 300 build minutes/month
- ✅ Unlimited sites
- ✅ HTTPS included
- ✅ Deploy previews
Pro Tier ($19/month, if needed):
- ✅ 400GB bandwidth/month
- ✅ 1000 build minutes/month
- ✅ Analytics included
- ✅ Priority support
- General: https://docs.netlify.com/
- Build Settings: https://docs.netlify.com/configure-builds/overview/
- Environment Variables: https://docs.netlify.com/environment-variables/overview/
- Redirects: https://docs.netlify.com/routing/redirects/
- Project README:
../README.md - Backend Deployment:
SUPABASE_RENDER_DEPLOYMENT.md - Database Setup:
DATABASE_SETUP.md - Wallet Integration:
WALLET_INTEGRATION.md
- Email: admin@xahpayroll.xyz
- GitHub Issues: https://github.com/Ghostrayu/xahpayroll/issues
- Team: GOOD MONEY COLLECTIVE on Netlify
- Logged into Netlify as Ghostrayu
- Switched to GOOD MONEY COLLECTIVE team
- Connected GitHub repository (Ghostrayu/xahpayroll)
- Configured build settings (base: frontend, command: npm run build, publish: frontend/dist)
- Added environment variables (VITE_BACKEND_URL, VITE_XRPL_NETWORK)
- Verified netlify.toml exists in repository root
- Deployed site
- Verified build succeeded
- Tested authentication flow
- Verified backend API connectivity
- Tested Xaman wallet integration
- Checked security headers in DevTools
- Updated backend CORS to include Netlify domain
- Documented production URL for team
END OF GUIDE