Skip to content
This repository has been archived by the owner on Feb 19, 2025. It is now read-only.

Commit

Permalink
Update readme, index doc
Browse files Browse the repository at this point in the history
  • Loading branch information
sinclairnick committed Jul 4, 2024
1 parent b3af18b commit a96ab9b
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 138 deletions.
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
*.mdx
# *.mdx
114 changes: 44 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,91 +1,65 @@
<div align="center">

<h1>Webroute</h1>

<p><b>Building blocks for REST APIs, built on industry standards</b></p>
<p>
<b>The web toolkit for full-stack connoisseurs.</b>
</p>

</div>

<img src="./static/webroute-cover.jpg"/>

## Overview

Webroute is a set of building blocks which can combine to form a fully fledged web framework. Each tool is decoupled from the next, meaning they are all independently useful. But they can also be stacked, leaving you with a strong foundation for quickly building backend web apps that are future-proofed.

**View the [documentation](https://webroute.vercel.app).**

## Example Usage

```ts
import { route } from "@webroute/route";

export const myRoute = route("/post/:id")
.method("get")
.use(isAuthed())
.params(z.object({ id: z.string() }))
.handle(async (req, c) => {
const { params } = await c.parse();
// ...
return { title: "..." };
});

// myRoute: (req: Request) => Response
```

## Quick Start

To get up and running quickly with a fully-fledged app, you can use the `create-webroute-app` command:

```sh
npx create-webroute-app ./my-app
```

## How is this different to X?
<div align="center">
<a href="https://webroute.vercel.app/docs">
Docs
</a>
&bull;
<a href="https://webroute.vercel.app/docs/guides/quick-start">
Quick Start
</a>
&bull;
<a href="https://webroute.vercel.app/docs/route/overview">
Route
</a>
&bull;
<a href="https://webroute.vercel.app/docs/client/overview">
Client
</a>
&bull;
<a href="https://webroute.vercel.app/docs/oas/overview">
OpenAPI
</a>
</div>

Webroute is not a framework. Modern web apps are deployed to a range of different environments, runtimes and architectures. Webroute provides a handful of _independent_ libraries to help with common tasks like routing, route handling, middleware and client-side type-safety.
## Overview

Webroute was designed to get out of your way and to be minimally opinionated. We prefer requiring slightly more additional setup if it means much greater flexibility – and less lock-in – for the lifetime of an app.
Webroute provides a few packages which make building and consuming HTTP APIs a breeze, both on the client- and server-side.

## [Packages](https://webroute.vercel.app/docs/packages)
As opposed to monolithic frameworks, webroute merely provides you with the tools to create powerful APIs alongside your favourite runtime, full-stack framework and/or platform.

Webroute provides several packages that are entirely independent of one another. Combined, they can be used to create fully-fledged REST APIs.
## Why?

They will work with any framework or runtime that utilises web-standard `Request` and `Response` objects.
Modern API development is extremely fragmented across vast combinations of frameworks, runtimes and platforms. Monolithic web frameworks are no longer suitable.

| Package | Purpose |
| ----------------------------------------------------------------------- | ------------------------------------------------------------- |
| [**Route**](https://webroute.vercel.app/docs/route/overview) | Build powereful and atomic web-standard request handlers |
| [**Client**](https://webroute.vercel.app/docs/client/overview) | Create type-safe clients for any REST API |
| [**Middleware**](https://webroute.vercel.app/docs/middleware/overview) | Middleware compatible with any framework |
| [**Schema**](https://webroute.vercel.app/docs/schema/overview) | Universal converters, parsers and infererence for any schema |
| [**Router**](https://webroute.vercel.app/docs/router/overview) | Match incoming `Request`s to request handlers |
| [**OpenAPI Spec (OAS)**](https://webroute.vercel.app/docs/oas/overview) | Define, generate and infer OpenAPI schema without any codegen |
Instead, webroute has implemented the core elements you _might_ need in a web framework, and you can easily piece together those that suit your use case.

## Compatibility

Webroute was built from the ground up to be friendly with most existing tools. It can be used standalone or alongside existing frameworks, and in various runtimes.

### Frameworks:

- ✅ Hono
- ✅ NextJS
- ✅ Remix
- ✅ SolidStart

### Runtimes:

- ✅ Bun
- ✅ Deno
- ✅ Node (via adapter)
- ✅ Cloudflare Workers
- ✅ Vercel Edge

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

## Contribution
### Frameworks

Feel free to [open any PRs or issues](https://github.com/sinclairnick/webroute/issues) or [start a discussion](https://github.com/sinclairnick/webroute/issues).
- [x] `Hono`
- [x] `Next.js`
- [x] `Remix`
- [x] `SolidStart`
- [x] `SvelteKit`

## Author
### Runtimes

Webroute was initially developed by [Nick Sinclair](https://github.com/sinclairnick)
- [x] `Bun`
- [x] `Deno`
- [x] `Node` <small>(via adapter)</small>
- [x] `Cloudflare Workes`
- [x] `Vercel Edge`
61 changes: 0 additions & 61 deletions docs/content/docs/comparisons.mdx

This file was deleted.

21 changes: 17 additions & 4 deletions docs/content/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,25 @@ title: Overview
icon: Home
---

Webroute is a toolkit for building and interacting with APIs in a type-safe, robust and ergonomic manner.

**Webroute is a suite of independent tools for building server-side apps and APIs, based on the [WinterCG Minimum Common Web API](https://common-min-api.proposal.wintercg.org/).**
It was designed to work with your existing stack, or be used standalone. As a result, webroute offers a selection of independent packages which you can mix-and-match as needed.

Instead of a monolithic framework, Webroute provides a handful of independent packages. Boundaries between **routing**, **middleware**, **validation**, **routing** and **client** are clearly defined and separate. This means you're not tied down by framework or runtime.
Additionally, industry standards are heavily leaned into so you can "learn the platform" instead of another bespoke framework API.

## Get Started

The fastest way to get started with webroute is via the `create-webroute-app` CLI.

```sh
npx create-webroute-app webroute-app
```

This will dynamically build an starter app with the features you require.

## Philosophy

When building new web tools, the following principles are followed.
To achieve a balance of flexibility, ease of use and interoperability, webroute adheres to a few principles.

| Concept | Description |
| ---------------- | :------------------------------------------------------------------------------------- |
Expand All @@ -19,5 +30,7 @@ When building new web tools, the following principles are followed.
| **Pure** | Preferring basic input/output functions over side-effectful ones |
| **Atomic** | Standalone functionality is better than requiring complex integration or orchestration |
| **Declarative** | When useful, prefer declarative over imperative approaches, enabling introspection |
| **No magic** | No monkey-patching, wrapped `Request`/`Response` objects |
| **No magic** | No monkey-patching, no wrapped `Request`/`Response` objects, no magical compilers |
| **Composable** | Prefer composition over orchestration so pipelines are traceable and reasonable |

These principles, and their benefits will become clearer over the course of these docs.
3 changes: 1 addition & 2 deletions docs/content/docs/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"root": true,
"pages": [
"index",
"comparisons",
"---Guides---",
"guides/quick-start",
"---Packages---",
Expand All @@ -17,4 +16,4 @@
"---About---",
"acknowledgements"
]
}
}

0 comments on commit a96ab9b

Please sign in to comment.