Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Feb 19, 2025. It is now read-only.

sinclairnick/webroute

Repository files navigation

Webroute

Web APIs, from the route-up.

Warning

This project has been succeeded by a much simpler and better approach, called Midwinter.js.

Overview

Webroute helps you build self-sufficient, web-standard routes that have everything they need: path, method, I/O shape and validation, middleware and request handler.

It was invented to make building sophisticated APIs easier in the diverse ecosystem of serverless (but also serverful) full-stack and backend development.

Inspiration

Webroute was heavily inspired by tRPC, but built specifically for HTTP. So if you're a fan of either, you'll probably like webroute.

Features

  • πŸ‘‹ Unopinionated and minimal API, by design
  • πŸ”’ End-to-end type safety (including middleware)
  • βœ… First-class validation and schema support
  • πŸ•ΈοΈ HTTP based
  • 🚏 Works well with serverless routes
  • 🐳 ...or monolithic backends

Example Usage

A basic webroute might look something like this:

import { route } from "@webroute/route";
const myRoute = route("/user/:id")
 .use(authMiddleware)
 .params(z.object({ id: z.string() }))
 .handle(async (req) => {
 // ...do work
 });

Which is just a regular web-standard request handler:

const response = myRoute(new Request("..."));

Being web-standard and self-sufficient, it can be used directly, with no modification, with popular frameworks like Next.js, and Hono or within runtimes like bun, deno and node.

Read the Quick Start.

What's in the box?

Webroute provides the functionality of a full-blown framework, without being one. Instead, it offers a handful of packages which can be selectively installed to fill in the gaps, when your use case requires it.

Webroute is "full-stack", in the sense it provides utilities and patterns for both the client-side and server-side. However, these client- and server-side tools are not dependent on the other - one can be used without the other.

Compatibility

Webroute works with all runtimes or frameworks that conform to the WinterCG Minimum Web Standard.

Frameworks

  • Hono
  • Next.js
  • Remix
  • SolidStart
  • SvelteKit

Runtimes

  • Bun
  • Deno
  • Node (via adapter)
  • Cloudflare Workes
  • Vercel Edge

About

πŸ•ΈοΈ Web APIs, from the route up

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /