Skip to content

SylphxAI/gust

@sylphx/gust

High-performance HTTP server framework for Bun and Node.js

CI npm License

Performance

Dynamic Routes (Bun Runtime)

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

Static Routes (Bun Runtime)

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:3000 on Apple M3 Max

Architecture

┌─────────────────────────────────────────────────────────────┐
│                        @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

Packages

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

Features

  • 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.

Quick Start

bun add @sylphx/gust
# or
npm install @sylphx/gust
import { 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 })

Usage Patterns

Full Server (recommended)

import { createApp, serve, get, json } from '@sylphx/gust'

const app = createApp({
  routes: [get('/', () => json({ hello: 'world' }))],
})

await serve({ app, port: 3000 })

Portable App Only

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 Workers

Server Features Only

import { serve, websocket, clusterServe } from '@sylphx/gust-server'

// WebSocket
serve({ port: 3000, fetch: websocket({ ... }) })

// Cluster mode
clusterServe({ app, workers: 4 })

External Handler Integration

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 })

Documentation

See individual package READMEs for detailed API:

Development

# 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.ts

License

MIT


Built with Sylphx | @sylphx/biome-config | @sylphx/bump | @sylphx/doctor

About

High performance functional HTTP server powered by WASM

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •