Skip to content

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 workflow

After 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 workflow

API Endpoints

Code Generation

MethodEndpointDescription
POST/api/generateGenerate project ZIP from SQL/OpenAPI
POST/api/validateValidate schema without generating
GET/api/generatorsList available generators
GET/api/healthHealth check

Live Preview

MethodEndpointDescription
POST/api/previewCreate preview session
GET/api/previewList active sessions
GET/api/preview/{sessionId}Get session details
DELETE/api/preview/{sessionId}Stop session
POST/api/preview/{sessionId}/reloadReload with schema changes
GET/api/preview/healthPreview health check
WS/ws/preview/{sessionId}WebSocket updates

GitHub Integration

MethodEndpointDescription
GET/api/github/authorizeInitiate OAuth flow
GET/api/github/authorize/urlGet OAuth URL
GET/api/github/callbackOAuth callback
GET/api/github/userGet authenticated user
GET/api/github/auth/statusCheck auth status
GET/api/github/reposList user repositories
POST/api/github/reposCreate new repository
POST/api/github/repos/{owner}/{repo}/pushPush generated code
POST/api/github/pushPush to repo (alternative)
POST/api/github/logoutRevoke OAuth token

AI Code Review

MethodEndpointDescription
POST/api/reviewReview code with LLM
GET/api/review/statusService status
GET/api/review/healthHealth 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

Released under the MIT License.