This document describes v0's comprehensive integration system for connecting Code Projects to external services including databases, AI providers, and payment processors. It covers the GetOrRequestIntegration tool, environment variable management, and service-specific implementation requirements.
For general v0 architecture and file operations, see CodeProject Architecture and File Operations. For AI SDK usage patterns, see Script Execution and Debugging System.
v0 provides first-class support for specific integrations that automatically configure environment variables and provide live schema information. The system handles three categories of external services: storage/databases, AI/ML providers, and payment processors. All integration setup occurs within the v0 UI without requiring users to leave the platform.
Sources: v0 Prompts and Tools/Prompt.txt531-543 v0 Prompts and Tools/Tools.json285-323
Sources: v0 Prompts and Tools/Prompt.txt547-579 v0 Prompts and Tools/Tools.json293-309
| Category | Integration | Package(s) | Environment Variables | Auto-Schema |
|---|---|---|---|---|
| Storage | Supabase | @supabase/ssr | DATABASE_URL, auth vars | Yes (tables, columns, RLS) |
| Neon | @neondatabase/serverless | DATABASE_URL | Yes (tables, columns) | |
| Upstash for Redis | Built-in | KV_REST_API_URL, KV_REST_API_TOKEN | No | |
| Vercel Blob | Built-in | BLOB_READ_WRITE_TOKEN | No | |
| Upstash Search | Built-in | Search-specific vars | No | |
| Edge Config | Built-in | Config-specific vars | No | |
| AI/ML | xAI (Grok) | AI SDK | XAI_API_KEY | No |
| Groq | AI SDK | GROQ_API_KEY | No | |
| Fal AI | @fal-ai/serverless | FAL_KEY | No | |
| DeepInfra | AI SDK | DEEPINFRA_API_KEY | No | |
| Vercel AI Gateway | AI SDK (default) | None (automatic) | No | |
| Payments | Stripe | Built-in | STRIPE_SECRET_KEY, STRIPE_PUBLISHABLE_KEY, NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY | No |
Sources: v0 Prompts and Tools/Prompt.txt547-687 v0 Prompts and Tools/Tools.json293-309
v0 supports environment variables from Vercel but does not support .env files in the browser runtime. Variables follow Next.js conventions for server/client access:
NEXT_PUBLIC_Sources: v0 Prompts and Tools/Prompt.txt456-458 v0 Prompts and Tools/Prompt.txt534-536
When generated code references environment variables, v0 automatically prompts users to verify they are added to the Vercel project. Users troubleshoot integration issues by:
Sources: v0 Prompts and Tools/Prompt.txt534-542
The GetOrRequestIntegration tool performs three critical functions:
Sources: v0 Prompts and Tools/Tools.json285-323
| Parameter | Type | Required | Description |
|---|---|---|---|
names | string[] | No | Specific integration names to check. Omit or use empty array for overview of all integrations. Valid values: "Upstash for Redis", "Upstash Search", "Neon", "Supabase", "Groq", "Grok", "fal", "Deep Infra", "Stripe", "Blob", "Edge Config", "Vercel AI Gateway" |
taskNameActive | string | Yes | 2-5 words describing running task (e.g., "Checking Database Setup") |
taskNameComplete | string | Yes | 2-5 words describing completed task (e.g., "Database Setup Verified") |
Before building integration features:
For database schema retrieval:
For project discovery:
Sources: v0 Prompts and Tools/Tools.json285-323
v0 MUST use the @supabase/ssr package for both client-side and server-side Supabase operations. The standard @supabase/supabase-js package is not used.
v0 implements the singleton pattern for Supabase clients to prevent initialization errors:
Sources: v0 Prompts and Tools/Prompt.txt587-591
Email/Password Authentication:
Required Pattern for signUp:
The emailRedirectTo option MUST be set using environment variable for development and window.location.origin for production:
Server-side middleware for token refresh:
v0 MUST use createServerClient in middleware.ts (or proxy.js in Next.js 16) to refresh tokens and set cookies:
Sources: v0 Prompts and Tools/Prompt.txt599-633
v0 MUST use Row Level Security to protect data. Security is non-negotiable. When retrieving database schema via GetOrRequestIntegration, RLS policies are included in the response and must be respected in code generation.
Sources: v0 Prompts and Tools/Prompt.txt637-638
/scripts folder directly)Sources: v0 Prompts and Tools/Prompt.txt592-595
v0 MUST use the @neondatabase/serverless package and the neon() function for creating SQL clients:
v0 NEVER uses the @vercel/postgres package for Neon databases.
Sources: v0 Prompts and Tools/Prompt.txt643-648
Uses two environment variables:
KV_REST_API_URL: Redis instance REST endpointKV_REST_API_TOKEN: Authentication token for REST APISources: v0 Prompts and Tools/Prompt.txt650-653
The AI SDK uses the Vercel AI Gateway by default. Provider packages are not necessary—v0 passes a model string to the model parameter, and Next.js automatically handles API keys and configurations.
Supported providers in AI Gateway (no API key required):
"openai/gpt-5-mini")"anthropic/claude-sonnet-4.5")Sources: v0 Prompts and Tools/Prompt.txt319-343
XAI_API_KEY: API key for xAI Grok modelsv0 MUST use model: xai("grok-4") unless user requests a different Grok model. The xAI integration should ONLY be used if Grok is explicitly requested; otherwise, v0 uses the Vercel AI Gateway.
Sources: v0 Prompts and Tools/Prompt.txt655-661
GROQ_API_KEY: API key for Groq LLM inferenceGroq should ONLY be used if explicitly requested by the user. Otherwise, v0 uses the Vercel AI Gateway to avoid requiring user configuration.
Sources: v0 Prompts and Tools/Prompt.txt663-667
v0 MUST use the @fal-ai/serverless package and the fal() function:
FAL_KEY: API key for Fal AI image generation servicesSources: v0 Prompts and Tools/Prompt.txt669-674
DEEPINFRA_API_KEY: API key for DeepInfra AI infrastructureDeepInfra should ONLY be used if explicitly requested. Otherwise, v0 uses the Vercel AI Gateway.
Sources: v0 Prompts and Tools/Prompt.txt676-680
Stripe integration uses three environment variables:
STRIPE_SECRET_KEY: Server-side secret keySTRIPE_PUBLISHABLE_KEY: Public key for server-side usageNEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: Public key for client-side usageSources: v0 Prompts and Tools/Prompt.txt682-687
v0 generates SQL scripts in the /scripts folder of Code Projects. Key characteristics:
Script versioning example:
/scripts/001-create-users-table.sql
/scripts/002-add-profiles-table.sql
/scripts/003-update-users-add-email.sql
Sources: v0 Prompts and Tools/Prompt.txt556-561 v0 Prompts and Tools/Prompt.txt205-210
When an integration is connected, v0 uses GetOrRequestIntegration to retrieve the live database schema instead of reading SQL scripts from files. This ensures accuracy and reflects the current state of the database, including:
Sources: v0 Prompts and Tools/Tools.json287-288
Sources: v0 Prompts and Tools/Prompt.txt534-542 v0 Prompts and Tools/Tools.json285-323
Users manage integrations through the sidebar:
Sources: v0 Prompts and Tools/Prompt.txt862-869
v0 follows these guidelines for integration selection:
AI Provider Selection:
Database Selection:
Payment Processing:
Sources: v0 Prompts and Tools/Prompt.txt655-680 v0 Prompts and Tools/Prompt.txt581-585
Sources: v0 Prompts and Tools/Tools.json285-323 v0 Prompts and Tools/Prompt.txt531-543
Supabase Authentication: v0 Prompts and Tools/Prompt.txt599-633
Neon Database Query: v0 Prompts and Tools/Prompt.txt643-648
AI SDK with Gateway: v0 Prompts and Tools/Prompt.txt336-341
Fal AI Client: v0 Prompts and Tools/Prompt.txt669-674
| Issue | Resolution Path | Reference |
|---|---|---|
| Integration not working | Check Connect section in sidebar | v0 Prompts and Tools/Prompt.txt538-541 |
| Environment variables missing | Check Vars section in sidebar | v0 Prompts and Tools/Prompt.txt538-541 |
| Database schema mismatch | Call GetOrRequestIntegration to get live schema | v0 Prompts and Tools/Tools.json287-288 |
| Supabase client errors | Verify singleton pattern implementation | v0 Prompts and Tools/Prompt.txt591 |
| RLS policy violations | Check policies in GetOrRequestIntegration response | v0 Prompts and Tools/Prompt.txt637-638 |
| AI provider not responding | Verify using Vercel AI Gateway (default) | v0 Prompts and Tools/Prompt.txt323-327 |
When GetOrRequestIntegration returns integration information, it includes links to example code templates when available. These provide reference implementations for common integration patterns.
Sources: v0 Prompts and Tools/Tools.json287-288
v0's integration ecosystem provides automatic environment variable management, live schema retrieval, and seamless service connection for 12+ external services across storage, AI, and payment categories. The GetOrRequestIntegration tool ensures integrations are configured before code generation, preventing runtime errors. All integration setup occurs within the v0 UI, and generated code follows service-specific best practices including RLS for Supabase, singleton patterns for client initialization, and Vercel AI Gateway for AI operations.
Sources: v0 Prompts and Tools/Prompt.txt531-687 v0 Prompts and Tools/Tools.json285-323
Refresh this wiki