specta
typeshare
specta | typeshare | |
---|---|---|
1 | 10 | |
203 | 30 | |
- | - | |
8.8 | 0.0 | |
6 days ago | over 4 years ago | |
Rust | Rust | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
specta
-
Using rust to generate typescript client
I assume you're using Axum or Actix as your router & web server, in which case I think using OpenAPI specs is your best option. I see that rspc has already been mentioned in this thread, which I would definitely recommend (disclaimer - I work at the company that builds it) if continuing to use REST wasn't a priority, since it can auto-generate all the TS bindings you need and has a React Query integration so you'd feel right at home. It's able to do so much since it's able to sit between your backend and frontend code, but REST is a lot less opinionated, hence the recommendation to continue using OpenAPI. However, if you're willing to lose some type-safety there's the option of using a Rust -> TS generator specifically for your data types, and then manually use React Query. You'd lose the type-level enforcement of your routes, but at least you'd have your structs and enums available in TS. If you were to take this route I'd personally recommend using Specta, since it's the Rust -> TS generator that powers rspc, but there's also ts-rs and Typeshare which could probably do the job (though I don't think they're as good).
typeshare
-
Using rust to generate typescript client
It doesn’t generate a complete client but 1Password’s Typeshare can generate TypeScript from Rust data structures https://github.com/1password/typeshare
-
Is rust overkill for most back-end apps that could be done quickly by NodeJS or PHP?
Aren't there things like typeshare to aid with that case?
-
Bloom's 2 Sigma Problem
Sure. I would love some help. I am visiting my family all March (I am typing this from the airport), so I don't know how much time I'll have to work on trane for the next month. But maybe that gives you some time to use it, and read the code and docs.
I am not going to put my personal email here, and I don't see an option to send private messages on hn, although it's probably out there somewhere. Probably in the commits, lol. Worst case, feel free to open an issue on the trane repo.
As a first ask, what do you think of this: https://github.com/1Password/typeshare?
I figured writing the UI in rust is probably not a good idea. The ecosystem for UI is very immature and the language itself is probably overkill. But doing it in typescript/html/css requires you to understand the internal data structures (all the JSON files you see in the courses are just serialized rust objects).
I found that repo and it seems like a promising approach to autogenerate the types and make the interaction easier.
-
Generating java code from rust structs
How does this compare to typeshare?
-
Upcoming Q and A re: Typeshare, a tool to help Rust developers generate consistent type schema
Recently, 1Password open-sourced Typeshare, to help Rust developers create FFI (foreign function interfaces). Curious to learn more? Join the team behind the tool this week on Zoom at 11a Eastern to discuss Typeshare and answer any questions.
-
Open Source Project
Newly open-sourced project that might be handy for some of you all https://github.com/1Password/typeshare
- Typeshare: Synchronize type definitions between Rust and other languages
- 1Password releases Typeshare, the "ultimate tool for synchronizing your type definitions between Rust and other languages for seamless FFI"
-
How to Build a Rust CLI Tool to Generate Typescript Types from Rust
Typeshare by 1Password, the original inspiration for this blog post. It's available on crates.io.
-
Rust in Production: 1Password
For sure! We actually open sourced an early version of it a while back (https://github.com/1Password/typeshare), but it became a slowdown to work on it both for our own internal needs and for the outside world, so that was abandoned and it's since fallen out of sync with the project internally today.
What are some alternatives?
Rust-Struct-Reification - A macro to reify structs and their fields for type-safe runtime invocation and reflective access to fields and attributes
card_game
deno - A modern runtime for JavaScript and TypeScript.
bitwarden_rs - Unofficial Bitwarden compatible server written in Rust, formerly known as bitwarden_rs [Moved to: https://github.com/dani-garcia/vaultwarden]
default-args.rs - zero runtime cost default arguments in rust
silver_editor - A small editor for quicksilver and Mergui
rust-delegate - Rust method delegation with less boilerplate
trane - An automated practice system for mastering complex skills
trane-math - Official math courses from the Trane Project
FrameworkBenchmarks - Source for the TechEmpower Framework Benchmarks project
aerospike-client-rust - Rust client for the Aerospike database
wasm-bindgen - Facilitating high-level interactions between Wasm modules and JavaScript