Easiest deployment for MVP:
-
Connect Repository
# Push to GitHub first git add . git commit -m "Initial HolmesGPT setup" git push origin main
-
Deploy to Vercel
- Go to vercel.com
- Import your GitHub repository
- Add environment variable:
ANTHROPIC_API_KEY - Deploy automatically
-
Environment Variables
ANTHROPIC_API_KEY=your-anthropic-api-key-here
Alternative easy deployment:
- Build Command:
npm run build - Publish Directory:
.svelte-kit/output/client - Environment Variables: Add
ANTHROPIC_API_KEY
Good for full-stack deployment:
- Connect GitHub repository
- Add environment variables
- Automatic deployment on push
- Node.js 18+
- Anthropic API key
- Domain (optional)
-
Build the Application
npm run build
-
Set Environment Variables
export ANTHROPIC_API_KEY=your-api-key-here -
Start Production Server
npm run preview
# Required
ANTHROPIC_API_KEY=your-anthropic-api-key-here
# Optional (for future features)
DATABASE_URL=your-database-url
NODE_ENV=production-
Enable Compression
// vite.config.ts export default defineConfig({ plugins: [sveltekit()], build: { rollupOptions: { output: { manualChunks: { vendor: ["svelte"], }, }, }, }, });
-
Caching Headers
// svelte.config.js const config = { kit: { adapter: adapter(), headers: { "/*": [ { key: "Cache-Control", value: "public, max-age=31536000, immutable", }, ], }, }, };
-
API Key Protection
- Never expose API keys in client-side code
- Use environment variables
- Consider API key rotation
-
Rate Limiting
// Add to API route import rateLimit from "express-rate-limit"; const limiter = rateLimit({ windowMs: 15 * 60 * 1000, // 15 minutes max: 100, // limit each IP to 100 requests per windowMs });
- Vercel Analytics: Built-in with Vercel deployment
- Google Analytics: Add tracking code
- Error Tracking: Sentry integration
// Add to app.html
<script>
// Basic performance monitoring
window.addEventListener('load', () => {
const perfData = performance.getEntriesByType('navigation')[0];
console.log('Load time:', perfData.loadEventEnd - perfData.loadEventStart);
});
</script># .github/workflows/deploy.yml
name: Deploy to Vercel
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "18"
- run: npm ci
- run: npm run build
- uses: amondnet/vercel-action@v20
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.ORG_ID }}
vercel-project-id: ${{ secrets.PROJECT_ID }}-
Build Failures
# Clear cache and reinstall rm -rf node_modules package-lock.json npm install npm run build -
API Key Issues
- Verify environment variable is set
- Check API key permissions
- Ensure key is valid
-
CORS Issues
// Add to API route if needed res.setHeader("Access-Control-Allow-Origin", "*"); res.setHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
-
Slow Loading
- Enable compression
- Optimize images
- Use CDN for static assets
-
API Timeouts
- Increase timeout limits
- Implement retry logic
- Use streaming responses
-
Database Integration
- Add Supabase/PostgreSQL for chat history
- Implement user sessions
- Add conversation persistence
-
Caching Strategy
- Redis for session storage
- CDN for static assets
- API response caching
-
Load Balancing
- Multiple server instances
- Geographic distribution
- Auto-scaling configuration
- Environment variables properly set
- API keys secured
- HTTPS enabled
- Rate limiting implemented
- Input validation added
- Error messages sanitized
- CORS properly configured
- Security headers set
For deployment issues:
- Check the SvelteKit documentation
- Review Vercel deployment guide
- Check Anthropic API documentation
Ready to share Holmes' wisdom with the world! 🌟