website/docs/integrations/vercel.md
Vercel is a cloud platform for deploying and hosting web applications.
Electric integrates with Vercel in two main ways:
The Vercel AI SDK is a popular toolkit for building AI-powered applications. Electric's Durable Streams provide a Durable Transport layer that makes AI token streams resilient to network interruptions.
Standard AI streaming is fragile:
Durable Transport solves this by:
npm install @electric-sql/durable-streams
import { streamText } from 'ai'
import { openai } from '@ai-sdk/openai'
import { durableTransport } from '@electric-sql/durable-streams'
// Wrap your AI stream with Durable Transport
const result = await streamText({
model: openai('gpt-4'),
prompt: 'Write a story about a robot learning to paint.',
experimental_transport: durableTransport({
// Configure persistence and resumption
streamId: 'user-session-123',
}),
})
You can deploy Electric-powered applications on Vercel. For the Electric sync service itself, you'll need a hosting platform that supports long-running processes.
See the Deployment guide for more details on hosting Electric.