
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/
| 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 |
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐│ 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()└─────────────────┘
client.beta.search() → Returns ranked results with excerptsclient.beta.extract() → Returns extracted contentclient.taskRun.create() → SSE stream delivers real-time progress → Final output displayed on completioncd typescript-recipes/parallel-vercel-templatenpm install
cp .env.example .env.local
Edit .env.local with your Parallel API key:
PARALLEL_API_KEY=your-api-key-here
npm run dev
Open http://localhost:3000 to see the demo.
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
PARALLEL_API_KEY to Environment VariablesThe easiest way to get an API key is through the Parallel Vercel Integration:
PARALLEL_API_KEY environment variable is automatically addedWant 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.
MIT