- Zero Config - No build step, point at routes and serve.
- File-Based Routing - Route files in a folder mirror the URL.
- Context - Read request data and respond through one object.
- Middleware - Run global or per-path logic before handlers.
- Validation - Check body, query, and params before handlers.
- Static Files - Serve directories with optional cache and etag.
- Rendering - Build dynamic HTML from templates with streaming.
- Error Handling - Catch every error with custom or default responses.
- Observability - Subscribe to lifecycle, request, and error events.
- Hot Reload - Routes and templates reload without a restart.
- Worker Pool - Offload CPU-bound work to keep server 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.