One-Click Deploy
Deploy FlatWP to production in minutes with one-click deployment buttons.
Deployment Options
| Platform | Best For | Free Tier | Custom Domain | Auto Deploy |
|---|---|---|---|---|
| Vercel | Next.js apps | ✅ Yes | ✅ Yes | ✅ Yes |
| Netlify | Static sites | ✅ Yes | ✅ Yes | ✅ Yes |
| Railway | Full-stack | ❌ Credit required | ✅ Yes | ✅ Yes |
Deploy to Vercel (Recommended)
Vercel is the company behind Next.js and provides the best Next.js hosting experience.
1. Click Deploy Button
2. Connect GitHub Account
- Sign in to Vercel (or create account)
- Connect your GitHub account
- Choose repository name
- Click Create
3. Configure Environment Variables
Add these required environment variables:
NEXT_PUBLIC_WORDPRESS_API_URL=https://your-wordpress.com/graphql
REVALIDATION_SECRET=your-secure-secret-here
PREVIEW_SECRET=another-secure-secret
# Generate secure random strings
openssl rand -base64 32
4. Deploy
Click Deploy and wait for the build to complete (~2 minutes).
5. Configure WordPress Plugin
- Go to your WordPress admin
- Navigate to Settings → FlatWP
- Enter your deployment URL:
Next.js Site URL: https://your-site.vercel.app
Revalidation Secret: [same as REVALIDATION_SECRET] - Click Save Settings
6. Test Connection
- Make a change in WordPress
- Publish or update
- Visit your Vercel site - changes should appear within seconds
Deploy to Netlify
Netlify offers great static site hosting with automatic deployments.
1. Click Deploy Button
2. Connect Repository
- Sign in to Netlify
- Connect GitHub account
- Authorize Netlify
3. Configure Site
Build Settings:
Build command: npm run build
Publish directory: .next
Environment Variables:
NEXT_PUBLIC_WORDPRESS_API_URL=https://your-wordpress.com/graphql
REVALIDATION_SECRET=your-secure-secret
PREVIEW_SECRET=your-preview-secret
4. Deploy Site
Click Deploy Site and wait for build completion.
5. Configure Custom Domain (Optional)
- Go to Site Settings → Domain Management
- Click Add Custom Domain
- Follow DNS setup instructions
Deploy to Railway
Railway provides full-stack hosting with database support.
1. Click Deploy Button
2. Connect GitHub
- Sign in to Railway
- Connect GitHub account
- Select repository
3. Configure Environment
Railway will prompt for environment variables:
NEXT_PUBLIC_WORDPRESS_API_URL=
REVALIDATION_SECRET=
PREVIEW_SECRET=
4. Deploy
Railway will automatically deploy your application.
5. Get Deployment URL
- Go to your Railway project
- Find Deployments tab
- Copy the deployment URL
Post-Deployment Configuration
Update WordPress Plugin Settings
After deploying to any platform:
- WordPress Admin → Settings → FlatWP
- Update Next.js Site URL with your deployment URL:
- Vercel:
https://your-site.vercel.app - Netlify:
https://your-site.netlify.app - Railway:
https://your-site.up.railway.app
- Vercel:
- Verify Revalidation Secret matches
- Click Save Settings
- Look for green "Connected" status
Test Webhook Connection
- Create or update a post in WordPress
- Publish the changes
- Check your deployed site - changes should appear immediately
Custom Domain Setup
Vercel Custom Domain
- Go to Project Settings → Domains
- Click Add Domain
- Enter your domain name
- Follow DNS configuration instructions:
Type: A
Name: @
Value: 76.76.21.21Type: CNAME
Name: www
Value: cname.vercel-dns.com - Wait for DNS propagation (5-60 minutes)
Netlify Custom Domain
- Go to Site Settings → Domain Management
- Click Add Custom Domain
- Configure DNS:
Type: A
Name: @
Value: 75.2.60.5Type: CNAME
Name: www
Value: your-site.netlify.app
Railway Custom Domain
- Go to Settings → Domains
- Click Custom Domain
- Enter domain and follow DNS instructions
Automatic Deployments
All platforms support automatic deployments on git push:
How It Works
- Make changes to your code locally
- Commit changes:
git add . && git commit -m "Update" - Push to GitHub:
git push - Platform automatically detects push
- Builds and deploys new version
- Updates live site
Branch Deployments
Vercel:
- main branch → Production
- Other branches → Preview deployments
Netlify:
- main branch → Production
- Pull requests → Deploy previews
Railway:
- Configured branch → Production
Environment Management
Production vs Preview
Production Environment:
NEXT_PUBLIC_WORDPRESS_API_URL=https://production-wp.com/graphql
Preview Environment:
NEXT_PUBLIC_WORDPRESS_API_URL=https://staging-wp.com/graphql
Managing Secrets
Vercel
- Project Settings → Environment Variables
- Add variables per environment:
- Production: Live site
- Preview: Feature branches
- Development: Local development
Netlify
- Site Settings → Environment Variables
- Add variables (apply to all deploys by default)
- Use context for branch-specific variables:
[context.production.environment]
NEXT_PUBLIC_WORDPRESS_API_URL = "https://production.com/graphql"
[context.deploy-preview.environment]
NEXT_PUBLIC_WORDPRESS_API_URL = "https://staging.com/graphql"
Railway
- Go to Variables tab
- Add environment variables
- Redeploy to apply changes
Performance Optimization
Enable Edge Caching
All platforms enable edge caching automatically for optimal performance.
Benefits:
- Fast global delivery
- Reduced server load
- Better user experience
Image Optimization
Vercel: Automatic with next/image
Netlify: Use Netlify Image CDN
Railway: Configure image proxy
Analytics Setup
Vercel Analytics
-
Install package:
pnpm add @vercel/analytics -
Add to
app/layout.tsx:import { Analytics } from '@vercel/analytics/react';
export default function RootLayout() {
return (
<html>
<body>
{children}
<Analytics />
</body>
</html>
);
} -
Enable in Vercel dashboard
Troubleshooting
Build Fails
Error: "Build failed with exit code 1"
Solutions:
- Check build logs for specific errors
- Verify environment variables are set
- Test build locally:
pnpm build - Check Node.js version matches requirements (20+)
Environment Variables Not Working
Problem: Variables showing as undefined
Solutions:
- Verify variable names match exactly
- Ensure
NEXT_PUBLIC_prefix for client-side variables - Redeploy after adding variables
- Check for typos in variable names
Webhook Not Working
Problem: WordPress changes don't trigger revalidation
Solutions:
- Verify
REVALIDATION_SECRETmatches in both places - Check Next.js Site URL is correct in WordPress
- Test endpoint manually:
curl -X POST https://your-site.com/api/revalidate \
-H "Content-Type: application/json" \
-d '{"secret":"your-secret","paths":["/"]}'
Slow Build Times
Problem: Builds taking >10 minutes
Solutions:
- Limit
generateStaticParams()for development:const limit = process.env.NODE_ENV === 'production' ? 1000 : 10; - Use incremental builds if available
- Optimize dependencies
Out of Memory
Problem: "JavaScript heap out of memory"
Solution: Increase memory limit in build command:
{
"scripts": {
"build": "NODE_OPTIONS='--max-old-space-size=4096' next build"
}
}
Best Practices
1. Use Environment-Specific WordPress Instances
# Production
NEXT_PUBLIC_WORDPRESS_API_URL=https://cms.mysite.com/graphql
# Staging
NEXT_PUBLIC_WORDPRESS_API_URL=https://staging-cms.mysite.com/graphql
2. Enable HTTPS Everywhere
All platforms provide free SSL certificates. Always use HTTPS.
3. Set Up Monitoring
- Enable platform analytics
- Configure error tracking (e.g., Sentry)
- Monitor Core Web Vitals
4. Implement Staging Environment
Create staging branch for testing before production:
- Create
stagingbranch - Deploy to preview environment
- Test thoroughly
- Merge to
mainfor production
5. Use Custom Domains
Custom domains provide:
- Better branding
- Improved SEO
- Professional appearance
Next Steps
After successful deployment:
- Configure SEO - Optimize for search engines
- Set Up Analytics - Track visitor metrics
- Custom Domain - Use your own domain
- Performance Optimization - Fine-tune performance
See Also
- Environment Variables - Complete variable reference
- WordPress Plugin Setup - Plugin configuration
- Troubleshooting - Common deployment issues