AI-powered development assistant with intelligent code generation and smart workflow automation
This guide provides comprehensive instructions for deploying the Solar Application Builder Buddy across multiple platforms including E2B, Railway, and local development environments.
- Frontend: React 18 + TypeScript + Vite + Tailwind CSS
- Backend: Python FastAPI with AI integration (OpenAI GPT-4)
- AI Features: Code generation, template management, project analysis
- Deployment: Multi-platform support (E2B, Railway, Docker)
Perfect for development and testing with AI features
# Clone the repository
git clone https://github.com/mikeschlottig/Solar-Application-Builder-Buddy-Production.git
cd Solar-Application-Builder-Buddy-Production
# Build and run with E2B
docker build -f e2b.Dockerfile -t builder-buddy-e2b .
docker run -p 5173:5173 -p 8000:8000 \
-e OPENAI_API_KEY=your-key \
builder-buddy-e2bAccess:
- Frontend: http://localhost:5173
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
Optimized for production with nginx + prerender.io for SEO
# Build Railway image
docker build -f railway.Dockerfile -t builder-buddy-railway .
# Run with production settings
docker run -p 8000:8000 \
-e OPENAI_API_KEY=your-key \
-e PRERENDER_TOKEN=your-token \
builder-buddy-railway# Environment setup
cp .env.example .env
# Edit .env with your API keys
# Start all services
docker-compose up -d
# Development mode
docker-compose up
# Production mode
docker-compose --profile production up# AI Integration
OPENAI_API_KEY=sk-your-openai-api-key
# Frontend Configuration
VITE_API_BASE_URL=http://localhost:8000
VITE_OPENAI_API_KEY=your-openai-key
VITE_ENABLE_AI_FEATURES=true
# Backend Configuration
DATABASE_URL=sqlite:///./builder_buddy.db
CORS_ORIGINS=[\"http://localhost:5173\"]
# Production Only
PRERENDER_TOKEN=your-prerender-token# Logging Configuration
LOG_LEVEL=INFO
LOG_FILE_PATH=./logs/builder_buddy.log
# AI Model Configuration
OPENAI_MODEL=gpt-4
OPENAI_TEMPERATURE=0.1
OPENAI_MAX_TOKENS=4000
# Development
HOT_RELOAD=true
DEBUG_MODE=trueBest for: Development, testing, AI feature development
-
Prepare Environment
# Install E2B CLI npm install -g @e2b/cli # Login to E2B e2b auth login
-
Deploy to E2B
# Build and deploy e2b build e2b deploy -
Configure E2B Settings
- Set environment variables in E2B dashboard
- Configure resource limits for AI processing
- Enable GPU support for enhanced AI performance
Best for: Production, SEO-optimized applications
-
Connect Repository
- Connect GitHub repository to Railway
- Select
railway.Dockerfileas build configuration
-
Environment Configuration
# Required Railway Variables OPENAI_API_KEY=your-key PRERENDER_TOKEN=your-token DATABASE_URL=postgresql://user:pass@host:port/db # Railway will automatically set: PORT=8000 RAILWAY_ENVIRONMENT=production
-
Domain Configuration
- Configure custom domain in Railway dashboard
- SSL certificates are automatically provisioned
- CDN optimization enabled by default
Best for: Feature development, debugging, customization
-
Prerequisites
# Required software - Node.js 20+ - Python 3.11+ - pnpm (for frontend) - uv (for backend) -
Frontend Setup
cd app pnpm install pnpm dev -
Backend Setup
cd services uv sync uv run uvicorn main:app --reload --host 0.0.0.0 --port 8000
# AI Configuration (services/config.py)
AI_CONFIG = {
"model": "gpt-4",
"temperature": 0.1,
"max_tokens": 4000,
"system_prompt": "You are an expert software developer assistant."
}- React Component Generation: AI-powered component creation
- API Endpoint Generation: FastAPI route generation
- Documentation Generation: Automatic README and API docs
- Test Generation: Automated test case creation
- Code Review: AI-powered code analysis and suggestions
// Template Configuration (app/src/config/templates.ts)
export const TEMPLATE_CONFIG = {
reactComponent: {
functional: true,
typescript: true,
styling: 'tailwind',
accessibility: true,
testing: 'jest'
},
apiEndpoint: {
framework: 'fastapi',
validation: 'pydantic',
documentation: 'openapi',
testing: 'pytest'
}
};# View logs in development
docker-compose logs -f builder-buddy
# View specific service logs
docker-compose logs -f builder-buddy-frontend
docker-compose logs -f builder-buddy-backend# AI-specific logging
tail -f logs/ai_interactions.log
tail -f logs/code_generation.log- Frontend: React DevTools, Lighthouse metrics
- Backend: FastAPI built-in metrics, custom performance tracking
- AI: Token usage tracking, response time monitoring
# Security Headers (services/api/middleware.py)
SECURITY_HEADERS = {
"X-Content-Type-Options": "nosniff",
"X-Frame-Options": "DENY",
"X-XSS-Protection": "1; mode=block",
"Strict-Transport-Security": "max-age=31536000"
}- Store sensitive keys in environment variables
- Use
.envfiles for local development only - Never commit API keys to version control
- Use platform-specific secret management
cd app
# Unit tests
pnpm test
# Component testing
pnpm test:components
# E2E testing
pnpm test:e2e
# Type checking
pnpm type-check
# Linting
pnpm lintcd services
# Unit tests
uv run pytest
# API tests
uv run pytest tests/api/
# AI integration tests
uv run pytest tests/ai/
# Coverage
uv run pytest --cov=api --cov-report=html# Test AI code generation
uv run python tests/test_ai_generation.py
# Test template system
uv run python tests/test_templates.py
# Performance testing
uv run python tests/test_ai_performance.py1. AI Features Not Working
# Check OpenAI API key
echo $OPENAI_API_KEY
# Verify API connectivity
curl -H "Authorization: Bearer $OPENAI_API_KEY" \
https://api.openai.com/v1/models2. Build Failures
# Clear caches
pnpm store prune
docker system prune -af
# Rebuild from scratch
docker-compose down -v
docker-compose build --no-cache3. Port Conflicts
# Check port usage
lsof -i :5173
lsof -i :8000
# Use different ports
export FRONTEND_PORT=3000
export BACKEND_PORT=8080Frontend Optimization
- Enable code splitting in Vite configuration
- Optimize bundle size with tree shaking
- Use React.lazy for component lazy loading
- Implement proper caching strategies
Backend Optimization
- Configure uvicorn workers for production
- Implement Redis caching for AI responses
- Use database connection pooling
- Enable gzip compression
AI Optimization
- Cache frequently used AI responses
- Implement request batching
- Use streaming for long responses
- Monitor token usage and costs
# Frontend health
curl http://localhost:5173/health
# Backend health
curl http://localhost:8000/health
# AI services health
curl http://localhost:8000/api/ai/health- Response Times: < 200ms for UI, < 2s for AI generation
- Memory Usage: < 1GB for typical workloads
- CPU Usage: < 50% average load
- AI Token Usage: Monitor costs and limits
- Environment variables configured
- API keys validated
- Tests passing
- Build successful
- Security scan complete
- Health checks passing
- AI features working
- Performance monitoring active
- Error tracking configured
- Backup strategy implemented
For deployment issues or questions:
- Documentation: Check this guide and README.md
- Issues: Create GitHub issue with deployment logs
- AI Problems: Verify OpenAI API key and quotas
- Performance: Monitor logs and system resources
🎉 Deployment successful! Your AI-powered Application Builder Buddy is ready to accelerate development workflows!