Deploy CMU Fuel Planner to production using Vercel (recommended) or other platforms.
Vercel is made by the creators of Next.js and provides the best experience.
- GitHub account
- Vercel account (free at vercel.com)
- Anthropic API key
-
Push to GitHub
git add . git commit -m "Complete CMU Fuel Planner" git push origin main
-
Import to Vercel
- Go to vercel.com/new
- Import your GitHub repository
- Vercel auto-detects Next.js settings
-
Add Environment Variable
- In Vercel dashboard → Settings → Environment Variables
- Add:
ANTHROPIC_API_KEY= your API key - Deploy to all environments (Production, Preview, Development)
-
Deploy
- Click "Deploy"
- Wait ~2 minutes
- Your app is live! 🎉
- Settings → Domains
- Add your domain (e.g., cmufuel.com)
- Update DNS records as instructed
- Every push to
main= production deployment - Every pull request = preview deployment
-
Create
netlify.toml[build] command = "npm run build" publish = ".next" [[plugins]] package = "@netlify/plugin-nextjs"
-
Deploy
- Go to netlify.com
- Import from GitHub
- Add
ANTHROPIC_API_KEYin Environment Variables - Deploy
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["npm", "start"]docker build -t cmu-fuel-planner .
docker run -p 3000:3000 -e ANTHROPIC_API_KEY=your_key cmu-fuel-planner# Install Node.js
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs
# Clone and setup
git clone https://github.com/yourusername/cmuclaudehackathon2025.git
cd cmuclaudehackathon2025
npm install
npm run build
# Create .env.local
echo "ANTHROPIC_API_KEY=your_key" > .env.local
# Start with PM2
sudo npm install -g pm2
pm2 start npm --name "cmu-fuel-planner" -- start
pm2 save
pm2 startupserver {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}Ensure these are set in production:
ANTHROPIC_API_KEY=sk-ant-...
NODE_ENV=productionBefore deploying:
- Build succeeds locally (
npm run build) - No TypeScript errors (
npm run type-check) - No linter errors (
npm run lint) - Environment variables configured
- Test with sample data
- Verify ICS export works
- Check mobile responsiveness
- Test API error handling
In next.config.js:
module.exports = {
// Existing config...
async headers() {
return [
{
source: '/:all*(svg|jpg|png)',
headers: [
{
key: 'Cache-Control',
value: 'public, max-age=31536000, immutable',
},
],
},
];
},
};Use Next.js Image component for any images you add.
# Analyze bundle
npm install -g @next/bundle-analyzer
ANALYZE=true npm run buildEnable in Vercel dashboard → Analytics (free tier available)
Add Sentry or similar:
npm install @sentry/nextjs
npx @sentry/wizard -i nextjs-
API Key Protection
- Never commit
.env.local - Use platform environment variables
- Rotate keys periodically
- Never commit
-
Rate Limiting Consider adding rate limiting to API routes:
// In route.ts const rateLimiter = new Map(); function checkRateLimit(ip: string): boolean { const now = Date.now(); const userRequests = rateLimiter.get(ip) || []; const recentRequests = userRequests.filter(time => now - time < 60000); if (recentRequests.length >= 10) { return false; } rateLimiter.set(ip, [...recentRequests, now]); return true; }
-
HTTPS
- Always use HTTPS in production
- Vercel/Netlify provide this automatically
- For self-hosting, use Let's Encrypt
# Check locally first
npm run build
# Clear cache
rm -rf .next
npm run build- Verify
ANTHROPIC_API_KEYis set - Check API usage limits
- Review server logs
- Enable Next.js analytics
- Check bundle size with analyzer
- Review Claude API response times
Anthropic has rate limits. For high usage:
- Implement request queuing
- Add caching for similar requests
- Consider usage-based access tiers
When adding user accounts:
- Use Vercel Postgres
- Or connect to external database
- Implement connection pooling
# Update dependencies
npm update
# Check for security issues
npm audit
npm audit fix- Code: Version controlled in GitHub
- Environment variables: Document in secure location
- User data: Regular database backups (when implemented)
- Hobby: Free (limited to 100GB bandwidth/month)
- Pro: $20/month (unlimited bandwidth)
- Pay per token usage
- Sonnet 4: ~$3 per million input tokens
- Estimate: ~$0.01-0.05 per schedule generation
- Budget: Start with $10/month, scale as needed
- $10-15/year (optional)
- Production build tested
- Environment variables set
- Custom domain configured (optional)
- Analytics enabled
- Error tracking setup
- README updated with live URL
- Share with CMU community!
Ready to launch? Follow the Vercel deployment steps above for the quickest path to production! 🚀