Koko Koala Logo
Koko
CLI

Cross-Validation Safety Rules

Real-Time Compatibility Engine

Unlike traditional scaffolding generators that generate broken templates when conflicting options are selected, Koko enforces strict validation rules via `internal/compatibility`. If invalid flags are passed via terminal or selected in the TUI, the CLI exits immediately with clear error diagnostics and recommended solutions.

The 7 Safety Rules

Rule 1: Both Frontend and Backend set to None: A project cannot have both sides empty; at least one Frontend or Backend must be selected.
Rule 2: Client SPAs connecting to DBs without a Backend: Pure client-side SPAs (React + Vite or Svelte) cannot embed direct database drivers or ORMs without a server API.
Rule 3: Database vs ORM consistency: You cannot select an ORM if the database is set to "none".
Rule 4: Relational SQL vs NoSQL Document ORMs: Drizzle, SQLAlchemy, and GORM cannot be used with MongoDB. Mongoose cannot be used with SQL databases (PostgreSQL, MySQL, SQLite).
Rule 5: Language Runtime vs ORM Matrix: SQLAlchemy is exclusive to Python. GORM is exclusive to Go. Drizzle, Prisma, and Mongoose are exclusive to Node.js / TypeScript.
Rule 6: Package Manager Compatibility: Standalone Go backends require `go_mod`. Standalone Python backends require `pip` or `uv`.
Rule 7: Auth Provider Compatibility: Better-Auth requires a Node.js/TypeScript runtime. NextAuth.js requires Next.js as the frontend.

Example Error Output

Running a conflicting command triggers informative diagnostic feedback:

Terminal
koko init my-app -f react -b none --database postgres --orm drizzle # CLI Output: # ✗ Incompatible stack error: # Una aplicación SPA cliente (react) sin backend no puede conectarse directamente a la base de datos 'postgres' # Suggestion: Agrega un backend (como Express, Hono, FastAPI o Go Chi) o usa un framework fullstack (como Next.js o Nuxt)