VibeDesign.ai is an AI-powered mobile UI design platform built with modern web technologies. It allows users to describe mobile app screens in natural language and generates fully-rendered UI designs.
┌─────────────────────────────────────────────────────────────────┐
│ Client Layer │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────────┐ │
│ │ Browser │ │ Mobile │ │ API Clients │ │
│ │ (Next.js) │ │ (PWA) │ │ (REST / Webhooks) │ │
│ └──────┬──────┘ └──────┬──────┘ └─────────────────────────┘ │
└─────────┼───────────────┼──────────────────────────────────────┘
│ │
▼ ▼
┌─────────────────────────────────────────────────────────────────┐
│ Next.js Application │
│ ┌─────────────────────┐ ┌──────────────────────────────┐ │
│ │ Pages & Layouts │ │ API Routes │ │
│ │ (React Server │ │ /api/projects │ │
│ │ Components) │ │ /api/generate │ │
│ │ │ │ /api/chat │ │
│ └──────────┬──────────┘ └──────────────┬───────────────┘ │
│ │ │ │
│ ┌──────────▼──────────┐ ┌──────────────▼───────────────┐ │
│ │ Client State │ │ Middleware │ │
│ │ (React Hooks) │ │ (Clerk Authentication) │ │
│ └─────────────────────┘ └──────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
│ │
▼ ▼
┌─────────────────────────────────────────────────────────────────┐
│ AI Service Layer │
│ ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │
│ │ OpenAI GPT │ │ Google Gemini │ │ Minimax │ │
│ │ (Primary) │ │ (Fallback) │ │ (Alternative) │ │
│ └────────┬────────┘ └────────┬────────┘ └────────┬────────┘ │
└───────────┼────────────────────┼────────────────────┼───────────┘
│ │ │
▼ ▼ ▼
┌─────────────────────────────────────────────────────────────────┐
│ Data Layer │
│ ┌─────────────────────┐ ┌──────────────────────────────┐ │
│ │ PostgreSQL │ │ File Storage │ │
│ │ (Prisma ORM) │ │ (html-to-image export) │ │
│ └─────────────────────┘ └──────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
We chose Next.js 16 with the App Router for:
- Server Components by default for better performance
- Streaming SSR for AI responses
- Built-in API routes without separate server
- Automatic code splitting and optimization
The AI SDK provides:
- Unified API across multiple providers
- Automatic fallback between providers
- Structured output generation (Zod schemas)
- Type-safe AI interactions
Provider Priority:
- OpenAI GPT-4o-mini (primary)
- Minimax (fallback)
- Google Gemini 1.5 Flash (final fallback)
XYFlow was chosen for the canvas because:
- Custom node types support (mobile frames)
- Drag-and-drop functionality
- Infinite canvas with zoom/pan
- React-first architecture
Prisma provides:
- Type-safe database queries
- Automatic migrations
- Generated TypeScript types
- Connection pooling support
Clerk handles:
- User sign-up/sign-in
- Session management
- Protected routes via middleware
- User profile management
model Project {
id String @id @default(cuid())
name String
thumbnail String?
userId String
theme String @default("light")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
screens Screen[]
promptHistory PromptHistory[]
}model Screen {
id String @id @default(cuid())
projectId String
name String
htmlContent String
cssContent String
x Float @default(0)
y Float @default(0)
width Float @default(375)
height Float @default(812)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}model PromptHistory {
id String @id @default(cuid())
projectId String
content String
role String // "user" | "assistant"
createdAt DateTime @default(now())
}All API routes follow REST conventions:
GET /api/resources- List resourcesPOST /api/resources- Create resourceGET /api/resources/:id- Get single resourcePATCH /api/resources/:id- Update resourceDELETE /api/resources/:id- Delete resource
consistent error responses:
{
error: "Error message",
details?: { /* validation errors */ }
}HTTP Status Codes:
- 400: Bad Request (validation)
- 401: Unauthorized
- 403: Forbidden
- 404: Not Found
- 500: Internal Server Error All API routes return- 503: Service Unavailable (AI provider down)
// Public routes (no auth required)
- / (landing page)
- /sign-in/*
- /sign-up/*
- /api/chat (auth in route)
- /api/projects (POST - auth in route)
- /api/generate (auth in route)
// Protected routes (auth required via middleware)
- /dashboard
- /projects
- /editor/*
- /templates
- /pricingSensitive configuration is managed through environment variables with validation at startup.
- React Suspense for code splitting
- Memoized callbacks with
useCallback - Optimized package imports
- Lazy loading components
- React Server Components for zero client bundle
- Streaming responses for AI generation
- Database connection pooling
- Optimized Prisma queries
- Tree-shaking unused code
- CSS optimization with Tailwind
- Image optimization with Next.js Image
- Automatic deployments from Git
- Edge functions support
- Built-in environment variable management
- Serverless function scaling
docker build -t vibedesign .
docker run -p 3000:3000 vibedesign| Environment | Node.js | Features |
|---|---|---|
| Development | 20 | Debug logging, hot reload |
| Production | 20 | Optimized builds, error tracking |
- Next.js dev server logs
- Console warnings for missing env vars
- API route request/response logging
- Error boundaries catch React errors
- Toast notifications for user feedback
- Console logs for server errors
- Real-time collaboration
- Version history with diff
- Shareable public links
- Export to React Native
- Team workspaces
- Custom AI model fine-tuning
- Plugin system
- API webhooks
| Issue | Workaround |
|---|---|
| Gemini API unavailable | Fallback to OpenAI/Minimax |
| Canvas performance | Reduce nodes on large projects |
| Mobile view | Use responsive toolbar |
See README.md for setup and development instructions.