15 releases ()

1.0.0-rc.5 Jul 21, 2023
0.2.0 Mar 17, 2024
0.1.3 Mar 5, 2023
0.1.2 Oct 1, 2022
0.0.4 Jul 31, 2022

#928 in Web programming

Download history 264/week @ 2024-01-22 115/week @ 2024-01-29 104/week @ 2024-02-05 138/week @ 2024-02-12 117/week @ 2024-02-19 268/week @ 2024-02-26 321/week @ 2024-03-04 489/week @ 2024-03-11 345/week @ 2024-03-18 445/week @ 2024-03-25 480/week @ 2024-04-01 371/week @ 2024-04-08 369/week @ 2024-04-15 299/week @ 2024-04-22 235/week @ 2024-04-29 136/week @ 2024-05-06

1,052 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–52MB
~720K SLoC