output: 'export'. This makes it compatible with any static hosting platform and ensures complete client-side privacy.
Static Export Architecture
The application uses Next.js static export mode configured innext.config.mjs:
What This Means
- No server required: All pages are pre-rendered as HTML
- No API routes: All processing happens client-side
- No dynamic routes: Tool pages are generated via
generateStaticParams() - PWA-ready: Service worker and manifest for offline support
Building for Production
Run the build command
- Compiles TypeScript to JavaScript
- Bundles React components
- Generates static HTML for all tool pages
- Optimizes CSS with Tailwind
- Creates the
out/directory
Deploying to Vercel
Vercel provides the simplest deployment experience for Next.js applications.Automatic Deployment
Connect to GitHub
- Push your code to GitHub
- Visit vercel.com
- Click “New Project”
- Import your repository
Configure project
Vercel auto-detects Next.js. No configuration needed:
- Framework Preset: Next.js
- Build Command:
npm run build - Output Directory:
out(auto-detected)
Deploy
Click “Deploy” and wait for the build to complete.Vercel will:
- Install dependencies
- Run
npm run build - Deploy the
out/directory to CDN - Provide a production URL
Manual Deployment
Deploy from the command line:Vercel Configuration
The project includesvercel.json with security headers:
Deploying to Other Platforms
The static export works with any static hosting provider:Build Configuration
Environment Variables
For build-time configuration, use.env.local:
Build Optimization
The current bundle size is ~513 kB. Optimization strategies:1. Dynamic Imports
Replace static imports with dynamic imports for large dependencies:2. Code Splitting
Split tool logic into separate chunks:3. Remove Unused Dependencies
Regularly audit dependencies:Build Troubleshooting
Build Fails with “Error: Dynamic Code Evaluation”
Some libraries useeval() which doesn’t work in static export:
Build Fails with “Error: Image Optimization”
Next.js Image Optimization requires a server. Useunoptimized: true:
Build Succeeds but Pages 404
EnsuregenerateStaticParams() returns all tool IDs:
Large Bundle Size Warning
Next.js warns if bundles exceed 244 kB. For this app, it’s expected:- Use dynamic imports for heavy dependencies
- Split tools into separate route groups
- Remove unused dependencies
Deployment Checklist
Pre-deployment checks
- All tests pass (
npm run test) - Linting passes (
npm run lint) - Build succeeds (
npm run build) - Security audit passes (
npm run audit) - Static export works locally (
npx serve out)
Security verification
-
vercel.jsonhas security headers - No secrets in environment variables
- Content Security Policy configured
- HTTPS enforced in production
Performance verification
- Bundle size is acceptable
- Service worker caches assets
- PWA manifest is valid
- Images are optimized
Continuous Deployment
Set up automatic deployments on push:GitHub Actions + Vercel
Monitoring
After deployment, monitor:1. Analytics
Add privacy-respecting analytics:2. Error Tracking
Monitor client-side errors:3. Performance Monitoring
Track Core Web Vitals:Rollback Strategy
If a deployment breaks:Vercel: Instant Rollback
In Vercel dashboard:
- Go to Deployments
- Find previous working deployment
- Click “Promote to Production”
Security Considerations
- CSP Headers: Configured in
vercel.jsonto prevent XSS - HTTPS Only: Enforced by hosting platform
- No Secrets: All processing is client-side
- Subresource Integrity: Consider adding SRI hashes for CDN resources
- Dependency Scanning: GitHub Dependabot monitors for vulnerabilities
Next Steps
- Review local setup guide
- Learn about adding tools
- Understand testing strategy
- Monitor deployment health and performance