Skip to content

SujalXplores/v0.diy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

124 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

β–ˆβ–ˆβ•—   β–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—       β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•—β–ˆβ–ˆβ•—   β–ˆβ–ˆβ•—
β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ•—      β–ˆβ–ˆβ•”β•β•β–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•
β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘ β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• 
β•šβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β•šβ•β•β•β•β•β–ˆβ–ˆβ•‘  β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•‘  β•šβ–ˆβ–ˆβ•”β•  
 β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•      β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘   
  β•šβ•β•β•β•   β•šβ•β•β•β•β•β•       β•šβ•β•β•β•β•β• β•šβ•β•   β•šβ•β•   

Open-source clone of v0.app with AI-powered React component generation

GitHub Stars GitHub Forks GitHub Issues License

Next.js React TypeScript Tailwind CSS

Getting Started Β· Features Β· Tech Stack Β· Project Structure Β· Contributing


Overview

v0.diy is a self-hosted, open-source alternative to v0.app that transforms natural language descriptions into production-ready React components. Built with the latest web technologies and designed for developers who want full control over their AI-assisted development workflow.

Features

Feature Description
AI Component Generation Convert natural language prompts into functional React components
Real-time Streaming Watch code generation happen live with streaming responses
User Authentication Secure email/password authentication with NextAuth.js
Rate Limiting 50 messages per day for authenticated users
Persistent Chat History Conversations and generated components saved to PostgreSQL
Projects Dashboard View and manage all your generated projects
Live Preview Split-screen resizable layout with instant component preview
Dark/Light Theme Full theme support with system preference detection
Image Attachments Attach images to your prompts for context
Voice Input Microphone support for voice-based prompts

Getting Started

Prerequisites

  • Node.js 22.x or later
  • pnpm 9.0 or later
  • PostgreSQL database (local or hosted)
  • v0 API key from v0.app for each end user (BYOK)

Installation

# Clone the repository
git clone https://github.com/SujalXplores/v0.diy.git
cd v0.diy

# Install dependencies
pnpm install

# Copy environment template
cp .env.example .env.local

Environment Configuration

Create a .env.local file with the following variables:

# Environment
NODE_ENV=development

# Database (required)
POSTGRES_URL=postgresql://user:password@localhost:5432/v0_diy

# Authentication (required - generate with: openssl rand -base64 32)
AUTH_SECRET=your_auth_secret_here

# Optional: Custom v0 API URL
V0_API_URL=

After sign in, each user adds their own v0 API key from the account menu.

Note: In development mode, if AUTH_SECRET is not set, a default development secret will be used automatically.

Database Setup

# Apply database migrations
pnpm db:migrate

# Start development server
pnpm dev

The application will be available at http://localhost:3000.

Available Scripts

Command Description
pnpm dev Start development server with Turbopack
pnpm build Run migrations and build for production
pnpm start Start production server
pnpm db:generate Generate migration files from schema changes
pnpm db:migrate Apply pending migrations to the database
pnpm db:studio Open Drizzle Studio for database inspection
pnpm db:push Push schema changes directly to the database
pnpm lint Run Biome linter
pnpm lint:fix Run Biome linter with auto-fix
pnpm format Format code with Biome
pnpm check Run Biome check (lint + format)
pnpm typecheck Run TypeScript type checking

Tech Stack

Frontend

  • React 19.2.3 β€” Latest React with concurrent rendering and React Compiler
  • Next.js 16.1.1 β€” Full-stack React framework with App Router & Turbopack
  • TypeScript 5.9.3 β€” Static type checking
  • Tailwind CSS 4.1.18 β€” Utility-first CSS framework
  • Radix UI β€” Accessible UI primitives
  • Geist Font β€” Typography by Vercel

Backend & Data

  • NextAuth.js 5 (Beta) β€” Authentication with Credentials provider
  • PostgreSQL β€” Relational database
  • Drizzle ORM 0.45.1 β€” Type-safe database operations
  • Vercel Postgres β€” Cloud-hosted PostgreSQL support

AI Integration

  • v0 SDK 0.15.3 β€” Official v0.app API client
  • AI SDK 6.0.11 β€” Streaming AI response handling
  • @v0-sdk/react 0.4.1 β€” React components for AI interactions

Developer Experience

  • Biome 2.3.11 β€” Fast linter and formatter
  • Husky β€” Git hooks for code quality
  • lint-staged β€” Run linters on staged files

Project Structure

v0.diy/
β”œβ”€β”€ app/                      # Next.js App Router
β”‚   β”œβ”€β”€ (auth)/              # Authentication routes & config
β”‚   β”‚   β”œβ”€β”€ login/           # Login page
β”‚   β”‚   └── register/        # Registration page
β”‚   β”œβ”€β”€ api/                 # API routes
β”‚   β”‚   β”œβ”€β”€ auth/            # NextAuth endpoints
β”‚   β”‚   β”œβ”€β”€ chat/            # Chat API (create, fork, delete)
β”‚   β”‚   └── chats/           # Chat list & detail endpoints
β”‚   β”œβ”€β”€ chats/               # Chat pages
β”‚   └── projects/            # Projects dashboard
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ ai-elements/         # AI-specific components (prompt, response, etc.)
β”‚   β”œβ”€β”€ chat/                # Chat interface components
β”‚   β”œβ”€β”€ chats/               # Chat list components
β”‚   β”œβ”€β”€ home/                # Home page components
β”‚   β”œβ”€β”€ projects/            # Projects page components
β”‚   β”œβ”€β”€ providers/           # React context providers
β”‚   β”œβ”€β”€ shared/              # Shared layout components
β”‚   └── ui/                  # Reusable UI primitives
β”œβ”€β”€ contexts/                # React contexts
β”œβ”€β”€ hooks/                   # Custom React hooks
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ db/                  # Database schema, queries & migrations
β”‚   └── ...                  # Utilities and configurations
β”œβ”€β”€ types/                   # TypeScript type definitions
└── public/                  # Static assets

Authentication & Rate Limits

Login is required to use the chat functionality. Users must create an account or sign in before submitting prompts.

User Type Max Messages/Day Description
Registered 50 Email/password authenticated users

Note: Unauthenticated users will be redirected to the login page when attempting to submit a prompt. Any typed message will be preserved and restored after login.

Contributing

Contributions are welcome. Please read our contributing guidelines before submitting a pull request.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/improvement)
  3. Commit your changes (git commit -am 'Add new feature')
  4. Push to the branch (git push origin feature/improvement)
  5. Open a Pull Request

Code Quality

This project uses Biome for linting and formatting. Before submitting a PR:

pnpm check:fix  # Auto-fix linting and formatting issues
pnpm typecheck  # Ensure no TypeScript errors

Testing

This project is tested with BrowserStack

License

This project is licensed under the MIT License. See the LICENSE file for details.


Contributors

Star History

Star History Chart

⭐ If you found this project helpful, please consider giving it a star!

About

An open-source clone of v0.app with AI-powered React component generation

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Contributors