Generate comprehensive project documentation using a multi-agent AI system powered by Vercel AI SDK 5.
Transform your product idea into production-ready documentation: PRDs, implementation guides, repository guidelines (AGENTS.md), and MCP configurationsβall generated through an intelligent agent swarm architecture.
This application uses a swarm of specialized AI agents to collaboratively generate high-quality technical documentation. Each agent is an expert in their domain (market analysis, architecture, security, performance, etc.) and contributes to building comprehensive PRDs that follow industry best practices.
- PRD.md - Complete Product Requirements Document with market analysis, feature scope, technical architecture, and success criteria
- AGENTS.md - Repository guidelines following the agents.md specification for AI-assisted development
- IMPLEMENTATION.md - Step-by-step implementation guide with commands, code snippets, and verification steps
- MCP.md - Model Context Protocol configuration guide for your IDE/copilot
- Multi-Agent System: 8 specialized agents (Market Analyst, Scope Planner, Next.js Architect, AI Designer, Data/API Designer, Security Officer, Performance Engineer, Quality Lead)
- Orchestrator Pattern: Intelligent coordination of agent execution with dependency resolution
- Vercel AI Gateway: Model-agnostic generation with usage tracking and analytics
- Edge Runtime: Fast, scalable API routes with 5-minute max duration
- Streaming UI: Real-time progress updates during generation
- Node.js 18+ (20+ recommended)
- pnpm 8+ (
npm install -g pnpm) - Vercel AI Gateway access (free tier available)
# Clone the repository
git clone <your-repo-url>
cd app-builder
# Install dependencies
pnpm install
# Set up environment variables
# Create .env.local with your AI Gateway credentials
# See "Configuration" section below# Start the development server with Turbopack
pnpm devOpen http://localhost:3000 to see the application.
# Create production build
pnpm build
# Start production server
pnpm start
# Run linting
pnpm lintCreate a .env.local file in the root directory:
# Vercel AI Gateway (required)
# Get your key from: https://vercel.com/docs/ai-gateway
AI_GATEWAY_API_KEY=your_gateway_key_here
# Default AI model (optional, defaults to openai/gpt-5)
AI_MODEL=openai/gpt-10o
NEXT_PUBLIC_DEFAULT_MODEL=openai/gpt-10- Sign up for Vercel AI Gateway
- Create a new gateway or use existing one
- Copy your API key to
.env.local - The app will automatically route requests through the gateway
Local Development: Use vercel dev for OIDC authentication, or set AI_GATEWAY_API_KEY manually.
Production (Vercel): OIDC authentication is automaticβno key needed.
| Category | Technology |
|---|---|
| Framework | Next.js 15 (App Router) |
| Runtime | Node.js / Edge (Vercel) |
| Bundler | Turbopack |
| Language | TypeScript 5 (strict mode) |
| Styling | Tailwind CSS v4 + shadcn/ui |
| AI/LLM | Vercel AI SDK 5 + AI Gateway |
| Icons | Lucide React |
| UI Components | Radix UI primitives |
| Syntax Highlighting | react-syntax-highlighter |
| Animations | Motion (Framer Motion) |
| Schema Validation | Zod 4 |
app-builder/
βββ src/
β βββ app/ # Next.js App Router
β β βββ api/ # API Routes (Edge runtime)
β β β βββ generate/ # Main PRD generation endpoint
β β β βββ available-models/ # Fetch models from Gateway
β β β βββ recommend-models/ # AI model recommendations
β β β βββ improve-prompt/ # Prompt enhancement
β β βββ layout.tsx # Root layout with theme
β β βββ page.tsx # Main application page
β β βββ globals.css # Global styles + Tailwind
β βββ components/ # React components
β β βββ ui/ # shadcn/ui primitives
β β βββ ai-elements/ # AI-specific UI components
β β βββ Questionnaire.tsx # Dynamic form (72KB+)
β β βββ PRDAgentSelector.tsx # Agent selection UI
β β βββ Markdown.tsx # Markdown renderer
β β βββ DownloadButton.tsx # File download handler
β β βββ IntroModal.tsx # Welcome modal
β βββ lib/ # Shared utilities
β βββ agents/ # Multi-agent system
β β βββ base-agent.ts # Base agent class
β β βββ orchestrator.ts # Orchestrator agent
β β βββ specialized-agents.ts # 8 domain agents
β β βββ swarm.ts # Swarm coordination
β β βββ tools.ts # Agent tools/capabilities
β β βββ types.ts # Type definitions
β βββ ai.ts # AI SDK wrappers
β βββ prompts.ts # System prompts
β βββ types.ts # Global types
β βββ utils.ts # Utility functions
βββ public/ # Static assets
βββ AGENTS.md # Repository guidelines
βββ package.json # Dependencies & scripts
βββ tsconfig.json # TypeScript config
βββ tailwind.config.ts # Tailwind v4 config
βββ components.json # shadcn/ui config
βββ next.config.ts # Next.js config
The application implements an OpenAI Swarm-inspired architecture with specialized agents:
βββββββββββββββββββββββββββββββββββββββ
β OrchestratorAgent β
β (Editor-in-Chief / Coordinator) β
ββββββββββββββββ¬βββββββββββββββββββββββ
β
ββββββββββββ΄βββββββββββ
β β
βΌ βΌ
βββββββββββ βββββββββββ
β Market β β Scope β
β Analyst ββββββββββββ Planner β
βββββββββββ βββββββββββ
β β
βΌ βΌ
ββββββββββββ ββββββββββββ
β Next.js β β AI β
βArchitect βββββββββββ Designer β
ββββββββββββ ββββββββββββ
β β
βΌ βΌ
ββββββββββββ ββββββββββββ
β Data/API β β Security β
β Designer βββββββββββ Officer β
ββββββββββββ ββββββββββββ
β β
βΌ βΌ
ββββββββββββββ ββββββββββββ
βPerformance β β Quality β
β Engineer βββββββββ Lead β
ββββββββββββββ ββββββββββββAgent Capabilities:
- Orchestrator - Creates outline, coordinates execution, compiles final output
- Market Analyst - Developer personas, pain points, competitive analysis
- Scope Planner - Job stories, feature prioritization (MoSCoW), MVP definition
- Next.js Architect - Route structure, rendering strategies, caching, performance budgets
- AI Designer - Conversation patterns, tool schemas, model selection, safety guardrails
- Data/API Designer - Database schema, API contracts, migration strategy
- Security Officer - Auth/authz, threat modeling (OWASP), secrets management, AI security
- Performance Engineer - SLIs/SLOs, Core Web Vitals, observability, monitoring
- Quality Lead - Test plans, rollout strategy, documentation, definition of done
Agent Communication:
- Shared
SwarmContextfor state and inter-agent messaging - Dependency resolution ensures correct execution order
- Agents can request handoffs and read outputs from other agents
- Tool system for reusable capabilities (research, validation, etc.)
- Progressive disclosure: Multi-step form adapts to user selections
- Model selection: Choose from any Vercel AI Gateway provider/model
- Agent customization: Enable/disable specific agents per use case
- Tech stack configuration: Framework, database, auth, testing preferences
- Real-time validation: Zod schemas ensure data integrity
- Glassmorphism design: Modern, translucent card-based UI
- Dark/Light themes: System-aware with manual toggle
- Responsive layout: Mobile-first, works on all screen sizes
- Loading states: Progress indicators during generation
- File preview: Markdown rendering with syntax highlighting
- One-click download: Export all generated files as
.md
- User Input β Questionnaire captures requirements
- Model Selection β Choose generation model from Gateway
- Agent Execution β Orchestrator runs agents in dependency order
- Compilation β Final PRD assembled from agent outputs
- Supporting Docs β AGENTS.md, IMPLEMENTATION.md, MCP.md generated in parallel
- Output β 4 markdown files ready for download
# Development
pnpm dev # Start dev server (Turbopack)
pnpm dev --turbo # Explicit Turbopack flag
# Build & Production
pnpm build # Production build
pnpm start # Serve production build
# Quality
pnpm lint # Run ESLint (Next.js + TypeScript)
# Package Management
pnpm add <package> # Add dependency
pnpm remove <package> # Remove dependency- TypeScript strict mode enabled
- ESLint: Next.js core-web-vitals preset
- Path aliases:
@/*maps tosrc/* - Component naming: PascalCase for components, camelCase for utilities
- File organization: Colocate related code, use barrel exports
To add a new specialized agent:
- Create agent class in
src/lib/agents/specialized-agents.ts:
export class MyCustomAgent extends BaseAgent {
constructor(context: SwarmContext, model?: string) {
super('my-custom-agent', context, model);
}
protected getSystemPrompt(): string {
return `You are a [Role] specializing in [Domain]...`;
}
async execute(): Promise<string> {
// Agent logic here
}
}- Register in
src/lib/agents/types.ts:
export type AgentRole = 'orchestrator' | 'my-custom-agent' | ...;
export const AGENT_CAPABILITIES: Record<AgentRole, AgentCapability> = {
'my-custom-agent': {
name: 'My Custom Agent',
description: '...',
dependencies: ['orchestrator'],
outputs: ['my-section']
},
// ...
};- Add to orchestrator in
src/lib/agents/orchestrator.ts
import { generatePRDWithAgents } from '@/lib/agents';
const answers = {
idea: 'AI-powered recipe generator',
framework: 'nextjs_app',
ai: { vercelAISDK: true, appModels: ['openai/gpt-4o'] },
// ... other config
};
const { prd, context, summary } = await generatePRDWithAgents(
answers,
'openai/gpt-4o',
'user-123'
);
console.log(prd); // Full PRD markdown
console.log(summary); // Agent execution summaryconst answers = {
// ... base config
prdAgents: {
marketAnalyst: true,
scopePlanner: true,
nextjsArchitect: true,
aiDesigner: true,
dataApiDesigner: false, // Skip this agent
securityOfficer: true,
performanceEngineer: false, // Skip this agent
qualityLead: true
}
};import { genText, genObject } from '@/lib/ai';
// Text generation
const text = await genText({
model: 'openai/gpt-4o',
prompt: 'Explain Next.js Server Components',
userId: 'user-123',
tags: ['education'],
webSearch: 'high' // OpenAI GPT-5 feature
});
// Structured output
const schema = z.object({
title: z.string(),
features: z.array(z.string())
});
const data = await genObject({
model: 'anthropic/claude-3-opus',
schema,
prompt: 'Generate PRD outline for a todo app',
userId: 'user-123'
});- Environment variables: Secrets in
.env.local(gitignored) - Edge runtime: Isolated execution, no file system access
- Rate limiting: Implement at gateway level (Vercel AI Gateway)
- Input validation: Zod schemas on all user inputs
- CORS: Configured via Next.js middleware
- CSP headers: Set in
next.config.tsfor production
- Never commit
.env.localor API keys - Use
NEXT_PUBLIC_*only for browser-safe values - Rotate credentials after exposure
- Review Gateway analytics for abuse patterns
- Set up alerts for unusual usage spikes
# Install Vercel CLI
pnpm add -g vercel
# Deploy
vercel
# Production deployment
vercel --prodEnvironment Variables (Vercel Dashboard):
AI_GATEWAY_API_KEY- Optional (OIDC auto-auth on Vercel)AI_MODEL- Default model identifierNEXT_PUBLIC_DEFAULT_MODEL- Client-side default
FROM node:20-alpine AS builder
WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN npm install -g pnpm && pnpm install
COPY . .
RUN pnpm build
FROM node:20-alpine
WORKDIR /app
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/public ./public
COPY --from=builder /app/package.json ./
RUN npm install -g pnpm && pnpm install --prod
CMD ["pnpm", "start"]- Build time: ~30s (Turbopack)
- Bundle size: ~300KB (gzipped, first load)
- Generation time: 30-90s (depends on model and agent count)
- Edge cold start: <200ms
- Selective agents: Disable unnecessary agents to reduce generation time
- Model selection: Faster models (GPT-4o-mini) vs accuracy (GPT-5, Claude Opus)
- Caching: Consider implementing Redis for repeated generations
- Streaming: Enable streaming for real-time feedback (future enhancement)
Contributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit with conventional commits:
feat: add agent handoff system - Push and create a pull request
- Ensure
pnpm lintpasses
git clone <your-fork>
cd app-builder
pnpm install
pnpm devThis project is licensed under the MIT License. See LICENSE file for details.
- Vercel AI SDK - AI orchestration and model routing
- Next.js - React framework
- shadcn/ui - UI component library
- OpenAI Swarm - Agent pattern inspiration
- agents.md spec - Repository guidelines standard
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: Vercel AI SDK Docs
Built with β€οΈ using Next.js 15, Vercel AI SDK 5, and a swarm of intelligent agents.