Deployment Guide for ContextWeave
This comprehensive guide covers deploying ContextWeave from Bolt.new to various platforms, with detailed instructions for Netlify, Vercel, and other hosting providers.
Overview
ContextWeave is designed to deploy seamlessly from Bolt.new to multiple platforms:
- Netlify (Recommended) - Optimized for Next.js with edge functions
- Vercel (Alternative) - Native Next.js platform
- Railway (Backend) - For FastAPI backend if needed
- Supabase (Database) - Managed PostgreSQL with auth
Netlify Deployment (Recommended)
1. Prepare for Deployment
# In Bolt.new terminal, ensure build works npm run build # Check for any build errors npm run lint npm run type-check
2. Deploy via Bolt.new Interface
# Method 1: One-Click Deploy (Recommended) 1. Click "Deploy" button in Bolt.new 2. Select "Netlify" as deployment target 3. Authorize Netlify connection 4. Configure deployment settings 5. Click "Deploy Now" # Method 2: Manual Netlify Setup 1. Push code to GitHub from Bolt.new 2. Connect GitHub repo to Netlify 3. Configure build settings
3. Netlify Configuration
Create netlify.toml
in project root:
[build] command = "npm run build" publish = ".next" [build.environment] NEXT_PRIVATE_TARGET = "server" [[redirects]] from = "/api/*" to = "/.netlify/functions/:splat" status = 200 [[redirects]] from = "/*" to = "/index.html" status = 200 [functions] directory = ".netlify/functions"
4. Environment Variables Setup
In Netlify dashboard, add these environment variables:
# Required NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co NEXT_PUBLIC_SUPABASE_ANON_KEY=your_anon_key # Optional (for full functionality) LIBS_IO_KEY=your_libraries_io_key GOOGLE_API_KEY=your_google_api_key GOOGLE_CSE_ID=your_google_cse_id GH_PAT=your_github_token OPENAI_API_KEY=your_openai_key # Build settings NODE_VERSION=18 NPM_VERSION=9
5. Custom Domain (Optional)
# In Netlify dashboard: 1. Go to Domain settings 2. Add custom domain 3. Configure DNS records 4. Enable HTTPS (automatic)
6. Deploy Verification
# Check deployment status 1. Monitor build logs in Netlify 2. Test deployed site functionality 3. Verify all API routes work 4. Check environment variables are loaded
Vercel Deployment (Alternative)
1. Deploy from Bolt.new
# Method 1: Vercel Integration 1. Install Vercel integration in Bolt.new 2. Click "Deploy to Vercel" 3. Configure project settings 4. Deploy # Method 2: Manual Setup 1. Push to GitHub from Bolt.new 2. Import project in Vercel dashboard 3. Configure build settings
2. Vercel Configuration
Create vercel.json
:
{ "version": 2, "builds": [ { "src": "package.json", "use": "@vercel/next" } ], "env": { "NEXT_PUBLIC_SUPABASE_URL": "@supabase-url", "NEXT_PUBLIC_SUPABASE_ANON_KEY": "@supabase-anon-key" }, "functions": { "app/api/**/*.ts": { "maxDuration": 30 } } }
3. Environment Variables
# In Vercel dashboard, add: NEXT_PUBLIC_SUPABASE_URL=https://your-project.supabase.co NEXT_PUBLIC_SUPABASE_ANON_KEY=your_anon_key LIBS_IO_KEY=your_libraries_io_key GOOGLE_API_KEY=your_google_api_key GH_PAT=your_github_token
Railway Backend Deployment (Optional)
If you need the FastAPI backend:
1. Prepare Backend
# Ensure backend/ directory exists with: - main.py (FastAPI app) - requirements.txt - Dockerfile (optional)
2. Deploy to Railway
# Method 1: Railway CLI npm install -g @railway/cli railway login railway init railway up # Method 2: GitHub Integration 1. Push backend to GitHub 2. Connect to Railway 3. Deploy from repository
3. Railway Configuration
Create railway.toml
:
[build] builder = "nixpacks" [deploy] startCommand = "uvicorn main:app --host 0.0.0.0 --port $PORT" healthcheckPath = "/health" healthcheckTimeout = 300 restartPolicyType = "on_failure" restartPolicyMaxRetries = 10
Database Deployment (Supabase)
1. Supabase Project Setup
# Create new Supabase project 1. Go to supabase.com 2. Create new project 3. Note project URL and anon key 4. Configure authentication providers
2. Database Migration
# Run migrations (if using Supabase CLI) npx supabase db push # Or manually run SQL in Supabase dashboard # Copy content from supabase/migrations/*.sql
3. Row Level Security
-- Enable RLS on all tables ALTER TABLE profiles ENABLE ROW LEVEL SECURITY; ALTER TABLE generations ENABLE ROW LEVEL SECURITY; -- Create policies CREATE POLICY "Users can view own profile" ON profiles FOR SELECT USING (auth.uid() = user_id);
Environment Variables Reference
Frontend (Next.js)
# Required NEXT_PUBLIC_SUPABASE_URL=https://xxx.supabase.co NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... # Optional APIs LIBS_IO_KEY=your_libraries_io_api_key GOOGLE_API_KEY=your_google_api_key GOOGLE_CSE_ID=your_google_custom_search_engine_id GH_PAT=ghp_your_github_personal_access_token OPENAI_API_KEY=sk-your_openai_api_key # Build Configuration NODE_VERSION=18 NPM_VERSION=9 NEXT_TELEMETRY_DISABLED=1
Backend (FastAPI - Optional)
# Database SUPABASE_URL=https://xxx.supabase.co SUPABASE_SERVICE_ROLE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... REDIS_URL=redis://localhost:6379 # External APIs LIBS_IO_KEY=your_libraries_io_api_key GOOGLE_API_KEY=your_google_api_key GH_PAT=ghp_your_github_token OPENAI_API_KEY=sk-your_openai_key # AI Models MODEL_PROFILE=gemini-pro-2.5 MODEL_ANSWER=deepseek-coder-r1-0528 EMBEDDING_MODEL=text-embedding-3-small
Deployment Checklist
Pre-Deployment
- Build succeeds locally -
npm run build
- All tests pass -
npm run test
- Linting passes -
npm run lint
- TypeScript compiles -
npm run type-check
- Environment variables configured
- API keys are valid and have proper permissions
During Deployment
- Monitor build logs for errors
- Check deployment status in platform dashboard
- Verify environment variables are loaded correctly
- Test basic functionality after deployment
Post-Deployment
- Test all major features
- Landing page loads
- Playground functionality works
- API routes respond correctly
- Authentication works (if configured)
- Database connections work (if configured)
- Performance check
- Page load times < 3 seconds
- API response times < 5 seconds
- No console errors
- SEO and accessibility
- Meta tags are correct
- Images have alt text
- Lighthouse score > 90
Troubleshooting Deployment Issues
Build Failures
# Common issues and solutions: # 1. TypeScript errors npm run type-check # Fix type errors before deploying # 2. Missing dependencies npm install # Ensure all dependencies are in package.json # 3. Environment variable issues # Check that all required env vars are set # Verify no typos in variable names # 4. API route errors # Test API routes locally first # Check for proper error handling
Runtime Errors
# 1. 404 errors on deployed site # Check that _redirects or netlify.toml is configured # Verify all routes are properly defined # 2. API calls failing # Check CORS configuration # Verify API endpoints are accessible # Check environment variables in production # 3. Database connection issues # Verify Supabase URL and keys # Check RLS policies allow access # Test database connection manually
Performance Issues
# 1. Slow page loads # Optimize images and assets # Enable caching headers # Use CDN for static assets # 2. Slow API responses # Implement caching # Optimize database queries # Use connection pooling # 3. High memory usage # Check for memory leaks # Optimize bundle size # Use lazy loading
Monitoring and Maintenance
1. Set Up Monitoring
# Netlify Analytics # Enable in Netlify dashboard # Vercel Analytics # Enable in Vercel dashboard # Custom monitoring # Add error tracking (Sentry, LogRocket) # Set up uptime monitoring
2. Regular Maintenance
# Weekly tasks: - Check deployment status - Review error logs - Monitor performance metrics - Update dependencies if needed # Monthly tasks: - Security audit - Performance optimization - Backup verification - Cost optimization
3. Scaling Considerations
# When to scale: - Response times > 5 seconds - Error rates > 1% - High memory/CPU usage - User complaints about performance # How to scale: - Upgrade hosting plan - Implement caching - Optimize database queries - Use CDN for assets
Rollback Procedures
1. Quick Rollback
# Netlify 1. Go to Deploys tab 2. Click "Publish deploy" on previous version 3. Confirm rollback # Vercel 1. Go to Deployments 2. Click "Promote to Production" on previous deployment 3. Confirm promotion
2. Emergency Procedures
# If site is completely down: 1. Check deployment status 2. Review recent changes 3. Rollback to last known good version 4. Investigate and fix issues 5. Redeploy when ready
Next Steps
After successful deployment:
- Set up monitoring - Track performance and errors
- Configure custom domain - Use your own domain
- Optimize performance - Improve speed and user experience
- Set up CI/CD - Automate future deployments
This deployment guide ensures ContextWeave can be reliably deployed and maintained from Bolt.new to production environments.