Bun 1.2: native S3, built-in Postgres, 2x faster fetch
Posted by Krishna Vrajendra · 2025-05-14
Bun 1.2 ships native S3 client, built-in Postgres driver, and doubles fetch performance. Batteries-included runtime vision is becoming reality. https://github.com/oven-sh/bun/releases/tag/bun-v1.2.0
// Bun 1.2 — native S3 + Postgres
import { S3 } from 'bun';
import { sql } from 'bun:sql';
const db = sql`postgres://localhost/myapp`;
const s3 = new S3({ bucket: 'uploads' });
Bun.serve({
port: 3000,
async fetch(req) {
const url = new URL(req.url);
if (url.pathname === '/upload') {
const file = await req.formData();
await s3.put('uploads/' + file.get('name'), file.get('file'));
return Response.json({ ok: true });
}
const users = await db`SELECT * FROM users LIMIT 10`;
return Response.json(users);
}
});