High-performance HTTP server framework for Bun and Node.js
Real-world benchmark with JS handler callbacks per request:
| Framework | Requests/sec | Relative |
|---|---|---|
| Gust (Native) | 141,266 | 1.00x |
| Bun.serve | 136,313 | 0.96x |
| Elysia | 129,224 | 0.91x |
| Hono | 125,000 | 0.88x |
| Express | 47,343 | 0.34x |
Maximum throughput with pre-computed responses:
| Framework | Requests/sec | Relative |
|---|---|---|
| Gust (Turbo) | 232,704 | 1.00x |
| Bun.serve | 183,716 | 0.79x |
| Elysia | 192,386 | 0.83x |
| Hono | 157,729 | 0.68x |
Benchmarks:
bombardier -c 500 -d 10s http://localhost:3000on Apple M3 Max
┌─────────────────────────────────────────────────────────────┐
│ @sylphx/gust │
│ (main package) │
├─────────────────────────┬───────────────────────────────────┤
│ @sylphx/gust-app │ @sylphx/gust-server │
│ Stateless framework │ Rust HTTP server │
│ • createApp() │ • serve() │
│ • Routes, middleware │ • Cluster, HTTP/2 │
│ • WASM router │ • WebSocket, SSE │
│ • Portable │ • Native acceleration │
├─────────────────────────┴───────────────────────────────────┤
│ @sylphx/gust-core │
│ WASM Router • Response Helpers │
├─────────────────────────┬───────────────────────────────────┤
│ Native (Rust) │ WASM Fallback │
│ hyper + tokio │ Universal runtime │
│ napi-rs bindings │ HTTP parser + router │
│ io_uring on Linux │ │
│ 141K+ req/s │ │
└─────────────────────────┴───────────────────────────────────┘
Modular design:
- @sylphx/gust - Main package, re-exports everything
- @sylphx/gust-app - Portable app framework (serverless, edge, any runtime)
- @sylphx/gust-server - Native Rust server (maximum performance)
- @sylphx/gust-core - Core WASM runtime and utilities
| Package | Description | Size |
|---|---|---|
| @sylphx/gust | Main package (re-exports both) | ~87 B |
| @sylphx/gust-app | Stateless app framework | 82 KB |
| @sylphx/gust-server | Rust-powered HTTP server | 73 KB |
| @sylphx/gust-core | Core WASM runtime | ~4 KB |
- Native Performance - Rust-powered with io_uring on Linux, multi-core workers
- Portable Apps - Same code on Bun, Deno, Cloudflare Workers, AWS Lambda
- Type-safe - Full TypeScript support with path param inference
- Batteries included - 20+ middleware (auth, validation, rate limiting, etc.)
- Streaming - SSE, WebSocket, range requests for media
- Production-ready - Health checks, graceful shutdown, OpenTelemetry
- Ecosystem Compatible - Direct integration with GraphQL Yoga, tRPC, Hono, etc.
bun add @sylphx/gust
# or
npm install @sylphx/gustimport { createApp, serve, get, json, cors, rateLimit, compose } from '@sylphx/gust'
const app = createApp({
routes: [
get('/', () => json({ message: 'Hello World!' })),
get('/users/:id', ({ ctx }) => json({ id: ctx.params.id })),
],
middleware: compose(
cors(),
rateLimit({ max: 100, window: 60000 }),
),
})
await serve({ app, port: 3000 })import { createApp, serve, get, json } from '@sylphx/gust'
const app = createApp({
routes: [get('/', () => json({ hello: 'world' }))],
})
await serve({ app, port: 3000 })For serverless/edge deployments:
import { createApp, get, json } from '@sylphx/gust-app'
const app = createApp({
routes: [get('/', () => json({ hello: 'world' }))],
})
// Use with any runtime
Bun.serve({ fetch: app.fetch })
Deno.serve(app.fetch)
export default { fetch: app.fetch } // Cloudflare Workersimport { serve, websocket, clusterServe } from '@sylphx/gust-server'
// WebSocket
serve({ port: 3000, fetch: websocket({ ... }) })
// Cluster mode
clusterServe({ app, workers: 4 })Seamlessly integrate GraphQL Yoga, tRPC, Hono, or any fetch-based handler:
import { createApp, serve, all } from '@sylphx/gust'
import { createYoga } from 'graphql-yoga'
const yoga = createYoga({ schema })
const app = createApp({
routes: [
// Direct integration - just pass the handler!
all('/graphql', yoga.fetch),
],
})
await serve({ app, port: 3000 })See individual package READMEs for detailed API:
- @sylphx/gust documentation
- @sylphx/gust-app documentation - Routes, middleware, validation
- @sylphx/gust-server documentation - Server, WebSocket, SSE, streaming
- @sylphx/gust-core documentation
# Install dependencies
bun install
# Run tests
bun test
# Build all packages
bun run build
# Build native bindings
cd crates/gust-napi && bun run build
# Run benchmarks
bun run benchmarks/servers/gust.tsMIT
Built with Sylphx | @sylphx/biome-config | @sylphx/bump | @sylphx/doctor