This guide covers deploying PROVESA Web to production, including setup, configuration, and best practices for a secure and performant deployment.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ashcroft08/provesa-web/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before deploying, ensure you have:Production Environment
- Node.js v20+ installed
- PostgreSQL 15+ database (local or hosted)
- Domain name configured (optional but recommended)
- SSL certificate (for HTTPS)
Environment Variables
All required environment variables documented and ready:
- Database connection string
- Authentication secrets
- Email credentials (for password recovery)
- Production URL/domain
Environment Configuration
Required Environment Variables
Create a.env file in production with the following variables:
Generating Secure Secrets
Generate a strongBETTER_AUTH_SECRET:
- Using OpenSSL
- Using Node.js
- Online Generator
Database Setup
PostgreSQL Production Database
Configure Connection
Update For hosted databases (like Railway, Supabase, or Heroku):
DATABASE_URL in .env:Database Hosting Options
Supabase
- Free tier with 500MB database
- Automatic backups
- Easy PostgreSQL management
- Global CDN for assets
Railway
- PostgreSQL as a service
- Auto-scaling
- Simple deployment
- $5/month starter plan
Neon
- Serverless Postgres
- Free tier available
- Instant branching
- Auto-scaling compute
Self-Hosted
- Full control
- No vendor lock-in
- Requires server management
- Custom backup solutions
Building for Production
Creating Production Build
Run Production Build
- Compiles SvelteKit application
- Optimizes assets
- Generates static files
- Creates production-ready build in
build/directory
Build Output
The build creates:/build- Production server files/build/client- Client-side assets/build/server- Server-side code- Static assets optimized and fingerprinted
Deployment Options
Option 1: Vercel (Recommended)
Vercel provides seamless SvelteKit deployment:Deploy
- Link to existing project or create new
- Configure project settings
- Set environment variables
Configure Environment Variables
In Vercel dashboard:
- Go to Project Settings → Environment Variables
- Add all required variables from
.env - Set for Production environment
- Redeploy if needed
Option 2: Node.js Server
Deploy to a traditional Node.js server:Option 3: Docker Container
Containerize the application:Option 4: Railway
Deploy with one click to Railway:Connect Repository
- Visit Railway
- Click “New Project” → “Deploy from GitHub repo”
- Select your PROVESA Web repository
Add PostgreSQL
- Click “New” → “Database” → “Add PostgreSQL”
- Railway provisions database automatically
- Copy
DATABASE_URLfrom database variables
Configure Variables
Add environment variables in Railway dashboard:
BETTER_AUTH_SECRETGMAIL_USERGMAIL_APP_PASSWORDORIGIN(use Railway-provided domain)
Post-Deployment Tasks
Verify Database Connection
Check that the application can connect to the database:
- Visit
/loginpage - Attempt to log in
- Check server logs for database errors
Change Default Password
Log in with seeded admin credentials and immediately change password:
- Log out
- Use password recovery flow
- Set strong, unique password
Test Email Delivery
Verify password recovery emails work:
- Request password reset
- Check if email arrives
- Test reset link
Configure Domain
Set up custom domain:
- Point DNS A record to server IP
- Or add CNAME to Vercel/Railway domain
- Configure SSL certificate
- Update
ORIGINenvironment variable
Security Checklist
- Environment
- Database
- Application
- Access Control
- All secrets stored securely (not in code)
-
.envexcluded from version control - Strong
BETTER_AUTH_SECRET(32+ chars) - Production
ORIGINmatches actual domain - Gmail app password (not regular password)
Performance Optimization
Caching Strategies
Static Asset Caching
Static Asset Caching
Configure CDN or reverse proxy caching:
- Cache static files (JS, CSS, images)
- Set appropriate cache headers
- Use fingerprinting for cache busting
- Consider using Cloudflare or similar CDN
Database Query Optimization
Database Query Optimization
- Add database indexes on frequently queried columns
- Use connection pooling
- Implement query caching where appropriate
- Monitor slow queries
Image Optimization
Image Optimization
- Compress images before uploading
- Use WebP format when possible
- Implement lazy loading
- Consider image CDN (Cloudinary, imgix)
Monitoring and Logging
Set up comprehensive monitoring:Application Monitoring
- Response times
- Error rates
- Memory usage
- CPU utilization
Error Tracking
- Runtime errors
- Stack traces
- User impact
- Error trends
Uptime Monitoring
- Service availability
- Response time
- SSL certificate expiry
- Alerts and notifications
Log Management
- Centralized logging
- Log search and analysis
- Retention policies
- Alert on patterns
Backup and Recovery
Database Backups
Configure Automated Backups
Set up daily database backups:Or use your hosting provider’s backup service.
Disaster Recovery Plan
- Backup Frequency: Daily automated backups
- Retention: Keep 30 days of daily backups
- Recovery Time Objective (RTO): 4 hours
- Recovery Point Objective (RPO): 24 hours
- Testing: Quarterly disaster recovery drills
Scaling Considerations
Horizontal Scaling
As traffic grows:- Multiple App Instances: Deploy multiple server instances behind load balancer
- Database Replication: Set up read replicas for database queries
- CDN Integration: Offload static assets to CDN
- Caching Layer: Add Redis for session storage and caching
Vertical Scaling
Increase server resources:- Upgrade server CPU and RAM
- Increase database compute
- Optimize database queries and indexes
Troubleshooting Production Issues
Application won't start
Application won't start
Check:
- Environment variables set correctly
- Database accessible from server
- Port not already in use
- Node.js version compatible (20+)
- Build completed successfully
Database connection errors
Database connection errors
Verify:
DATABASE_URLformat correct- Database server running
- Firewall allows connection
- User has necessary permissions
- SSL settings if required
Email not sending
Email not sending
Check:
GMAIL_USERandGMAIL_APP_PASSWORDcorrect- App password (not regular password)
- Gmail 2FA enabled
- SMTP ports not blocked
- Rate limits not exceeded
Maintenance Best Practices
- Regular Updates: Keep dependencies updated monthly
- Security Patches: Apply critical security updates immediately
- Backup Verification: Test backups quarterly
- Performance Audits: Review performance metrics monthly
- Security Audits: Conduct security review quarterly
- Dependency Audits: Run
pnpm auditregularly
Next Steps
Admin Panel Usage
Learn to use the admin interface
Managing Content
Update and manage site content
