A multi-stage pipeline that converts natural language into structured, validated, executable application configurations.
User Input (Natural Language)
│
▼
┌─────────────────────────────────────────────────────────────┐
│ PIPELINE STAGES │
├─────────────────────────────────────────────────────────────┤
│ 1. INTENT EXTRACTION │
│ - Parse entities, roles, features from text │
│ - Handle vague/underspecified inputs │
│ - Make assumptions and document them │
│ └─────────────────┬───────────────────────────────────┘
│ ▼ │
│ 2. SYSTEM DESIGN │
│ - Determine app type (CRM, CMS, Ecommerce, etc) │
│ - Design entity relationships │
│ - Plan security architecture │
│ - Detect third-party integrations │
│ └─────────────────┬───────────────────────────────────┘
│ ▼ │
│ 3. SCHEMA GENERATION │
│ - Generate UI schema (pages, components) │
│ - Generate API schema (endpoints, methods) │
│ - Generate DB schema (tables, columns, relations) │
│ - Generate Auth rules (roles, permissions) │
│ └─────────────────┬───────────────────────────────────┘
│ ▼ │
│ 4. VALIDATION + REPAIR ENGINE │
│ - Cross-layer consistency checks │
│ - Schema validation against contracts │
│ - Automatic repair of missing/invalid parts │
│ └─────────────────┬───────────────────────────────────┘
│ ▼ │
│ 5. EXECUTION RUNTIME │
│ - Execute generated schemas │
│ - Validate API-DB-UI consistency │
│ - Simulate API calls to verify correctness │
└─────────────────────────────────────────────────────────────┘
- Input: Natural language prompt
- Output: Structured intent with entities, roles, features, flows
- Handles: Vague prompts by making assumptions
- Key Methods:
_extract_entities()- Find business objects (contacts, users, etc)_extract_roles()- Identify user types (admin, user, guest)_extract_features()- Determine required functionality
- Input: Intent dictionary
- Output: Architecture design with stack, relations, security
- Key Methods:
_detect_app_type()- CRM, CMS, Ecommerce, SaaS_design_entities()- Add relations, indexes_detect_integrations()- Stripe, SendGrid, Auth0
- Input: Intent + Design
- Output: UI, API, DB, Auth schemas
- Key Methods:
_generate_ui()- Pages, routes, components_generate_api()- REST endpoints with validation_generate_db()- SQL tables with proper types
- Purpose: Ensure consistency across all layers
- Validation Checks:
- All entities have required fields
- API endpoints reference existing DB tables
- UI components map to defined entities
- No circular dependencies
- Repair: Auto-fills missing defaults (e.g., timestamps, access rules)
- Purpose: Execute/validate generated schemas
- Methods:
execute_schema()- Simulate schema creationvalidate_endpoints()- Check API-DB consistencysimulate_api_call()- Test endpoint behavior
- Uses structured keyword matching, not LLM generation
- Same input → consistent output
- Trades flexibility for reliability
- Every schema validated against JSON Schema contracts
- Cross-layer checks prevent inconsistencies
- Repair engine fixes issues automatically
- All assumptions explicitly tracked in
intent.assumptions - User can review what was assumed
- Enables informed debugging
- Vague prompts → add default entities/features
- Missing data → use sensible defaults
- Invalid combinations → repair to valid state
| Metric | Value |
|---|---|
| Success Rate | 100% (20/20 prompts) |
| Avg Latency | < 10ms |
| Avg Entities Generated | 1.4 |
| Avg Pages Generated | 4.9 |
| Avg Endpoints Generated | 10.2 |
- "Build a CRM with login, contacts, dashboard, role-based access, and premium plan with payments. Admins can see analytics."
- "Create an ecommerce store with products, cart, checkout, and order management"
- "Build a blog with articles, categories, comments, and user authentication"
- "Build something"
- "Create an application"
- "Full featured app with everything"
| Approach | Cost | Quality | Latency |
|---|---|---|---|
| Single LLM Call | Low | Variable | ~1-2s |
| Our Pipeline | Low | Consistent | <10ms |
| Multi-Agent | High | High | >5s |
Tradeoff: We sacrifice flexibility for deterministic, fast output with guaranteed validity.
cd /home/acer_/compiler-gen
# Install dependencies
pip install flask jsonschema
# Run evaluation
python3 evaluator.py
# Start API server
python3 api.py
# Test single prompt
python3 -c "
from pipeline.main import Pipeline
p = Pipeline()
output, valid = p.run('Build a CRM with login, contacts')
print('Valid:', valid)
"compiler-gen/
├── pipeline/
│ ├── __init__.py
│ ├── intent_extractor.py # Stage 1
│ ├── system_designer.py # Stage 2
│ ├── schema_generator.py # Stage 3
│ ├── validator.py # Stage 4 (validation + repair)
│ └── main.py # Orchestrator
├── runtime/
│ ├── __init__.py
│ └── minimal_runtime.py # Stage 5 (execution)
├── schemas/
│ ├── intent_schema.json
│ ├── ui_schema.json
│ ├── api_schema.json
│ └── db_schema.json
├── evaluator.py # Evaluation framework
├── api.py # Flask API
├── index.html # Demo UI
└── requirements.txt
- No LLM Integration: Could enhance intent extraction and schema generation
- Limited Entity Types: Only 17 predefined entity types
- No Visual Builder: Could generate actual UI code
- Single Tenant: Doesn't support multi-tenant architectures