{"id":14222489,"url":"https://github.com/specta-rs/specta","last_synced_at":"2025-05-16T01:06:34.700Z","repository":{"id":77133671,"uuid":"579107617","full_name":"specta-rs/specta","owner":"specta-rs","description":"Easily export your Rust types to other languages","archived":false,"fork":false,"pushed_at":"2025-04-28T05:42:52.000Z","size":1458,"stargazers_count":371,"open_issues_count":95,"forks_count":47,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-05-14T03:15:53.344Z","etag":null,"topics":["reflection","rspc","rust","rust-macro","specta","tauri-specta","typesafe","typescript"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/specta-rs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["oscartbeaumont"],"custom":["https://paypal.me/oscartbeaumont"]}},"created_at":"2022-12-16T17:18:52.000Z","updated_at":"2025-05-13T16:48:13.000Z","dependencies_parsed_at":"2023-11-25T04:22:56.030Z","dependency_job_id":"ba0de7cd-d866-477a-b079-67a32789a9f9","html_url":"https://github.com/specta-rs/specta","commit_stats":{"total_commits":259,"total_committers":16,"mean_commits":16.1875,"dds":"0.20463320463320467","last_synced_commit":"8509af0162b26bb2c08e84a41cdfc4eaf67a6ab3"},"previous_names":["specta-rs/specta"],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/specta-rs%2Fspecta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/specta-rs%2Fspecta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/specta-rs%2Fspecta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/specta-rs%2Fspecta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/specta-rs","download_url":"https://codeload.github.com/specta-rs/specta/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254448579,"owners_count":22072764,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["reflection","rspc","rust","rust-macro","specta","tauri-specta","typesafe","typescript"],"created_at":"2024-08-19T19:02:06.694Z","updated_at":"2025-05-16T01:06:29.679Z","avatar_url":"https://github.com/specta-rs.png","language":"Rust","funding_links":["https://github.com/sponsors/oscartbeaumont","https://paypal.me/oscartbeaumont"],"categories":["Rust"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n    \u003cimg height=\"150\" src=\".github/logo.png\" alt=\"Specta Logo\"\u003e\u003c/img\u003e\n    \u003ch1\u003eSpecta\u003c/h1\u003e\n    \u003cp\u003e\u003cb\u003eEasily export your Rust types to other languages\u003c/b\u003e\u003c/p\u003e\n    \u003ca href=\"https://discord.com/invite/5M6fpszrry\"\u003e\u003cimg src=\"https://img.shields.io/discord/1011665225809924136?style=flat-square\" alt=\"Discord\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://crates.io/crates/specta\"\u003e\u003cimg src=\"https://img.shields.io/crates/d/specta?style=flat-square\" alt=\"Crates.io\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://crates.io/crates/specta\"\u003e\u003cimg src=\"https://img.shields.io/crates/v/specta.svg?style=flat-square\"\n    alt=\"crates.io\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://docs.rs/specta\"\u003e\u003cimg src=\"https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square\" alt=\"docs.rs\" /\u003e\u003c/a\u003e\n    \u003ca href=\"/LICENSE.md\"\u003e\u003cimg src=\"https://img.shields.io/crates/l/specta?style=flat-square\" alt=\"License\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n\u003cbr\u003e\n\n## Features\n\n - Export structs and enums to [Typescript](https://www.typescriptlang.org)\n - Get function types to use in libraries like [tauri-specta](https://github.com/oscartbeaumont/tauri-specta)\n - Supports wide range of common crates in Rust ecosystem\n - Supports type inference - can determine type of `fn demo() -\u003e impl Type`.\n\n## Ecosystem\n\nSpecta can be used in your application either directly or through a library which simplifies the process of using it.\n\n - [rspc](https://github.com/oscartbeaumont/rspc) - Easily building end-to-end typesafe APIs\n - [tauri-specta](https://github.com/oscartbeaumont/tauri-specta) - Typesafe Tauri commands and events\n - [TauRPC](https://github.com/MatsDK/TauRPC) - Tauri extension to give you a fully-typed IPC layer.\n\n## Usage\n\nAdd `specta` as a dependency to your project,\nenabling the languages you want to export to:\n\n```bash\ncargo add specta --features typescript # only 'typescript' is currently supported\n```\n\nThen you can use Specta like so:\n\n```rust\nuse specta::{ts, Type};\n\n#[derive(Type)]\npub struct TypeOne {\n    pub a: String,\n    pub b: GenericType\u003ci32\u003e,\n    #[serde(rename = \"cccccc\")]\n    pub c: MyEnum,\n}\n\n#[derive(Type)]\npub struct GenericType\u003cA\u003e {\n    pub my_field: String,\n    pub generic: A,\n}\n\n#[derive(Type)]\npub enum MyEnum {\n    A,\n    B,\n    C,\n}\n\nfn main() {\n    assert_eq!(\n        ts::export::\u003cTypeOne\u003e(\u0026Default::default()).unwrap(),\n        \"export type TypeOne = { a: string; b: GenericType\u003cnumber\u003e; cccccc: MyEnum }\".to_string()\n    );\n}\n```\n\nCheck out the [docs](https://docs.rs/specta) for more information.\n\n\n## Motivation\n\nThis library was originally created to power the type exporting functionality of [rspc](https://rspc.dev),\nbut after building it we realized that it could be useful for other projects as well so we decided to move it into a dedicated library.\n\nA huge thanks to [Brendonovich](https://github.com/brendonovich) for doing a heap of development on this library.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspecta-rs%2Fspecta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspecta-rs%2Fspecta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspecta-rs%2Fspecta/lists"}