Deployment Guide - Nokia Snake Game
Publication guide
Deployment Guide - Nokia Snake Game
Build Process
1. Install Dependencies
npm install
2. Build for Production
npm run build
This creates optimized files in the dist/ directory:
- Minified JavaScript bundle
- Optimized HTML and CSS
- Source maps disabled for production
3. Preview Production Build
npm run preview
Test the production build locally before deployment.
Deployment Options
Option 1: GitHub Pages (Recommended)
- Install gh-pages:
npm install --save-dev gh-pages
- Add deploy script to package.json:
"scripts": {
"deploy": "vite build && gh-pages -d dist"
}
- Deploy:
npm run deploy
Option 2: Netlify
- Connect your repository to Netlify
- Configure build settings:
- Build command:
npm run build - Publish directory:
dist
- Build command:
- Deploy automatically on git push
Option 3: Vercel
- Install Vercel CLI:
npm install -g vercel
- Deploy:
vercel
- Follow prompts to configure deployment
Option 4: Static Hosting (AWS S3, etc.)
- Build the project:
npm run build
- Upload
dist/contents to your hosting:
# Example for AWS S3
aws s3 sync dist/ s3://your-bucket-name --delete
- Configure CloudFront (optional) for CDN
Environment Configuration
Production Environment Variables
No environment variables required - fully client-side application.
Security Headers
Ensure your hosting platform serves these headers:
- Content-Security-Policy (already in HTML meta tag)
- X-Content-Type-Options: nosniff
- X-Frame-Options: DENY
- X-XSS-Protection: 1; mode=block
Post-Deployment Checklist
- Test game functionality
- Verify localStorage works
- Check console for errors
- Test on multiple browsers
- Test on mobile devices
- Verify CSP headers
- Check performance (FPS)
- Test offline functionality
Monitoring
Client-Side Monitoring
- Check browser console for errors
- Monitor localStorage usage
- Review audit logs in localStorage
Performance Monitoring
- Use browser DevTools Performance tab
- Check FPS in game (logged to console)
- Monitor memory usage
Rollback Procedure
GitHub Pages
git revert <commit-hash>
npm run deploy
Netlify/Vercel
Use platform's rollback feature in dashboard
Manual Hosting
Re-upload previous dist/ backup
Troubleshooting
Build Fails
- Check Node.js version (16+ required)
- Clear node_modules and reinstall
- Check for syntax errors
Game Not Loading
- Check browser console for errors
- Verify all files deployed correctly
- Check CSP headers not blocking resources
localStorage Not Working
- Check browser privacy settings
- Verify not in incognito mode
- Check storage quota
Maintenance
Regular Tasks
- Monitor error logs
- Check performance metrics
- Update dependencies periodically
- Test on new browser versions
Updates
- Make changes
- Test locally
- Build and deploy
- Verify in production
Support
For issues, check:
- Browser console errors
- localStorage audit logs
- Network tab for failed requests
- README.md for setup instructions