- Zero Config - No build step. Point to routes and serve.
- File-Based Routing - Put route files in a folder, URL follows that structure.
- Context - Body, query, params, cookies, headers, plus helpers to respond.
- Middleware - Global or per path. CORS, CSRF, IP, auth, session, WebSocket.
- Static Files - Serve directories with optional cache and etag.
- Error Handling - Custom or default HTML/JSON error responses.
- Observability - Subscribe to lifecycle, request, and error events.
- Hot Reload - Routes and templates reload automatically when files change.
- Worker Pool - Offload heavy work to a pool so the server stays responsive.
Note
Prerequisites: Deno 2.7.0 or later.
# Add Deserve from JSR
deno add jsr:@neabyte/deserveSee the installation guide for details.
Create a routes directory and export HTTP method handlers. Start the server.
import { Router } from 'jsr:@neabyte/deserve'
// Create router pointing at routes directory
const router = new Router({ routesDir: './routes' })
// Optional worker pool for CPU-bound work
// const router = new Router({
// routesDir: './routes',
// worker: { scriptURL: import.meta.resolve('./worker.ts'), poolSize: 4 }
// })
// Read handle: ctx.getState('worker' as never)
// Start server on port 8000
await router.serve(8000)Example route in routes/hello.ts:
import type { Context } from 'jsr:@neabyte/deserve'
// Export GET, POST, PUT, path from file location
export function GET(ctx: Context): Response {
return ctx.send.json({ message: 'Hello from Deserve' })
}From the repo root (requires Deno).
Check - format, lint, and typecheck:
# Format, lint, and typecheck source
deno task checkTest - run tests (under tests/, uses --allow-read for fixtures):
# Run tests in tests/ (uses --allow-read for fixtures)
deno task testBenchmark - autocannon runs. benchmark/README.md for details.
Full documentation (EN / ID): docs-deserve.neabyte.com
- Cursor / VS Code extension: See editor/README.md
- Bugs & ideas - GitHub Issues
- Code & docs - Pull Requests welcome.
- Use it - Try Deserve in real projects and share feedback.
This project is licensed under the MIT license. See LICENSE for details.