New Project
A Next.js application demonstrating the v0 Platform API

⚠️ Developer Preview: This SDK is currently in beta and is subject to change. Use in production at your own risk.
An example of how to use the AI Elements to build a v0 clone with authentication and multi-tenant support.
Features · Deploy Your Own · Setup · Getting Started · Usage
You can deploy your own version of the v0 clone to Vercel with one click:
Create a .env file with all required variables:
# Auth Secret - Generate a random string for production# Generate with: openssl rand -base64 32# Or visit: https://generate-secret.vercel.app/32AUTH_SECRET=your-auth-secret-here# Database URL - PostgreSQL connection stringPOSTGRES_URL=postgresql://user:password@localhost:5432/v0_clone# For Vercel Postgres, use the connection string from your dashboard# Get your API key from https://v0.dev/chat/settings/keysV0_API_KEY=your_v0_api_key_here# Optional: Use a custom API URL# V0_API_URL=http://localhost:3001/v1
This project uses PostgreSQL with Drizzle ORM. Set up your database:
Generate Database Schema:
pnpm db:generate
Run Database Migrations:
pnpm db:migrate
Optional - Open Database Studio:
pnpm db:studio
Then, run the development server:
pnpm dev
Open http://localhost:3000 with your browser to see the result.
This v0 clone includes:
task-thinking-v1 - AI reasoning and thought processestask-search-web-v1 - Web search operations with resultstask-search-repo-v1 - Repository/codebase search functionalitytask-diagnostics-v1 - Code analysis and issue detectiontask-read-file-v1 - File reading operationstask-coding-v1 - Code generation and editing taskstask-generate-design-inspiration-v1 - Design inspiration generation.envpnpm db:migratepnpm dev or production server with pnpm startapp/page.tsx - Main UI with chat interface, streaming toggle, and preview panelcomponents/ai-elements/ - AI Elements components for the UIcomponents/shared/app-header.tsx - Navigation header with user authentication@v0-sdk/react components for rendering streaming AI responsesapp/api/chat/route.ts - Chat creation and messaging with ownership trackingapp/api/chats/ - User's chat listing and individual chat accessapp/api/projects/ - User's project listing and individual project accessapp/(auth)/ - Authentication configuration and login/register pagesWhen streaming is enabled:
streaming: true to the API routev0.chats.create({ responseMode: 'experimental_stream' })Content-Type: text/event-streamStreamingMessage component from @v0-sdk/react to render responses in real-timepnpm db:generate - Generate migration files from schema changespnpm db:migrate - Apply pending migrationspnpm db:studio - Open Drizzle Studio for database inspectionpnpm db:push - Push schema changes directly (for development)Rate limits are enforced per 24-hour period and reset daily.
You now have a working multi-tenant v0 clone with authentication! Feel free to explore the v0 Platform API and extend your app with additional features.