惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
云风的 BLOG
云风的 BLOG
aimingoo的专栏
aimingoo的专栏
Vercel News
Vercel News
T
The Blog of Author Tim Ferriss
F
Full Disclosure
A
About on SuperTechFans
C
Check Point Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
量子位
Know Your Adversary
Know Your Adversary
K
Kaspersky official blog
L
LINUX DO - 热门话题
Recorded Future
Recorded Future
C
Cisco Blogs
M
MIT News - Artificial intelligence
T
Tenable Blog
G
GRAHAM CLULEY
月光博客
月光博客
Recent Announcements
Recent Announcements
V
Visual Studio Blog
IT之家
IT之家
T
The Exploit Database - CXSecurity.com
The GitHub Blog
The GitHub Blog
T
Threat Research - Cisco Blogs
D
DataBreaches.Net
P
Privacy International News Feed
P
Proofpoint News Feed
I
Intezer
博客园 - 叶小钗
C
CXSECURITY Database RSS Feed - CXSecurity.com
The Hacker News
The Hacker News
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - Franky
SecWiki News
SecWiki News
宝玉的分享
宝玉的分享
P
Palo Alto Networks Blog
Last Week in AI
Last Week in AI
小众软件
小众软件
Hacker News - Newest:
Hacker News - Newest: "LLM"
O
OpenAI News
N
News and Events Feed by Topic
Microsoft Security Blog
Microsoft Security Blog
Security Archives - TechRepublic
Security Archives - TechRepublic
N
News and Events Feed by Topic
The Cloudflare Blog
Spread Privacy
Spread Privacy
酷 壳 – CoolShell
酷 壳 – CoolShell
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
B
Blog RSS Feed

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Deploying Bun Apps on Cloudflare Workers in 2026: Edge Compute for the Rest of Us
pickuma · 2026-05-17 · via DEV Community

pickuma

The Edge, Without the Ceremony

Cloudflare Workers has been the answer to "how do I run code close to users without managing servers?" since 2017. But for most of that time, the answer came with an asterisk: you had to write for the Workers runtime, which meant a limited subset of Node.js APIs, no filesystem, and CPU time measured in milliseconds rather than seconds.

Two things changed in the past year that make Workers worth a fresh look for JavaScript developers: the runtime compatibility story improved dramatically (the node:* compat flag now covers node:buffer, node:crypto, node:stream, node:events, and more), and Bun — the fast JavaScript runtime that ships with a bundler, test runner, and package manager built in — became a serious contender for the "write local, deploy to edge" workflow.

This is about whether Cloudflare Workers is a viable target for Bun-authored JavaScript in 2026. Spoiler: it depends heavily on what you're building.

The Runtime Compatibility Story

Cloudflare Workers run on V8 isolates (the workerd runtime), not Node.js. The surface area is different: no process, no fs, no net, none of the native bindings that expect a POSIX environment. For years this meant rewriting imports, polyfilling missing APIs, and discovering at deploy time that your favorite npm package used Buffer internally.

The nodejs_compat compatibility flag — enabled by default in new Workers since mid-2025 — bridges most of this gap. It aliases node:buffer, node:crypto, node:stream, node:events, node:path, node:url, node:assert, node:util, and node:process (with a partial implementation) to Workers-native equivalents. This means a surprising number of npm packages now work without modification.

Bun ships its own implementations of node:* modules (written in Zig and JavaScript, often faster than Node's originals). The question is whether Bun-authored code that depends on node:fs or node:child_process has any path to Workers — and the answer is mostly no. Workers has no filesystem, no process spawning, no TCP sockets. If your Bun app reads files, spawns subprocesses, or opens raw network connections, Workers is the wrong target regardless of bundler.

What does work: HTTP servers (Bun's Bun.serve() is conceptually similar to Workers' fetch() handler), cryptographic operations, WebSocket handling, streaming responses, and anything using standard Web APIs (Request, Response, fetch, URL, TextEncoder, WebSocket). If your Bun app is an API server or a webhook handler, the port to Workers is mostly a matter of replacing Bun.serve() with export default { fetch() }.

The key insight: you don't run the Bun runtime on Workers. You write JavaScript that targets Web Standards APIs, test locally with Bun (which implements most of them natively), and deploy a bundled output to Workers. Bun becomes your local development runtime — fast startup, fast test runner, fast bundler — and Workers is your deployment target.

Cold Starts: The Numbers That Matter

Workers has the fastest cold start in serverless, and it's not close. Because Workers run as V8 isolates (not containers or microVMs), there's no container to spin up, no runtime to initialize, no warming delay. The isolate is created in under 5ms, and your code starts executing immediately after.

Compare this to the alternatives:

Platform Cold start (p50) Cold start (p99) Notes
Cloudflare Workers ~1ms ~5ms Isolates, no container overhead
Vercel Edge Functions ~25ms ~100ms Also V8 isolates, but with middleware pipeline
AWS Lambda (Node) ~200ms ~800ms Container-based, improves with provisioned concurrency ($)
Fly.io Machines ~300ms ~2s Full VM start + your app init
Railway / Render ~500ms ~3s Container pull + boot

For a Bun API server running on Fly.io or Railway, cold starts are measured in seconds because the entire runtime — Bun binary, module resolution, your app's initialization — has to happen from a cold state. On Workers, you pre-bundle your code, and the isolate starts in single-digit milliseconds.

The tradeoff: Workers has a CPU time limit (30 seconds on paid, 10ms per request on free). Fly.io and Railway give you a full Linux box for as long as you want. If your endpoint does heavy computation (image processing, PDF generation, ML inference), Workers CPU limits become the bottleneck long before cold starts matter.

Free Tier: Where Workers Dominates

Cloudflare Workers free tier: 100,000 requests per day, unlimited scripts, with a 10ms CPU time limit per request. That's 3 million requests per month, free. No credit card required at signup.

Compare to:

Platform Free tier The catch
Cloudflare Workers 100K req/day, 3M/month 10ms CPU/req, 128MB memory
Vercel Edge Functions 1M invocations/month Paired with Vercel Hobby plan limits
Fly.io $5/month credit Billed after credit exhausted. Cold starts exist
Railway $5 credit (once) No persistent free tier. Hobby plan removed in 2023
Render 750 hours/month Spins down after 15min inactive. 30s+ cold start on wake

The CPU limit is the real constraint. At 10ms per request, you're building an API that handles 100,000 requests per day with sub-10ms response times. That works for auth endpoints, webhook handlers, URL shorteners, redirect services, and lightweight API gateways. It does not work for endpoints that query a database, process a file, or call multiple downstream APIs in sequence — those will blow past 10ms and get throttled.

Upgrading to Workers Paid ($5/month + usage) bumps the CPU limit to 30 seconds and gives you access to Workers KV, D1, Durable Objects, and Queues. At that point, the comparison shifts from "can I run this for free?" to "is this cheaper than a $6/month VPS?"

When to Pick Workers Over a VPS

A $6/month DigitalOcean droplet or Hetzner VPS runs 24/7, has no CPU time limits, can open any port, and will host anything you throw at it — databases, background workers, WebSocket servers, cron jobs. Cloudflare Workers is a more constrained, more opinionated, and more managed platform. The decision comes down to what you value:

Pick Workers when:

  • You want global distribution without configuring load balancers, CDN caching, and multi-region replication
  • You're building API routes that do lightweight orchestration (auth check, data transform, forward to upstream)
  • Your traffic is spiky (0 requests one hour, 10,000 the next) and you don't want to provision for peak
  • You want zero-downtime deploys, automatic HTTPS, DDoS protection, and a CDN — all as free defaults
  • You're shipping a side project and want to stay on the free tier as long as possible

Pick a VPS when:

  • Your endpoint does real computation (image resizing, PDF generation, video transcoding)
  • You need a database on the same machine (SQLite, Postgres) without paying per-query
  • You need filesystem access (write logs, serve static files from disk, store uploads locally)
  • You're running a persistent process (WebSocket server with long-lived connections, queue worker that runs for hours)
  • You need raw network access (UDP, custom protocols, TCP connections to arbitrary hosts)

Workers has a 128 MB memory limit (free) or 128-256 MB (paid). If your bundled JavaScript exceeds 1 MB (after compression), you pay for additional script size. Most Bun-authored API servers will bundle well under this, but heavy dependencies (Prisma, sharp, puppeteer) will not fit.

The Bun-to-Workers Workflow

If you decide Workers is the right target, the workflow looks like this:

  1. Develop locally with Bun. Use bun --hot for hot reloading, bun test for tests, and standard Web APIs (Request, Response, fetch, URLPattern) instead of Bun-specific APIs.

  2. Bundle with Bun's built-in bundler. bun build src/index.ts --outdir dist --target bun produces a single-file output. The output is standard JavaScript — Workers will run it if the APIs used are compatible.

  3. Deploy with Wrangler. Cloudflare's CLI reads wrangler.toml, uploads the bundled script, and maps routes. Use wrangler dev --local to test locally with the same runtime Workers uses in production.

  4. Watch for node:* incompatibilities. Anything that touches the filesystem, spawns subprocesses, or opens raw sockets will fail at runtime, not at build time. Test on Wrangler's local runtime early and often.

The missing piece: Bun's native SQLite bindings don't work on Workers. If your Bun app uses bun:sqlite, you'll need to migrate to Workers D1 (Cloudflare's serverless SQLite, API-compatible with better-sqlite3) or an external Postgres service like Neon or Supabase.

The Bottom Line

Cloudflare Workers in 2026 is the best free tier in serverless, with cold starts that make Lambda look broken and a node:* compat layer that covers most of the npm ecosystem. For Bun developers building API servers, webhook handlers, and lightweight backends, the "develop with Bun, deploy to Workers" workflow is production-viable.

It stops being the right choice when you need more than 30 seconds of CPU time, more than 128 MB of memory, or filesystem access. At that point, deploy Bun directly on a VPS — or better yet, on Fly.io with a Bun Docker image. The edge is fast, but sometimes a single machine in Frankfurt is fast enough.


Originally published at pickuma.com. Subscribe to the RSS or follow @pickuma.bsky.social for new reviews.