APiGen Server
Enterprise HTTP server for code generation with live preview, GitHub integration, and AI-powered code review.
Overview
The Problem: Manual Code Generation Workflows
Before APiGen Server:
1. Developer writes SQL/OpenAPI locally
2. Runs CLI tool: `apigen generate --input schema.sql`
3. Downloads ZIP, extracts files
4. Manually reviews 100+ generated files
5. Finds issue → Repeat from step 1
6. No live preview, no collaboration
7. No CI/CD integration
Result: 30+ minutes per iteration, siloed workflowAfter APiGen Server:
1. Browser → paste SQL schema
2. Real-time WebSocket preview shows changes instantly
3. Edit schema → see updates in <500ms
4. AI code review highlights issues before download
5. GitHub integration → push to repo with 1 click
6. Team collaborates on same preview session
Result: <5 minutes per iteration, collaborative workflowAPI Endpoints
Code Generation
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/generate | Generate project ZIP from SQL/OpenAPI |
| POST | /api/validate | Validate schema without generating |
| GET | /api/generators | List available generators |
| GET | /api/health | Health check |
Live Preview
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/preview | Create preview session |
| GET | /api/preview | List active sessions |
| GET | /api/preview/{sessionId} | Get session details |
| DELETE | /api/preview/{sessionId} | Stop session |
| POST | /api/preview/{sessionId}/reload | Reload with schema changes |
| GET | /api/preview/health | Preview health check |
| WS | /ws/preview/{sessionId} | WebSocket updates |
GitHub Integration
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/github/authorize | Initiate OAuth flow |
| GET | /api/github/authorize/url | Get OAuth URL |
| GET | /api/github/callback | OAuth callback |
| GET | /api/github/user | Get authenticated user |
| GET | /api/github/auth/status | Check auth status |
| GET | /api/github/repos | List user repositories |
| POST | /api/github/repos | Create new repository |
| POST | /api/github/repos/{owner}/{repo}/push | Push generated code |
| POST | /api/github/push | Push to repo (alternative) |
| POST | /api/github/logout | Revoke OAuth token |
AI Code Review
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/review | Review code with LLM |
| GET | /api/review/status | Service status |
| GET | /api/review/health | Health check |
WebSocket Protocol
Message Types
json
// Status update
{
"type": "status",
"status": "generating",
"progress": 45,
"message": "Generating controllers..."
}
// File change
{
"type": "file_changed",
"path": "src/main/java/com/example/User.java",
"diff": "unified diff content"
}
// Error
{
"type": "error",
"message": "Syntax error at line 15"
}
// Completion
{
"type": "complete",
"filesGenerated": 42,
"duration": "3.5s"
}Docker Deployment
bash
# Build image
docker build -t apigen-server:latest ./generator/server
# Run container
docker run -d \
-p 8080:8080 \
-e GITHUB_CLIENT_ID=your_id \
-e GITHUB_CLIENT_SECRET=your_secret \
-e OPENAI_API_KEY=your_key \
-v /var/run/docker.sock:/var/run/docker.sock \
apigen-server:latest