{"id":28384403,"url":"https://github.com/polyphony-chat/chorus","last_synced_at":"2025-06-25T23:30:54.838Z","repository":{"id":153037774,"uuid":"623159607","full_name":"polyphony-chat/chorus","owner":"polyphony-chat","description":"A Rust library for interacting with multiple Polyphony- and Spacebar-Compatible instances at once.","archived":false,"fork":false,"pushed_at":"2025-06-18T09:44:36.000Z","size":8141,"stargazers_count":23,"open_issues_count":163,"forks_count":9,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-18T10:40:13.249Z","etag":null,"topics":["chat","discord","discord-api","discord-library","rust","spacebar","spacebar-api","spacebarchat"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/chorus","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/polyphony-chat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-04-03T20:19:24.000Z","updated_at":"2025-06-18T09:44:40.000Z","dependencies_parsed_at":"2023-12-17T20:44:14.367Z","dependency_job_id":"942fd5a5-635d-4839-a3f8-7b9a2c192ba7","html_url":"https://github.com/polyphony-chat/chorus","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/polyphony-chat/chorus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polyphony-chat%2Fchorus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polyphony-chat%2Fchorus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polyphony-chat%2Fchorus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polyphony-chat%2Fchorus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/polyphony-chat","download_url":"https://codeload.github.com/polyphony-chat/chorus/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polyphony-chat%2Fchorus/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260539964,"owners_count":23024869,"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":["chat","discord","discord-api","discord-library","rust","spacebar","spacebar-api","spacebarchat"],"created_at":"2025-05-30T08:30:28.299Z","updated_at":"2025-06-25T23:30:54.821Z","avatar_url":"https://github.com/polyphony-chat.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n[![Discord]][Discord-invite]\n[![Build][build-shield]][build-url]\n[![Coverage][coverage-shield]][coverage-url]\n\u003cimg src=\"https://img.shields.io/static/v1?label=Status\u0026message=Alpha\u0026color=blue\"\u003e\n[![FAQ-shield]][FAQ]\n\n[FAQ-shield]: https://img.shields.io/badge/Frequently_Asked_Questions_(FAQ)-ff62bd\n[FAQ]: https://github.com/polyphony-chat/.github/blob/main/FAQ.md\n\n\u003c/br\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://github.com/polyphony-chat/chorus\"\u003e\n    \u003cimg src=\"https://github.com/polyphony-chat/branding/blob/main/logos/polyphony-chorus-round-8bit.png?raw=true\" alt=\"The chorus logo. a dark, square background with rounded edges. on this background, there are three vertically stacked, purple lines. The lines each resemble a sine curve.\" width=\"128\" height=\"128\"\u003e\n  \u003c/a\u003e\n\n\u003ch3 align=\"center\"\u003eChorus\u003c/h3\u003e\n\n  \u003cp align=\"center\"\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"https://docs.rs/chorus/latest/chorus/\"\u003e\u003cstrong\u003eExplore the docs »\u003c/strong\u003e\u003c/a\u003e\n    \u003cbr /\u003e\n    \u003cbr /\u003e\n    \u003ca href=\"https://github.com/polyphony-chat/chorus/issues\"\u003eReport Bug\u003c/a\u003e\n    ·\n    \u003ca href=\"https://crates.io/crates/chorus\"\u003ecrates.io\u003c/a\u003e\n    ·\n    \u003ca href=\"https://discord.gg/8tKSC8wzDq\"\u003eJoin Discord\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n\u003c/div\u003e\n\nChorus is a Rust library which poses as an API wrapper for [Spacebar Chat](https://github.com/spacebarchat/),\nDiscord and our own Polyphony. Its high-level API is designed to be easy to use, while still providing the\nflexibility one would expect from a library like this.\n\nYou can establish as many connections to as many servers as you want, and you can use them all at the same time.\n\n## A Tour of Chorus\n\nChorus combines all the required functionalities of an API wrapper for chat services into one modular library.\nThe library handles various aspects on your behalf, such as rate limiting, authentication and maintaining\na WebSocket connection to the Gateway. This means that you can focus on building your application,\ninstead of worrying about the underlying implementation details.\n\nTo get started with Chorus, import it into your project by adding the following to your `Cargo.toml` file:\n\n```toml\n[dependencies]\nchorus = \"0.20.0\"\n```\n\n### Establishing a Connection\n\nTo connect to a Polyphony/Spacebar compatible server, you'll need to create an [`Instance`](https://docs.rs/chorus/latest/chorus/instance/struct.Instance.html) like this:\n\n```rust\nuse chorus::{instance::Instance, types::IntoShared};\n\n#[tokio::main]\nasync fn main() {\n\n    // This instance will later need to be shared across threads and users, so we'll\n    // store it inside of the `Shared` type (note the `into_shared()` method call)\n    let instance = Instance::new(\"https://example.com\", None)\n        .await\n        .expect(\"Failed to connect to the Spacebar server\")\n\t\t  .into_shared();\n\n    // You can create as many instances of `Instance` as you want, but each `Instance` should likely be unique.\n\n    // Each time we want to access the underlying `Instance` we need to lock\n    // its reference so other threads don't modify the data while we're reading or changing it\n    let instance_lock = instance.read().unwrap();\n\n    dbg!(\u0026instance_lock.instance_info);\n    dbg!(\u0026instance_lock.limits_information);\n}\n```\n\nThis Instance can now be used to log in, register and from there on, interact with the server in all sorts of ways.\n\n### Logging In\n\nLogging in correctly provides you with an instance of `ChorusUser`, with which you can interact with the server and\nmanipulate the account. Assuming you already have an account on the server, you can log in like this:\n\n```rust\nuse chorus::types::LoginSchema;\n// Assume, you already have an account created on this instance. Registering an account works\n// the same way, but you'd use the Register-specific Structs and methods instead.\nlet login_schema = LoginSchema {\n    login: \"user@example.com\".to_string(),\n    password: \"Correct-Horse-Battery-Staple\".to_string(),\n    ..Default::default()\n};\n// Each user connects to the Gateway. Each users' Gateway connection lives on a separate thread. Depending on\n// the runtime feature you choose, this can potentially take advantage of all of your computers' threads.\n//\n// Note that we clone the reference to the instance here, not the instance itself\n// (we do this because each user needs its own access to the instance's data)\nlet user = Instance::login_account(instance.clone(), login_schema)\n    .await\n    .expect(\"An error occurred during the login process\");\ndbg!(user.belongs_to);\ndbg!(\u0026user.object.read().unwrap().username);\n```\n\n## Supported Platforms\n\nAll major desktop operating systems (Windows, macOS (aarch64/x86_64), Linux (aarch64/x86_64)) are supported.\n`wasm32-unknown-unknown` is a supported compilation target on versions `0.12.0` and up. This allows you to use\nChorus in your browser, or in any other environment that supports WebAssembly.\n\nTo compile for `wasm32-unknown-unknown`, execute the following command:\n\n```sh\ncargo build --target=wasm32-unknown-unknown --no-default-features\n```\n\nThe following features are supported on `wasm32-unknown-unknown`:\n\n| Feature           | WASM Support |\n| ----------------- | ------------ |\n| `client`          | ✅            |\n| `rt`              | ✅            |\n| `rt-multi-thread` | ❌            |\n| `backend`         | ❌            |\n| `voice`           | ❌            |\n| `voice_udp`       | ❌            |\n| `voice_gateway`   | ✅            |\n\nWe recommend checking out the \"examples\" directory, as well as the documentation for more information.\n\n## MSRV (Minimum Supported Rust Version)\n\nRust **1.81.0**. This number might change at any point while Chorus is not yet at version 1.0.0.\n\n## Development Setup\n\nMake sure that you have at least Rust 1.81.0 installed. You can check your Rust version by running `cargo --version`\nin your terminal. To compile for `wasm32-unknown-unknown`, you need to install the `wasm32-unknown-unknown` target.\nYou can do this by running `rustup target add wasm32-unknown-unknown`.\n\n### Testing\n\nIn general, the tests will require you to run a local instance of the Spacebar server. You can find instructions on how\nto do that [here](https://docs.spacebar.chat/setup/server/). You can find a pre-configured version of the server\n[here](https://github.com/bitfl0wer/server). It is recommended to use the pre-configured version, as certain things\nlike \"proxy connection checking\" are already disabled on this version, which otherwise might break tests.\n\n### wasm\n\nTo test for wasm, you will need to `cargo install wasm-pack`. You can then run\n`wasm-pack test --\u003cchrome/firefox/safari\u003e --headless -- --target wasm32-unknown-unknown --features=\"rt, client, voice_gateway\" --no-default-features`\nto run the tests for wasm.\n\n## Versioning\n\nLike other cargo crates, this crate uses Semantic Versioning 2.0.0 as its versioning scheme.\nYou can read the specification [here](https://semver.org/spec/v2.0.0.html).\n\nCode gated behind the `backend` feature is not considered part of the public API and can change without\naffecting semver compatibility. The `backend` feature is explicitly meant for use in [`symfonia`](https://github.com/polyphony-chat/symfonia)\n\n## Contributing\n\nSee [CONTRIBUTING.md](./CONTRIBUTING.md).\n\n[Rust]: https://img.shields.io/badge/Rust-orange?style=plastic\u0026logo=rust\n[Rust-url]: https://www.rust-lang.org/\n[build-shield]: https://img.shields.io/github/actions/workflow/status/polyphony-chat/chorus/build-test-coverage.yml?style=flat\n[build-url]: https://github.com/polyphony-chat/chorus/blob/main/.github/workflows/build-test-coverage.yml\n[clippy-shield]: https://img.shields.io/github/actions/workflow/status/polyphony-chat/chorus/clippy.yml?style=flat\n[clippy-url]: https://github.com/polyphony-chat/chorus/blob/main/.github/workflows/clippy.yml\n[contributors-shield]: https://img.shields.io/github/contributors/polyphony-chat/chorus.svg?style=flat\n[contributors-url]: https://github.com/polyphony-chat/chorus/graphs/contributors\n[coverage-shield]: https://coveralls.io/repos/github/polyphony-chat/chorus/badge.svg?branch=main\n[coverage-url]: https://coveralls.io/github/polyphony-chat/chorus?branch=main\n[forks-shield]: https://img.shields.io/github/forks/polyphony-chat/chorus.svg?style=flat\n[forks-url]: https://github.com/polyphony-chat/chorus/network/members\n[stars-shield]: https://img.shields.io/github/stars/polyphony-chat/chorus.svg?style=flat\n[stars-url]: https://github.com/polyphony-chat/chorus/stargazers\n[issues-shield]: https://img.shields.io/github/issues/polyphony-chat/chorus.svg?style=flat\n[issues-url]: https://github.com/polyphony-chat/chorus/issues\n[license-shield]: https://img.shields.io/github/license/polyphony-chat/chorus.svg?style=f;at\n[license-url]: https://github.com/polyphony-chat/chorus/blob/master/LICENSE\n[Discord]: https://dcbadge.limes.pink/api/server/m3FpcapGDD?style=flat\n[Discord-invite]: https://discord.com/invite/m3FpcapGDD\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolyphony-chat%2Fchorus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolyphony-chat%2Fchorus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolyphony-chat%2Fchorus/lists"}