19 releases (unstable)

1.0.0-rc.5 Jul 21, 2023
0.4.1 Feb 7, 2025
0.3.1 Dec 3, 2024
0.3.0 Nov 20, 2024
0.0.4 Jul 31, 2022

#1803 in Web programming

Download history 184/week @ 2024-10-27 135/week @ 2024-11-03 111/week @ 2024-11-10 318/week @ 2024-11-17 140/week @ 2024-11-24 257/week @ 2024-12-01 239/week @ 2024-12-08 289/week @ 2024-12-15 199/week @ 2024-12-22 91/week @ 2024-12-29 189/week @ 2025-01-05 284/week @ 2025-01-12 643/week @ 2025-01-19 409/week @ 2025-01-26 285/week @ 2025-02-02 110/week @ 2025-02-09

1,467 downloads per month
Used in 3 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
~676K SLoC