17 releases (unstable)

1.0.0-rc.5 Jul 21, 2023
0.3.1 Dec 3, 2024
0.3.0 Nov 20, 2024
0.2.0 Mar 17, 2024
0.0.4 Jul 31, 2022

#1874 in Web programming

Download history 224/week @ 2024-09-23 307/week @ 2024-09-30 245/week @ 2024-10-07 241/week @ 2024-10-14 187/week @ 2024-10-21 176/week @ 2024-10-28 151/week @ 2024-11-04 110/week @ 2024-11-11 324/week @ 2024-11-18 120/week @ 2024-11-25 260/week @ 2024-12-02 294/week @ 2024-12-09 265/week @ 2024-12-16 177/week @ 2024-12-23 87/week @ 2024-12-30 190/week @ 2025-01-06

787 downloads per month
Used in 4 crates

MIT license

160KB
3.5K SLoC

Logo

rspc

🚧 Work in progress 🚧

A blazing fast and easy to use TRPC-like server for Rust.

Website



Example

You define a rspc router and attach procedures to it like below. This will be very familiar if you have used trpc or GraphQL before.

let router = <rspc::Router>::new()
    .query("version", |t| {
        t(|ctx, input: ()| "0.0.1")
    })
    .mutation("helloWorld", |t| {
        t(|ctx, input: ()| async { "Hello World!" })
    });

Features:

  • Per Request Context - Great for database connection & authentication data
  • Middleware - With support for context switching
  • Merging routers - Great for separating code between files

Inspiration

This project is based off trpc and was inspired by the bridge system Jamie Pine designed for Spacedrive. A huge thanks to everyone who helped inspire this project!

Dependencies

~2–46MB
~673K SLoC