Vercel Functions Now Support Bun.serve Entrypoints and Native WebSocket Handlers

Vercel has introduced native support for Bun.serve as an entrypoint for Vercel Functions utilizing the Bun runtime. This update enables developers to deploy server logic directly from a root-level server.ts file, maintaining consistency between local development and production environments without the need for additional web framework wrappers. With this integration, developers can map static, dynamic, and wildcard routes natively. The feature also enables native WebSocket support on Vercel Functions by allowing developers to initiate connection upgrades using the server.upgrade method directly within the fetch handler, resolving previous limitations on real-time event handling. Adopting this feature requires specifying bunVersion as 1.x or higher in the vercel.json configuration file and applying the Bun framework preset. When migrating existing functions, codebases must be adjusted to align routing structures and entrypoint filenames with the Bun.serve specifications.
Related tools
Recommended tools for this topic
These picks prioritize high-intent tools relevant to this topic. Some links may include partner or affiliate tracking.
High-value hosting and deployment path for frontend and cloud readers.
View VercelA strong security and edge platform match across CDN, Zero Trust, and app protection.
View CloudflareStrong cloud alternative for startups and developer-led infrastructure decisions.
View DigitalOceanComparison
| Aspect | Before / Alternative | After / This |
|---|---|---|
| Entrypoint Configuration | Required framework adapters or wrapper configurations to route requests | Direct deployment of native server.ts using Bun.serve() |
| WebSocket Implementation | Restricted or required external workarounds to handle persistent connections | Native support via server.upgrade inside the fetch handler |
| Routing Management | Managed through framework-specific routing rules or Vercel JSON routing | Mapped natively via Bun's path and wildcard handling in server.ts |
Action Checklist
- Configure vercel.json to target bunVersion 1.x or higher Ensure your project configuration explicitly defines a compatible Bun runtime version.
- Set up a server.ts file at the root of your project Define the export default Bun.serve block including fetch and optional websocket handlers.
- Enable the Bun framework preset in your Vercel project settings This preset allows Vercel to automatically detect and build the Bun.serve entrypoint.
Source: Vercel Changelog
This page summarizes the original source. Check the source for full details.

