
Parallel + Vercel Template
A Next.js template demonstrating how to integrate Parallel's web research APIs with Vercel. This template provides a complete demo application showcasing the Search, Extract, and Tasks APIs with real-time SSE streaming.
View the demo at: https://parallel-vercel-template-cookbook.vercel.app/
Features
| Feature | Description |
|---|---|
| Search API | Natural language web search with mode selection (one-shot vs agentic) |
| Extract API | Content extraction from URLs with objective-focused filtering |
| Tasks API | Deep research tasks with real-time SSE event streaming |
| Session Persistence | Search/Extract results persist in sessionStorage, Tasks persist in localStorage |
| Status Recovery | Automatically checks and updates pending task statuses on page reload |
Architecture
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐│ React UI │────▶│ Next.js API │────▶│ Parallel API ││ Components │ │ Routes │ │ (parallel-web) │└─────────────────┘ └─────────────────┘ └─────────────────┘│ ││ sessionStorage │ SDK calls│ localStorage │▼ ▼┌─────────────────┐ ┌─────────────────┐│ SearchDemo │ │ /api/search │ → client.beta.search()│ ExtractDemo │ │ /api/extract │ → client.beta.extract()│ TasksDemo │ │ /api/tasks │ → client.taskRun.create()└─────────────────┘ │ /api/tasks/[id]/status │ → client.taskRun.retrieve()│ /api/tasks/[id]/events │ → client.beta.taskRun.events()└─────────────────┘
How It Works
- Search: User enters a search objective and optional queries → API calls
client.beta.search()→ Returns ranked results with excerpts - Extract: User enters URLs and optional objective → API calls
client.beta.extract()→ Returns extracted content - Tasks: User enters a research task → API calls
client.taskRun.create()→ SSE stream delivers real-time progress → Final output displayed on completion
Quick Start
Prerequisites
- Node.js 18+
- A Parallel API key (via Vercel Integration)
1. Clone and Install
cd typescript-recipes/parallel-vercel-templatenpm install
2. Configure Environment
cp .env.example .env.local
Edit .env.local with your Parallel API key:
PARALLEL_API_KEY=your-api-key-here
3. Run the Development Server
npm run dev
Open http://localhost:3000 to see the demo.
Project Structure
parallel-vercel-template/├── app/│ ├── api/│ │ ├── search/route.ts # Search API endpoint│ │ ├── extract/route.ts # Extract API endpoint│ │ └── tasks/│ │ ├── route.ts # Create task endpoint│ │ └── [runId]/│ │ ├── status/route.ts # Task status polling│ │ └── events/route.ts # SSE event streaming│ ├── components/│ │ ├── SearchDemo.tsx # Search UI with mode toggle│ │ ├── ExtractDemo.tsx # Extract UI│ │ └── TasksDemo.tsx # Tasks UI with SSE streaming│ ├── page.tsx # Main page with tabs│ ├── layout.tsx # App layout│ └── globals.css # Tailwind styles├── .env.example # Environment template├── package.json└── README.md
Deploying to Vercel
- Push to your GitHub repository
- Import the project in Vercel
- Add
PARALLEL_API_KEYto Environment Variables - Deploy
Using Vercel Integration
The easiest way to get an API key is through the Parallel Vercel Integration:
- Install the integration on your Vercel project
- The
PARALLEL_API_KEYenvironment variable is automatically added - Access the Parallel playground by clicking "Open in Parallel Web Systems"
Exploring More APIs
Want to try the Monitor or FindAll APIs?
Go to your Vercel Integration page, select a project, and click "Open in Parallel Web Systems" to access the full playground.
Resources
- Parallel Documentation
- Search API Reference
- Extract API Reference
- Tasks API Reference
- SSE Streaming Guide
- Pricing
- parallel-web npm package
- Vercel Integration
License
MIT


