Skip to content

krtechie/solum-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

52 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Solum AI 🧠

License Stars Issues Last Commit Python FastAPI Next.js

Natural language β†’ validated, executable app schemas A compiler-inspired AI pipeline that converts plain English product descriptions into structured, cross-validated UI, API, database, and auth configurations β€” ready to power real applications.

Live Demo Β  Walkthrough Video

⭐ If you find this useful, give it a star β€” it helps others discover it.


What is Solum AI?

Solum AI treats app generation like a compiler treats source code:

Natural Language β†’ Intent β†’ System Design β†’ Schemas β†’ Validated β†’ Executable

Instead of a single massive prompt, every input goes through a 5-stage pipeline where each stage has a strict typed contract. Outputs are validated, inconsistencies are detected, and broken layers are surgically repaired β€” not blindly retried.


Pipeline Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     SOLUM AI PIPELINE                       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Stage 1  β”‚ Stage 2  β”‚   Stage 3    β”‚  Stage 4   β”‚ Stage 5  β”‚
β”‚  Intent  β”‚  System  β”‚   Schema     β”‚ Refinement β”‚ Validate β”‚
β”‚Extractionβ”‚  Design  β”‚ Generation   β”‚            β”‚ + Repair β”‚
β”‚          β”‚          β”‚  (parallel)  β”‚            β”‚          β”‚
β”‚ NL β†’     β”‚ Intent β†’ β”‚ β†’ UI Schema  β”‚ Cross-layerβ”‚ Pydantic β”‚
β”‚ Intent   β”‚ Entities β”‚ β†’ API Schema β”‚ consistencyβ”‚ + Repair β”‚
β”‚ Schema   β”‚ Pages    β”‚ β†’ DB Schema  β”‚ check +    β”‚ engine   β”‚
β”‚          β”‚ Flows    β”‚ β†’ Auth Schemaβ”‚ LLM fix    β”‚          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              ↓
                    Runtime Artifact Generation
                    (Prisma schema + Express routes)

Stage Details

Stage Name Model Description
1 Intent Extraction Gemini 2.0 Flash Parses NL β†’ structured intent with entities, roles, features
2 System Design DeepSeek R1 Converts intent β†’ app architecture, data model, user flows
3 Schema Generation Gemini + DeepSeek Generates UI, API, DB, Auth schemas in parallel
4 Cross-layer Refinement Gemini 2.0 Flash Detects and fixes inconsistencies across all 4 schemas
5 Validation + Repair Gemma 3 27B Pydantic validation + surgical per-layer repair

Key Design Decisions

1. Compiler Mindset

Each stage has a strict Pydantic v2 contract. LLM output that doesn't conform is rejected immediately β€” not silently passed along. This makes the system behave like a typed compiler, not a chatbot.

2. Parallel Schema Generation

Stage 3 runs all 4 schema generators (asyncio.gather) simultaneously. This cuts latency by ~60% compared to sequential generation while maintaining independent validation per schema.

3. Surgical Repair (not brute retry)

When Stage 5 detects issues, it:

  • Groups errors by layer (UI / API / DB / Auth)
  • Repairs in dependency order: DB β†’ Auth β†’ API β†’ UI
  • Re-generates only the broken layer with errors as explicit context
  • Re-validates after each repair

This avoids cascading failures and wasted LLM calls.

4. Cross-layer Consistency Checks

Before repair, a deterministic checker verifies:

  • Every UI component's api_endpoint exists in the API schema
  • Every API endpoint's db_table exists in the DB schema
  • Every API field exists as a column in its table
  • Every role referenced in UI/API is defined in Auth
  • Every protected route in Auth has a matching UI page
  • All DB foreign keys reference real tables

5. Execution Awareness

Output is not just JSON β€” it directly generates:

  • A Prisma schema (.prisma file) from the DB schema
  • Express.js route stubs with Zod validators from the API schema
  • A .env template with all required variables
  • Step-by-step setup instructions

Tech Stack

Backend

Component Technology
Framework FastAPI + uvicorn
LLM Access OpenRouter (free tier)
Validation Pydantic v2
Streaming Server-Sent Events (SSE)
Eval logging SQLite + aiosqlite
Concurrency Python asyncio

Frontend

Component Technology
Framework Next.js 14 (App Router)
Language TypeScript
Styling CSS variables + Tailwind
Streaming Fetch + ReadableStream

LLM Models (all free via OpenRouter)

Role Model
Primary (fast stages) google/gemini-2.0-flash-exp:free
Complex reasoning deepseek/deepseek-r1:free
Surgical repair google/gemma-3-27b-it:free
Fallback meta-llama/llama-3.3-70b-instruct:free

Infrastructure (all free)

Service Platform
Backend Render free tier
Frontend Vercel hobby
Database SQLite on disk

Project Structure

solum-ai/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ main.py                  # FastAPI app, SSE endpoint, metrics API
β”‚   β”œβ”€β”€ requirements.txt
β”‚   β”œβ”€β”€ llm/
β”‚   β”‚   β”œβ”€β”€ client.py            # OpenRouter client, retry + fallback logic
β”‚   β”‚   └── prompts.py           # All stage prompts (strict JSON-only)
β”‚   β”œβ”€β”€ schemas/
β”‚   β”‚   └── models.py            # Pydantic v2 contracts for all layers
β”‚   β”œβ”€β”€ pipeline/
β”‚   β”‚   β”œβ”€β”€ stage1_intent.py     # NL β†’ IntentSchema
β”‚   β”‚   β”œβ”€β”€ stage2_design.py     # Intent β†’ DesignSchema
β”‚   β”‚   β”œβ”€β”€ stage3_schemas.py    # Parallel UI + API + DB + Auth generation
β”‚   β”‚   β”œβ”€β”€ stage4_refine.py     # Cross-layer refinement
β”‚   β”‚   β”œβ”€β”€ stage5_validate.py   # Validation + surgical repair engine
β”‚   β”‚   └── runner.py            # Pipeline orchestrator + SSE emitter
β”‚   β”œβ”€β”€ validator/
β”‚   β”‚   └── cross_layer.py       # Deterministic consistency checker
β”‚   β”œβ”€β”€ runtime/
β”‚   β”‚   └── codegen.py           # Prisma schema + Express route generator
β”‚   └── eval/
β”‚       β”œβ”€β”€ db.py                # SQLite metrics logger
β”‚       └── dataset.json         # 20 evaluation prompts (10 real + 10 edge)
└── frontend/
    β”œβ”€β”€ app/
    β”‚   β”œβ”€β”€ page.tsx             # Main generate page
    β”‚   β”œβ”€β”€ metrics/page.tsx     # Metrics dashboard page
    β”‚   β”œβ”€β”€ layout.tsx           # Root layout + nav
    β”‚   └── globals.css          # Design tokens + base styles
    β”œβ”€β”€ components/
    β”‚   β”œβ”€β”€ PromptInput.tsx      # Prompt textarea + examples
    β”‚   β”œβ”€β”€ PipelineProgress.tsx # Live stage-by-stage progress
    β”‚   β”œβ”€β”€ SchemaViewer.tsx     # Tabbed output viewer
    β”‚   └── MetricsDashboard.tsx # Eval metrics UI
    └── lib/
        β”œβ”€β”€ types.ts             # All TypeScript types
        └── api.ts               # SSE streaming + fetch helpers

Running Locally

Backend

cd backend
python -m venv venv

# Windows
venv\Scripts\activate

# Mac/Linux
source venv/bin/activate

pip install -r requirements.txt
cp .env.example .env
# Add your OPENROUTER_API_KEY to .env

uvicorn main:app --reload --port 8000

Frontend

cd frontend
npm install
cp .env.example .env.local
# Set NEXT_PUBLIC_API_URL=http://localhost:8000

npm run dev

Open http://localhost:3000


Evaluation Framework

Solum AI includes a built-in evaluation dataset of 20 prompts tracked across:

Metric Description
Success rate % of runs that complete all 5 stages
Avg latency End-to-end pipeline time in seconds
Avg retries LLM retries per run (rate limit handling)
Repairs performed Surgical layer repairs per run
Failure types Breakdown of what causes failures

Dataset Breakdown

  • 10 real prompts β€” CRM, e-commerce, LMS, job board, booking system, etc.
  • 10 edge cases β€” single word, vague, conflicting requirements, feature creep, jargon-only, etc.

Live metrics are available at /metrics.


Cost vs Quality Tradeoffs

Decision Tradeoff
Parallel Stage 3 +speed, +cost (4 calls at once) vs sequential
DeepSeek R1 for design/DB +quality on complex schemas, +latency
Gemma for repair only Lower cost for targeted fixes vs using primary model
Max 2 refinement rounds Caps cost, accepts minor residual inconsistencies
Max 3 repair attempts per layer Prevents infinite loops, accepts rare failures
SQLite over managed DB Zero cost, acceptable for demo scale

API Reference

POST /generate

Stream pipeline execution as SSE.

Request:

{ "prompt": "string", "run_id": "optional uuid" }

SSE Events:

stage_start          β†’ { stage, name }
stage_complete       β†’ { stage, name, latency_ms, preview }
stage_error          β†’ { stage, name, error }
clarification_needed β†’ { questions, assumptions }
complete             β†’ { output: SolumOutput }
error                β†’ { message }
done                 β†’ (stream end)

GET /metrics

Returns aggregated eval metrics from SQLite.

GET /eval/dataset

Returns the 20-prompt evaluation dataset.

GET /health

Health check endpoint.


License

MIT Β© 2026 Solum AI

About

🧠 AI compiler that converts natural language into validated, executable app schemas β€” UI, API, DB, and auth configs via a multi-stage generation pipeline with automatic repair.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors