Bun vs Deno
Bun (Zig runtime, %3x hızlı) vs Deno (Rust runtime, TypeScript-first) — modern Node.js alternative'ları karşılaştırması. Performance, compatibility, ecosystem.
Rust çekirdekli, hepsi-bir-arada hızlı JS/TS runtime
2009'dan beri kurumsal-sınıf JavaScript runtime standardı
Net cevap yok, ama net bir karar çerçevesi var. Yeni, saf JS/TS bağımlılıklı bir HTTP servisi yazıyorsan, hız ve entegre tooling istiyorsan Bun 1.4 artık ciddi bir seçenek — Node 26.3.0 uyumunda 1.517 test geçmesi bunu somutlaştırıyor. Ama native N-API modüllerine (sharp, native bcrypt, bazı DB driver'ları) bağımlıysan, ya da uzun ömürlü kurumsal bir SSR/API sistemi işletiyorsan, Node 24 LTS'in 30 aylık resmi destek taahhüdü ve devasa native-modül ekosistemi hâlâ daha güvenli varsayılan. Aynı projede "Bun = tooling (install/test/build), Node = production runtime" hibriti de meşru ve giderek yaygınlaşan bir yaklaşım — kademeli benimseme riski azaltıyor. Kararını sentetik "req/s" rakamlarına değil, kendi bağımlılık listeni `bun install` ile test ederek ve gerçek yük profiline göre ver.
| Kategori | Bun 1.4 | Node.js 26 / 24 LTS |
|---|---|---|
| Performans | 9/10 | 7/10 |
| Öğrenme Kolaylığı | 8/10 | 7/10 |
| Ekosistem | 6/10 | 10/10 |
| Topluluk | 6/10 | 10/10 |
| İş Pazarı | 5/10 | 10/10 |
| Gelecek | 8/10 | 9/10 |
// Bun 1.4 — HTTP/2 destekli native sunucu (Bun.serve) + yerleşik SQL client
// bun run server.ts ile doğrudan TypeScript çalıştırılır, transpile adımı yok
import { SQL } from "bun";
// Bun'ın yerleşik SQL client'ı: sorgular tagged template olarak yazılır
const db = new SQL(process.env.DATABASE_URL!);
const server = Bun.serve({
port: 3000,
// Bun v1.4.1'den beri Bun.serve native HTTP/2 destekler
http2: true,
async fetch(req: Request): Promise<Response> {
const url = new URL(req.url);
if (url.pathname === "/api/users" && req.method === "GET") {
const users = await db`SELECT id, name FROM users LIMIT 20`;
return Response.json(users);
}
if (url.pathname === "/api/upload" && req.method === "POST") {
const body = await req.formData();
const file = body.get("file") as File;
// Bun.write diske stream eder, ek buffer kopyalamaya gerek yok
await Bun.write(`./uploads/${file.name}`, file);
return Response.json({ ok: true, size: file.size });
}
return new Response("Not Found", { status: 404 });
},
});
console.log(`Bun sunucusu ${server.port} portunda dinliyor (HTTP/2 aktif)`);
// bun install ile bağımlılık kurulumu — npm-uyumlu node_modules üretir
// $ bun install
// $ bun test
// $ bun build ./server.ts --outdir ./dist --target bun// Node.js 24 LTS — native http modülü + type-stripping ile doğrudan TS
// Type stripping v23.6.0/v22.18.0'dan beri varsayılan, v25.2.0/v24.12.0'dan stabil: yalnız "erasable syntax" TS desteği
// node server.ts (24.12+ ve 26.x'te bayraksız çalışır; kapatmak için --no-strip-types)
import { createServer } from "node:http";
import { readFile, writeFile } from "node:fs/promises";
import { Pool } from "pg";
const pool = new Pool({ connectionString: process.env.DATABASE_URL });
const server = createServer(async (req, res) => {
const url = new URL(req.url ?? "/", `http://${req.headers.host}`);
if (url.pathname === "/api/users" && req.method === "GET") {
const result = await pool.query("SELECT id, name FROM users LIMIT 20");
res.writeHead(200, { "Content-Type": "application/json" });
res.end(JSON.stringify(result.rows));
return;
}
if (url.pathname === "/api/report" && req.method === "GET") {
// worker_threads ile CPU-yoğun işi ana thread'i bloklamadan çalıştır
const { Worker } = await import("node:worker_threads");
const worker = new Worker("./report-worker.js");
worker.once("message", (report) => {
res.writeHead(200, { "Content-Type": "application/json" });
res.end(JSON.stringify(report));
});
return;
}
res.writeHead(404);
res.end("Not Found");
});
server.listen(3000, () => {
console.log("Node.js sunucusu 3000 portunda dinliyor");
});
// npm install ile bağımlılık kurulumu
// $ npm install
// $ node --testNet cevap yok, ama net bir karar çerçevesi var. Yeni, saf JS/TS bağımlılıklı bir HTTP servisi yazıyorsan, hız ve entegre tooling istiyorsan Bun 1.4 artık ciddi bir seçenek — Node 26.3.0 uyumunda 1.517 test geçmesi bunu somutlaştırıyor. Ama native N-API modüllerine (sharp, native bcrypt, bazı DB driver'ları) bağımlıysan, ya da uzun ömürlü kurumsal bir SSR/API sistemi işletiyorsan, Node 24 LTS'in 30 aylık resmi destek taahhüdü ve devasa native-modül ekosistemi hâlâ daha güvenli varsayılan. Aynı projede "Bun = tooling (install/test/build), Node = production runtime" hibriti de meşru ve giderek yaygınlaşan bir yaklaşım — kademeli benimseme riski azaltıyor. Kararını sentetik "req/s" rakamlarına değil, kendi bağımlılık listeni `bun install` ile test ederek ve gerçek yük profiline göre ver.
Ücretsiz Danışmanlık AlÇoğu HTTP API/web servisi için evet — Bun 1.4, Node.js 26.3.0 uyumluluk paketinde 1.517 yeni test geçti ve Express/Fastify/Next.js gibi çerçeveler sorunsuz çalışıyor. Ama native N-API addon'larına (sharp, native bcrypt) bağımlıysan ya da 72+ saat çalışan uzun ömürlü process'lerin varsa, Node'un V8 tabanlı GC davranışı hâlâ daha kanıtlanmış. Kısa cevap: yeni servis + saf JS bağımlılık = Bun uygun; eski/native-ağır sistem = Node.