Standard Fetch Handler
The standard fetch handler is the core implementation of Open LangGraph Server, built entirely on Web Standards (WHATWG Fetch API). It provides a framework-agnostic way to integrate LangGraph into any platform that supports standard Request/Response APIs.
Why Use the Fetch Handler?
- Platform Agnostic: Works on any platform supporting standard Web APIs
- Zero Framework Overhead: No framework dependencies to manage
- Maximum Portability: Deploy the same code to multiple platforms
- Future Proof: Based on web standards, not proprietary APIs
Supported Platforms
The fetch handler works on:
| Platform | Status | Notes |
|---|---|---|
Cloudflare Workers | ✅ Fully Supported | Recommended for edge computing |
Deno Deploy | ✅ Fully Supported | Native TypeScript support |
Vercel Edge | ✅ Fully Supported | Edge runtime compatible |
Bun | ✅ Fully Supported | Fast JavaScript runtime |
Node.js | ✅ Fully Supported | Via Hono or direct usage |
Custom Platforms | ✅ Fully Supported | Any Web API-compliant platform |
Installation
Basic Usage
Simple Handler
With Context
Platform-Specific Examples
Cloudflare Workers
Environment Setup:
Deno Deploy
Environment Setup:
Vercel Edge Functions
Environment Setup:
Configure environment variables in Vercel dashboard:
DATABASE_URLREDIS_URLCHECKPOINT_TYPE
Bun
Configuration
Environment Variables
All platforms support standard environment variables:
Storage Backends
The fetch handler supports all storage backends:
- Memory: Default, no configuration needed
- SQLite: Set
SQLITE_DATABASE_URI - PostgreSQL: Set
DATABASE_URLandCHECKPOINT_TYPE=postgres - Redis: Set
REDIS_URLandCHECKPOINT_TYPE=redis
API Endpoints
The fetch handler implements all LangGraph Server endpoints:
Assistants
POST /assistants/search- Search assistantsGET /assistants/:id/graph- Get assistant graph
Threads
POST /threads- Create threadPOST /threads/search- Search threadsGET /threads/:id- Get threadDELETE /threads/:id- Delete threadPOST /threads/:id/state- Update thread state
Runs
POST /threads/:id/runs/stream- Stream a new runGET /threads/:id/runs/:runId/stream- Join existing streamGET /threads/:id/runs- List runsPOST /threads/:id/runs/:runId/cancel- Cancel run
Advanced Usage
Custom Route Handling
Authentication Middleware
Rate Limiting
CORS Configuration
Performance Considerations
Connection Pooling
For database-heavy workloads, configure connection pooling:
Caching
Implement caching for frequently accessed data:
Troubleshooting
" errors
Ensure you're using the correct import path:
Streaming not working
Ensure your platform supports streaming responses:
- Cloudflare Workers: ✅ Supported
- Deno Deploy: ✅ Supported
- Vercel Edge: ✅ Supported (with caveats)
- Bun: ✅ Supported
Context not accessible in graph
Verify context structure matches expected format:
Database connection issues
- Check environment variables are set correctly
- Verify network access to database
- Ensure database is initialized (
DATABASE_INIT=truefor first run)
Migration from Framework Adapters
Migrating from Hono or Next.js adapters is straightforward:
From Hono
From Next.js
Next Steps
- Architecture Overview - Understand the layered design
- Storage Configuration - Configure persistence
- Authentication - Secure your endpoints
- API Reference - Complete API documentation
Show your support! Star us on GitHub ⭐️