Skip to content

Commit 9b42e66

Browse files
general improvements and restructure of the docs
1 parent 03a0515 commit 9b42e66

23 files changed

+493
-354
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
<p align="center">
2+
<img width="150" height="150" src="/docs/public/logo.png" alt="Logo">
3+
</p>
14
<h1 align="center">rspc</h1>
25
<p align="center">🚧 Work in progress 🚧</p>
36
<div align="center">
@@ -33,7 +36,7 @@
3336

3437
## Example
3538

36-
You define a `rspc` router and attach resolvers to it like below. This will be very familiar if you have used [trpc](https://trpc.io/) or [GraphQL](https://graphql.org) before.
39+
You define a `rspc` router and attach procedures to it like below. This will be very familiar if you have used [trpc](https://trpc.io/) or [GraphQL](https://graphql.org) before.
3740

3841
```rust
3942
let router = <rspc::Router>::new()

docs/markdown/breaking-changes.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ index: 3
55

66
# 0.0.5 to 0.0.6 - rspc
77

8-
This release comes with a huge amount of breaking changes. These changes are going to allow for many benefits in the future such as a rich plugin ecosystem. If your having trouble upgrading open a GitHub Issue or jump in the Discord server.
8+
This release comes with a huge amount of breaking changes. These changes are going to allow for many benefits in the future such as a rich plugin ecosystem. If your having trouble upgrading open a GitHub Issue or jump in the Discord server. New [rspc vscode extension](https://marketplace.visualstudio.com/items?itemName=oscartbeaumont.rspc-vscode) too!
99

1010
### Httpz integration
1111

@@ -30,10 +30,6 @@ const client = createClient<Operations>({
3030
});
3131
```
3232

33-
#### Axum extractors
34-
35-
TODO - Document changes here - Currently `cookies` can be access from `httpz` but not access through `TCtx` because it doesn't satisfy `'static`.
36-
3733
### New Typescript bindings format
3834

3935
The internal format of the generated Typescript bindings has changed. The import has also changed so ensure you update your code as follows.

docs/markdown/client/index.md

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Create Vanilla Client
33
header: Vanilla Client
4-
index: 20
4+
index: 30
55
---
66

77
The vanilla client allows you to consume your API on the frontend. This client is the minimal core and it is recommended that you use the [React](/client/react) or [Solid](/client/solid) integration for building application.
@@ -12,7 +12,7 @@ To get started first install the minimal runtime package.
1212
npm i @rspc/client
1313
```
1414

15-
Next you need to export the Typescript bindings from your `rspc::Router` by using either [export_ts_bindings](/server/router#export_ts_bindings) or [export_ts](/server/router#exporting-the-typescript-bindings).
15+
Next you need to export the Typescript bindings from your `rspc::Router` by using either [export_ts_bindings](/server/router#exporting-the-typescript-bindings) or [export_ts](/server/router#exporting-the-typescript-bindings).
1616

1717
```rust
1818
let router = <rspc::Router>::new()
@@ -39,8 +39,23 @@ const userOne = await client.query(["getUser", 1]);
3939
const userTwo = await client.mutation(["addUser", { name: "Monty Beaumont" }]);
4040
```
4141

42-
[View full example](https://github.com/oscartbeaumont/rspc/tree/main/packages/example/react.tsx)
42+
# Transports
4343

44-
## Websockets
44+
rspc has multiple different transports which can be used.
4545

46-
TODO: Document using websocket transport
46+
```ts
47+
import { createClient, FetchTransport, WebsocketTransport, NoOpTransport } from "@rspc/client";
48+
import type { Procedures } from "./bindings.ts"; // The bindings exported from your Rust code!
49+
50+
const fetchClient = createClient<Procedures>({
51+
transport: new FetchTransport("http://localhost:4000/rspc"),
52+
});
53+
54+
const wsClient = createClient<Procedures>({
55+
transport: new WebsocketTransport("ws://localhost:8080/rspc/ws"),
56+
});
57+
58+
59+
const noOpClient = createClient<Procedures>({
60+
transport: new NoOpTransport(),
61+
});

docs/markdown/client/react.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: React
3+
index: 31
34
---
45

56
rspc can be used on the frontend with [React](https://reactjs.org) via the powerful [React Query](https://tanstack.com/query/v4) library which provides caching, refetching and a lot more.

docs/markdown/client/solidjs.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
---
22
title: SolidJS
3+
index: 32
34
---
45

5-
rspc can be used on the frontend with [SolidJS](https://www.solidjs.com/) via [solid-query](https://github.com/ardeora/solid-query) which provides caching, refetching and a lot more.
6+
rspc can be used on the frontend with [SolidJS](https://www.solidjs.com/) via [Tanstack Solid Query](https://tanstack.com/query/v4/docs/adapters/solid-query) which provides caching, refetching and a lot more.
67

78
To get started first install the required packages.
89

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
---
22
title: Deployment
3+
index: 53
34
---
45

5-
Coming soon...
6+
## Coming soon...
67

78
We will document how to deploy an rspc API to:
89

910
- [Vercel Functions](https://vercel.com/docs/concepts/functions) - Tracked in issue [#9](https://github.com/oscartbeaumont/rspc/issues/9)
11+
- [Netlify Functions](https://www.netlify.com/products/functions/)
1012
- [Fly.io](https://fly.io)
1113
- [Docker Container](https://www.docker.com/)
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
title: Prisma Client Rust
3+
index: 51
34
---
45

5-
More extensive docs coming soon...
6+
## More extensive docs coming soon...
67

78
For now check out the Prisma Client Rust documentation on working with [rspc](https://prisma.brendonovich.dev/extra/rspc).

docs/markdown/ecosystem/zer.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
title: Zer
3+
index: 52
4+
---
5+
6+
## Coming soon...

docs/markdown/integrations/axum.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
---
22
title: Axum
3+
index: 40
34
---
45

5-
**rspc** has a built-in integration with [Axum](https://github.com/tokio-rs/axum) so that you can expose your API over HTTP.
6+
rspc has a built-in integration with [Axum](https://github.com/tokio-rs/axum) so that you can expose your API over HTTP.
67

78
### Enable feature
89

9-
For the integration to work you must enable the `axum` feature of **rspc**. Ensure the rspc line in your `Cargo.toml` file looks like the following:
10+
For the integration to work you must enable the `axum` feature of rspc. Ensure the rspc line in your `Cargo.toml` file looks like the following:
1011

1112
```toml
1213
[dependencies]
@@ -29,8 +30,6 @@ let app = axum::Router::new()
2930
.layer(cors);
3031
```
3132

32-
[View full example](https://github.com/oscartbeaumont/rspc/blob/main/examples/axum.rs)
33-
3433
### Extracting Context from Request
3534

3635
**Warning: The Axum extractor API is probally going to be removed in a future release. If you are using this API, I would appreciate a message in the Discord about your usecase so I can ensure the replacement API can do everything you need.**

docs/markdown/integrations/tauri.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
title: Tauri
3-
index: 30
3+
index: 41
44
---
55

6-
**rspc** has a built-in integration with [Tauri](https://tauri.app/) so that you can expose your API to your frontend code using Tauri's IPC.
6+
rspc has a built-in integration with [Tauri](https://tauri.app/) so that you can expose your API to your frontend code using Tauri's IPC.
77

88
### Enable feature
99

10-
For the integration to work you must enable the `tauri` feature of **rspc**. Ensure the rspc line in your `Cargo.toml` file looks like the following:
10+
For the integration to work you must enable the `tauri` feature of rspc. Ensure the rspc line in your `Cargo.toml` file looks like the following:
1111

1212
```toml
1313
[dependencies]

0 commit comments

Comments
 (0)