Generate production SaaS systems with AI-ready architecture.

MVP Factory turns the repeated parts of a serious product into a reusable baseline: tenant-safe backend, composed frontend, billing rails, AI modules, tests, and deployment gates.

factory-previewready

Generation command

make create

01

Name the product

Capture display name, slug, output directory, and deployment defaults before any files are written.

02

Choose the architecture

Select Minimal, Standard, Full AI, or Enterprise, then choose multi-tenant or single-tenant generation.

03

Toggle capabilities

Enable billing, file uploads, notifications, invitations, RAG, agents, AI API, and workflow modules only when needed.

Next.js 16

app router interface layer

FastAPI

service-first backend spine

Postgres

Schema-per-tenant isolation

633

backend tests tracked as factory signal

Next.js 16

app router interface layer

FastAPI

service-first backend spine

Postgres

Schema-per-tenant isolation

633

backend tests tracked as factory signal

A factory baseline shaped like a product team already built it.

The reference site uses repeated calm blocks to explain a complex AI product. Here, those blocks explain the reusable architecture layers MVP Factory gives every generated app.

BASELINE

Core SaaS baseline

A full-stack starter that treats tenancy, auth, permissions, billing, audit, and CI as foundation, not backlog.

Next.js App RouterFastAPI service layerPostgres migrationsJazzCash lifecycle

BOOTSTRAP

Generation workflow

The factory wizard turns a product name, preset, module mix, and tenancy model into a ready project structure.

Project presetsModule pruningTenancy modesDeployment defaults

INTELLIGENCE

AI platform layer

Provider-neutral inference, RAG, agents, workflows, evals, and observability plug into the baseline without leaking into app code.

Provider fallbackPrompt registryRAG ingestionAsync evaluation

GUARDRAILS

Security and correctness

Tenant-first search paths, permission gates, audit events, weak-secret checks, and CORS rules make safety a default behavior.

Tenant schemasRBAC checksAudit sinkConfig validation

Intelligence without scattering AI concerns through the app.

Cosmoq presents automation as clean capability groups. MVP Factory maps that method to provider contracts, compliance gates, RAG, agents, workflows, and evaluation loops.

AI 01

Provider-neutral inference

OpenAI, Anthropic, Gemini, and local providers sit behind one provider contract with retry and fallback.

AI 02

Compliance pipeline

PII redaction, content safety, data residency, token budgets, and audit logging wrap every full AI call.

AI 03

RAG and citations

Document ingestion, hybrid search, reranking, streaming chat, and source citations ship as a cohesive slice.

AI 04

Agent runtime

A ReAct loop, tool registry, run traces, and long-term memory give generated products extensible automation.

AI 05

Workflow DAGs

LLM calls, tools, code, and condition steps compose into retryable workflows with parallel branches.

AI 06

Evaluation and cost visibility

Async evaluators, usage tracking, and per-model cost calculations keep AI behavior observable after launch.

Add only the rails your product actually needs.

Optional modules are designed to prune cleanly. A generated project that disables a capability should compile without stale references.

billing

Billing rail

JazzCash hosted checkout, signed return handling, usage metering, and subscription routes.

StandardFull AIEnterprise

file_uploads

Storage intake

Multipart upload endpoints, object storage adapters, quotas, and tenant-aware file records.

StandardFull AIEnterprise

notifications

Signal bus

Email and in-app notifications with templates, delivery workers, and user preferences.

StandardFull AIEnterprise

invitations

Clinic access

Invite-by-email flows, token validation, and clinic membership on accept.

Enterprise

ai_api

Inference API

Direct completions, streaming, and structured output endpoints behind the compliance pipeline.

Full AIEnterprise

rag

Knowledge fabric

Knowledge bases, ingestion loaders, hybrid search, reranking, and citation-ready retrieval.

Full AIEnterprise

agents

Agent runtime

ReAct execution, built-in tools, memory, and traceable agent runs for operational workflows.

Full AIEnterprise

workflows

Workflow engine

DAG-based LLM, tool, code, and condition steps with retries and parallel branches.

Full AIEnterprise

From product prompt to generated architecture.

The factory wizard behaves like an architectural intake form: it captures the system shape, then emits a project that already follows the repository layer boundaries.

project generation4 steps

$ make create

Display name: Medical AI Scribe

Preset: Full AI

Modules: billing, rag, agents, workflows

Tenancy: multi-tenant

Validating module specs and migration tracks

01

Name the product

make create

Capture display name, slug, output directory, and deployment defaults before any files are written.

02

Choose the architecture

Select Minimal, Standard, Full AI, or Enterprise, then choose multi-tenant or single-tenant generation.

03

Toggle capabilities

Enable billing, file uploads, notifications, invitations, RAG, agents, AI API, and workflow modules only when needed.

04

Validate the factory

python bootstrap/validate_spec.py

Module specs, prune rules, migrations, CI templates, and generated docs are checked before handoff.

The generated app inherits the safety checks first.

The reference security section maps naturally to the strongest MVP Factory promise: tenant correctness and deployment readiness are built into the baseline.

Tenant boundary

Schema-per-tenant isolation

Every tenant request sets `search_path` to the clinic schema first, then public, preventing table shadowing.

Mutation boundary

Service-owned permission checks

Routers validate and delegate; services own authorization, orchestration, and write-side audit behavior.

Configuration boundary

Runtime safety checks

Weak secrets, permissive production CORS, and unsafe RAG paths fail fast instead of becoming deployment surprises.

Recovery boundary

Audit events stay recoverable

Audit sinks are fire-and-forget, but failures are logged so user-impacting writes can be recovered from app logs.

TypeScript

0

Frontend type errors tolerated before build

Backend tests

633

Recorded test corpus across service, tenancy, AI, and bootstrap slices

Factory smoke

on

Generated project validation catches broken module pruning and stale templates

CI stages

6

Lint, test, smoke, build, staging migration, production migration gate

Start from a baseline that already knows the hard parts.

Use the factory as the first draft of a serious SaaS product, then spend your energy on the domain that makes it yours.

Sign in