Essential Development Tools
Core tools every AI API proxy developer needs in their environment:
Runtime Environments
- Node.js 18+ LTS
- Python 3.9+
- Docker Desktop
- Docker Compose
API Testing
- Postman or Insomnia
- curl / httpie
- HTTPie Desktop
- Newman (CLI runner)
Code Quality
- ESLint / Pylint
- Prettier / Black
- Git with GitFlow
- Pre-commit hooks
IDE Configuration
VS Code Setup
Recommended extensions for API development:
| Extension | Purpose | Configuration |
|---|---|---|
| REST Client | Test APIs directly in editor | Enable .http file support |
| Thunder Client | Postman alternative | Sync collections |
| Docker | Container management | Enable compose support |
| YAML | Configuration editing | Schema validation |
| GitLens | Git supercharged | Enable blame info |
| Error Lens | Inline error display | Show warnings inline |
Recommended Settings
{
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"files.autoSave": "afterDelay",
"files.autoSaveDelay": 1000,
"editor.quickSuggestions": {
"strings": true
},
"yaml.schemas": {
"https://json.schemastore.org/docker-compose.json": "docker-compose*.yml"
}
}
Environment Variables Management
Project Structure
project/
โโโ .env.example # Template file (commit this)
โโโ .env # Local secrets (git-ignored)
โโโ .env.test # Test environment
โโโ .env.production # Production config
โโโ config/
โโโ development.yaml # Non-secret config
โโโ test.yaml
โโโ production.yaml
.env.example Template
# API Provider Keys
OPENAI_API_KEY=sk-your-key-here
ANTHROPIC_API_KEY=sk-ant-your-key-here
# Gateway Configuration
GATEWAY_PORT=8080
ADMIN_PORT=9090
LOG_LEVEL=debug
# Database
DATABASE_URL=postgresql://localhost:5432/gateway_dev
REDIS_URL=redis://localhost:6379
# Security
JWT_SECRET=dev-secret-change-in-production
API_KEY_SALT=dev-salt
Security Best Practice
Never commit .env files. Use .env.example as a template and inject secrets via CI/CD or secret management tools.
Testing Framework Setup
Unit Testing (Python)
# requirements-test.txt
pytest>=7.0.0
pytest-cov>=4.0.0
pytest-asyncio>=0.21.0
httpx>=0.24.0
# pytest.ini
[tool:pytest]
testpaths = tests
python_files = test_*.py
asyncio_mode = auto
Integration Testing
import pytest
from httpx import AsyncClient
@pytest.fixture
async def client():
async with AsyncClient(base_url="http://localhost:8080") as client:
yield client
async def test_health_endpoint(client):
response = await client.get("/health/live")
assert response.status_code == 200
assert response.json()["status"] == "ok"
async def test_api_completion(client):
response = await client.post(
"/v1/completions",
headers={"Authorization": "Bearer test-key"},
json={"model": "gpt-3.5", "prompt": "Hello"}
)
assert response.status_code == 200
Development Workflow
Daily Development Cycle
- Start environment: docker-compose up -d
- Run tests: pytest tests/ -v
- Make changes: Edit code with live reload enabled
- Test manually: Use REST Client or Postman
- Check logs: docker-compose logs -f api-gateway
- Run linting: eslint . or pylint src/
- Commit changes: Git commit with meaningful message
- Push to branch: Create PR for code review
Git Branching Strategy
- main: Production-ready code
- develop: Integration branch
- feature/*: New features
- bugfix/*: Bug fixes
- hotfix/*: Critical production fixes
Debugging Tools
Logging Configuration
import logging
logging.basicConfig(
level=logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
handlers=[
logging.FileHandler('logs/gateway.log'),
logging.StreamHandler()
]
)
# Enable HTTP request logging
logging.getLogger("httpx").setLevel(logging.DEBUG)
logging.getLogger("uvicorn").setLevel(logging.DEBUG)
Useful Debug Commands
# View real-time logs
docker-compose logs -f --tail=100 api-gateway
# Check process status
docker-compose top
# Inspect network
docker network ls
docker network inspect project_default
# Debug inside container
docker-compose exec api-gateway sh
# Check resource usage
docker stats