Complete environment setup for AutoDevHub development
# Clone the repository
git clone https://github.com/ai-cohort-july-2025/AI-Cohort-July-2025.git
cd AI-Cohort-July-2025
# Create development branch
git checkout -b feature/your-feature-name
# Navigate to backend directory
cd backend
# Create virtual environment
python -m venv venv
# Activate virtual environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Copy environment template
cp .env.example .env
# Navigate to frontend directory (new terminal)
cd frontend
# Install dependencies
npm install
# Copy environment template
cp .env.example .env.local
# AI Configuration
CLAUDE_API_KEY=your_claude_api_key_here
# Database
DATABASE_URL=sqlite:///./autodevhub.db
# Cache
REDIS_URL=redis://localhost:6379
# Security
SECRET_KEY=your_secret_key_here
ACCESS_TOKEN_EXPIRE_MINUTES=30
# Environment
ENVIRONMENT=development
DEBUG=true
# API Configuration
API_V1_STR=/api/v1
CORS_ORIGINS=["http://localhost:3002", "http://127.0.0.1:3002"]
# API Configuration
VITE_API_BASE_URL=http://localhost:8000
VITE_API_VERSION=v1
# Environment
VITE_ENVIRONMENT=development
VITE_DEBUG=true
# From backend directory
cd backend
# Activate virtual environment
source venv/bin/activate # macOS/Linux
# or
venv\Scripts\activate # Windows
# Run development server
uvicorn main:app --reload --host 0.0.0.0 --port 8000
# Server will be available at:
# - API: http://localhost:8000
# - Docs: http://localhost:8000/docs
# - Redoc: http://localhost:8000/redoc
# From frontend directory
cd frontend
# Run development server
npm run dev
# Server will be available at:
# - App: http://localhost:3002
# Check Docker environment
make docker-check
# Expected output:
# ✅ Docker environment is ready!
# Docker version: Docker version X.X.X
# Docker Compose version: Docker Compose version X.X.X
# 🚀 Start all services in one command
make docker-up
# Services will be available at:
# - Frontend: http://localhost:3000
# - Backend API: http://localhost:5000
# - API Docs: http://localhost:5000/docs
# Start development environment
make docker-dev # Start with development settings
# Monitor your application
make docker-status # Check container health
make docker-logs # View live logs
# Interact with containers
make docker-shell # Open shell in backend container
make docker-exec SERVICE=backend COMMAND='python --version'
# Stop and cleanup
make docker-down # Stop containers
make docker-clean # Full cleanup (containers, images, volumes)
# Build Docker images
make docker-build # Build all images
# Rebuild from scratch (no cache)
make docker-rebuild # Complete rebuild
# Production build
make docker-prod # Start in production mode
If you prefer using docker-compose directly:
# From project root
docker-compose up -d # Start all services
docker-compose logs -f # View logs
docker-compose down # Stop services
docker-compose build # Build images
# Open shell in backend container
make docker-shell
# Execute specific commands
make docker-exec SERVICE=backend COMMAND='pip list'
make docker-exec SERVICE=frontend COMMAND='npm list'
# Manual docker exec
docker exec -it autodevhub-backend bash
docker exec -it autodevhub-frontend sh
# From backend directory
cd backend
# Initialize database
python init_db.py
# Run migrations (if any)
alembic upgrade head
# Install Redis locally
# macOS:
brew install redis
brew services start redis
# Ubuntu:
sudo apt-get install redis-server
sudo systemctl start redis-server
# Or use Docker:
docker run -d -p 6379:6379 redis:alpine
Install these recommended extensions:
{
"recommendations": [
"ms-python.python",
"ms-python.black-formatter",
"ms-python.pylint",
"bradlc.vscode-tailwindcss",
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"ms-vscode.vscode-typescript-next",
"formulahendry.auto-rename-tag",
"christian-kohler.path-intellisense",
"ms-vscode.vscode-json"
]
}
{
"python.defaultInterpreterPath": "./backend/venv/bin/python",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.formatting.provider": "black",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": true
},
"typescript.preferences.quoteStyle": "single",
"javascript.preferences.quoteStyle": "single"
}
# From backend directory
cd backend
# Run all tests
pytest
# Run with coverage
pytest --cov=. --cov-report=html
# Run specific test file
pytest tests/test_story_generator.py
# Run with verbose output
pytest -v
# From frontend directory
cd frontend
# Run unit tests
npm test
# Run tests in watch mode
npm test -- --watch
# Run tests with coverage
npm run test:coverage
# Run E2E tests
npm run test:e2e
# From backend directory
cd backend
# Format code
black .
# Sort imports
isort .
# Lint code
pylint **/*.py
# Type checking
mypy .
# Security check
bandit -r .
# From frontend directory
cd frontend
# Lint JavaScript/TypeScript
npm run lint
# Fix lint issues
npm run lint:fix
# Format code
npm run format
# Type checking
npm run type-check
ImportError: No module named ‘uvicorn’
# Ensure virtual environment is activated
source venv/bin/activate
pip install -r requirements.txt
Database connection errors
# Check database file permissions
ls -la autodevhub.db
# Reinitialize database
rm autodevhub.db
python init_db.py
Claude API errors
# Verify API key in .env file
echo $CLAUDE_API_KEY
# Test API connection
python -c "import anthropic; client = anthropic.Anthropic(api_key='your_key'); print('Connected')"
Module not found errors
# Clear node_modules and reinstall
rm -rf node_modules package-lock.json
npm install
CORS errors
# Check backend CORS configuration in .env
# Ensure frontend URL is in CORS_ORIGINS
Build errors
# Clear Vite cache
npm run build:clean
npm run build
Docker daemon not running
# Check Docker status
make docker-check
# Start Docker (macOS)
open -a Docker
# Start Docker (Linux)
sudo systemctl start docker
Port conflicts
# Check what's using ports 3000 and 5000
lsof -i :3000
lsof -i :5000
# Stop conflicting services or change ports in docker-compose.yml
Container won’t start
# Check container logs
make docker-logs
# Check container status
make docker-status
# Rebuild containers
make docker-rebuild
Permission errors with volumes
# Check and fix directory permissions
mkdir -p data/backend logs/backend
chmod 755 data/backend logs/backend
# Or use Docker cleanup
make docker-clean
make docker-up
Out of disk space
# Clean up Docker resources
make docker-clean
# Remove all unused Docker resources
docker system prune -a --volumes
# Enable debug logging
export DEBUG=true
uvicorn main:app --reload --log-level debug
# Enable debug mode
echo "VITE_DEBUG=true" >> .env.local
npm run dev
For deployment procedures, see Deployment Guide. For contribution guidelines, see Contributing Guidelines.