Webroute simplifies the creation of robust web APIs by offering everything you need—from routes to validation—without the constraints of traditional frameworks. Designed for both serverless and serverful environments, it's unopinionated, type-safe, and integrates effortlessly with popular technologies. Dive into a world of streamlined API development.
Webroute is a powerful tool designed to simplify the creation of web-standard APIs from the ground up. With its user-friendly framework, developers can effortlessly build self-sufficient routes that encompass everything needed for efficient operation—such as path, method, input/output validation, middleware, and request handling.
Key Features
- Minimal and Unopinionated: Webroute offers a clean and flexible API, allowing developers to implement their solutions without unnecessary constraints.
- End-to-End Type Safety: Enjoy comprehensive type safety across all layers of your web API, including middleware functions.
- Robust Validation: Built-in schema validation ensures that all incoming data is accurately validated to maintain the reliability of your application.
- HTTP-Focused: Designed specifically for HTTP interactions, making it suitable for a wide array of applications.
- Serverless and Monolithic Compatibility: Whether you're developing serverless functions or monolithic backends, Webroute integrates seamlessly into both environments.
Example Usage
Here’s a quick snippet illustrating how to define a basic route with Webroute:
import { route } from "@webroute/route";
const myRoute = route("/user/:id")
.use(authMiddleware)
.params(z.object({ id: z.string() }))
.handle(async (req) => {
// ...perform necessary operations
});
const response = myRoute(new Request("..."));
This showcases the ease of declaring routes that interact directly with standard web requests, suitable for use with frameworks like Next.js
, Hono
, or even in various runtimes such as bun
, deno
, and node
.
Broad Compatibility
Webroute is designed to work with any framework or runtime that adheres to the WinterCG Minimum Web Standard, ensuring flexibility across different development environments. Supported frameworks include:
Hono
Next.js
Remix
SolidStart
SvelteKit
Supported runtimes include:
Bun
Deno
Node
(via adapter)Cloudflare Workers
Vercel Edge
Why Choose Webroute?
If you're looking for an unopinionated, yet powerful way to build APIs with comprehensive type safety and first-class validation, Webroute is your go-to solution. It integrates effortlessly into existing projects and enhances development efficiency without compromising on functionality. Dive into the documentation and explore how Webroute can elevate your API development process.