[Runtime
](../../index.md)[Package Manager
](../../pm/cli/install/index.md)[Bundler
](../../bundler/index.md)[Test Runner
](../../test/index.md)[Guides
](../../guides/index.md)[Reference
](https://bun.com/reference)[Blog
](https://bun.com/blog)[Feedback
](../../feedback/index.md)
Bun implements a set of native APIs on the Bun global object and through several built-in modules. These APIs are heavily optimized and represent the canonical “Bun-native” way to implement some common functionality. Bun strives to implement standard Web APIs wherever possible. Bun introduces new APIs primarily for server-side tasks where no standard exists, such as file I/O and starting an HTTP server. In these cases, Bun’s approach still builds atop standard APIs like Blob, URL, and Request.
server.ts
Bun.serve({
fetch(req: Request) {
return new Response("Success!");
},
});
Click the link in the right column to jump to the associated documentation.
Topic
APIs
HTTP Server
Shell
Bundler
File I/O
Bun.file, Bun.write, Bun.stdin, Bun.stdout, Bun.stderr
Child Processes
TCP Sockets
UDP Sockets
WebSockets
new WebSocket() (client), Bun.serve (server)
Transpiler
Routing
Streaming HTML
Headless Browser
Hashing
Bun.password, Bun.hash, Bun.CryptoHasher, Bun.sha
CSRF Protection
Bun.CSRF.generate, Bun.CSRF.verify
SQLite
PostgreSQL Client
Bun.SQL, Bun.sql
Redis (Valkey) Client
Bun.RedisClient, Bun.redis
FFI (Foreign Function Interface)
DNS
Bun.dns.lookup, Bun.dns.prefetch, Bun.dns.getCacheStats
Testing
Workers
Module Loaders
Glob
Cookies
Node-API
import.meta
Utilities
Bun.version, Bun.revision, Bun.env, Bun.main
Sleep & Timing
Bun.sleep(), Bun.sleepSync(), Bun.nanoseconds()
Random & UUID
System & Environment
Comparison & Inspection
Bun.peek(), Bun.deepEquals(), Bun.deepMatch, Bun.inspect()
String & Text Processing
Bun.escapeHTML(), Bun.stringWidth(), Bun.indexOfLine
URL & Path Utilities
Bun.fileURLToPath(), Bun.pathToFileURL()
Compression
Bun.gzipSync(), Bun.gunzipSync(), Bun.deflateSync(), Bun.inflateSync(), Bun.zstdCompressSync(), Bun.zstdDecompressSync(), Bun.zstdCompress(), Bun.zstdDecompress()
Stream Processing
Bun.readableStreamTo*(), Bun.readableStreamToBytes(), Bun.readableStreamToBlob(), Bun.readableStreamToFormData(), Bun.readableStreamToJSON(), Bun.readableStreamToArray()
Memory & Buffer Management
Bun.ArrayBufferSink, Bun.allocUnsafe, Bun.concatArrayBuffers
Module Resolution
Parsing & Formatting
Bun.semver, Bun.TOML.parse, Bun.markdown, Bun.color
Low-level / Internals
Bun.mmap, Bun.gc, Bun.generateHeapSnapshot, bun:jsc
Was this page helpful?
[
Globals
Previous
](../globals/index.md)[
Web APIs
Next
](../web-apis/index.md)