{"id":29082995,"url":"https://github.com/graphform/swim-rust","last_synced_at":"2025-07-29T14:17:01.518Z","repository":{"id":39800424,"uuid":"234373422","full_name":"graphform/swim-rust","owner":"graphform","description":"Self-contained distributed software platform for building stateful, massively real-time streaming applications in Rust.","archived":false,"fork":false,"pushed_at":"2025-06-20T22:17:17.000Z","size":26324,"stargazers_count":347,"open_issues_count":40,"forks_count":12,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-07-26T16:52:40.870Z","etag":null,"topics":["actor-model","async","data-integration","decentralized-applications","distributed-systems","framework","kafka","real-time","rust","serverless","stateful","stream-processing","streaming","streaming-data-pipelines","web"],"latest_commit_sha":null,"homepage":"https://www.swimos.org","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/graphform.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null}},"created_at":"2020-01-16T17:24:44.000Z","updated_at":"2025-07-17T00:59:38.000Z","dependencies_parsed_at":"2023-09-23T16:30:33.963Z","dependency_job_id":"9e148d5d-0f8a-471e-9cfa-87fcb2d0c382","html_url":"https://github.com/graphform/swim-rust","commit_stats":null,"previous_names":["graphform/swim-rust","swimos/swim-rust"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/graphform/swim-rust","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphform%2Fswim-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphform%2Fswim-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphform%2Fswim-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphform%2Fswim-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/graphform","download_url":"https://codeload.github.com/graphform/swim-rust/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphform%2Fswim-rust/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267701663,"owners_count":24130458,"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","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["actor-model","async","data-integration","decentralized-applications","distributed-systems","framework","kafka","real-time","rust","serverless","stateful","stream-processing","streaming","streaming-data-pipelines","web"],"created_at":"2025-06-27T21:01:22.820Z","updated_at":"2025-07-29T14:17:01.501Z","avatar_url":"https://github.com/graphform.png","language":"Rust","readme":"\u003ca href=\"https://www.swimos.org\"\u003e\u003cimg src=\"https://docs.swimos.org/readme/marlin-blue.svg\" align=\"left\"\u003e\u003c/a\u003e\n\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\n\nThe Swim Rust SDK contains software framework for building stateful applications that can be interacted\nwith via multiplexed streaming APIs. It is built on top of the [Tokio asynchronous runtime](https://tokio.rs/)\nand a Tokio runtime is required for any Swim application.\n\nEach application consists of some number of stateful agents, each of which runs as a separate Tokio task\nand can be individually addressed by a URI. An agent may have both public and private state which can either\nbe held solely in memory or, optionally, in persistent storage. The public state of the agent consists of a\nnumber of lanes, analogous to a field in a record. There are multiple kinds of lanes that, for example, lanes\ncontaining single values and those containing a map of key-value pairs.\n\nThe state of any lane can be observed by establishing a link to it (either from another agent instance or a\ndedicated client). A established link will push all updates to the state of that lane to the subscriber and\nwill also allow the subscriber to request changes to the state (for lane kinds that support this). Links\noperate over a web-socket connection and are multiplexed, meaning that links to multiple lanes on the same\nhost can share a single web-socket connection.\n\n[![SwimOS Crates.io Version][swimos-badge]][swimos-crate]\n[![SwimOS Client Crates.io Version][swimos-client-badge]][swimos-client-crate]\n[![SwimOS Form Crates.io Version][swimos-form-badge]][swimos-form-crate]\n\n[swimos-badge]: https://img.shields.io/crates/v/swimos?label=swimos\n\n[swimos-crate]: https://crates.io/crates/swimos\n\n[swimos-form-badge]: https://img.shields.io/crates/v/swimos?label=swimos_form\n\n[swimos-form-crate]: https://crates.io/crates/swimos_form\n\n[swimos-client-badge]: https://img.shields.io/crates/v/swimos?label=swimos_client\n\n[swimos-client-crate]: https://crates.io/crates/swimos_client\n\n[Website](https://swimos.org/) | [Developer Guide](https://www.swimos.org/server/rust/developer-guide/) | [Server API Docs](https://docs.rs/swimos/latest/swimos/) | [Client API Docs](https://docs.rs/swimos_client/latest/swimos_client/)\n\n## Usage Guides\n\n[Implementing Swim Agents in Rust](docs/agent.md)\n\n[Building a Swim Server Application](docs/server.md)\n\n[Reference Documentation](https://www.swimos.org/server/rust/)\n\n## Examples\n\nThe following example application runs a SwimOS server that hosts a single agent route where each agent instance\nhas single lane, called `lane`. Each time a changes is made to the lane, it will be printed on the console by the\nserver.\n\n```toml\n[dependencies]\nswimos = { version = \"0.1.1\", features = [\"server\", \"agent\"] }\n```\n\n```rust\nuse swimos::{\n    agent::{\n        agent_lifecycle::HandlerContext,\n        agent_model::AgentModel,\n        event_handler::{EventHandler, HandlerActionExt},\n        lanes::ValueLane,\n        lifecycle, AgentLaneModel,\n    },\n    route::RoutePattern,\n    server::{until_termination, Server, ServerBuilder},\n};\n\n#[tokio::main]\npub async fn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    // An agent route consists of the agent definition and a lifecycle.\n    let model = AgentModel::new(ExampleAgent::default, ExampleLifecycle.into_lifecycle());\n\n    let server = ServerBuilder::with_plane_name(\"Example Plane\")\n        .set_bind_addr(\"127.0.0.1:8080\".parse()?) // Bind the server to this address.\n        .add_route(RoutePattern::parse_str(\"/examples/{id}\")?, model) // Register the agent we have defined.\n        .build()\n        .await?;\n\n    // Run the server until we terminate it with Ctrl-C.\n    let (task, handle) = server.run();\n    let (ctrl_c_result, server_result) = tokio::join!(until_termination(handle, None), task);\n\n    ctrl_c_result?;\n    server_result?;\n    Ok(())\n}\n\n// Deriving the `AgentLaneModel` trait makes this type into an agent.\n#[derive(AgentLaneModel)]\nstruct ExampleAgent {\n    lane: ValueLane\u003ci32\u003e,\n}\n\n// Any agent type can have any number of lifecycles defined for it. A lifecycle describes\n// how the agent will react to events that occur as it executes.\n#[derive(Default, Clone, Copy)]\nstruct ExampleLifecycle;\n\n// The `lifecycle` macro creates an method called `into_lifecycle` for the type, using the\n// annotated event handlers methods in the block.\n#[lifecycle(ExampleAgent)]\nimpl ExampleLifecycle {\n    #[on_event(lane)]\n    fn lane_event(\n        \u0026self,\n        context: HandlerContext\u003cExampleAgent\u003e,\n        value: \u0026i32,\n    ) -\u003e impl EventHandler\u003cExampleAgent\u003e {\n        let n = *value;\n        context.get_agent_uri().and_then(move |uri| {\n            context.effect(move || {\n                println!(\"Received value: {} for 'lane' on agent at URI: {}.\", n, uri);\n            })\n        })\n    }\n}\n```\n\nFor example, if a Swim client sends an update, with the value `5`, to the agent at the URI `/examples/name` for the\nlane `lane`, an instance of `ExampleAgent`, using `ExampleLifecycle`, will be started by the server. The value of the\nlane will then be set to `5` and the following will be printed on the console:\n\n```\nReceived value: 5 for 'lane' on agent at URI: /examples/name.\n```\n\nA number of example applications are available in the [example_apps](example_apps) directory which demonstrate\nindividual features as well as more comprehensive applications.\n\n## Development\n\nSee the [development guide](DEVELOPMENT.md).\n\n## License\n\nThis project is licensed under the [Apache 2.0 License](LICENSE).\n","funding_links":[],"categories":["Libraries"],"sub_categories":["Data streaming"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphform%2Fswim-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraphform%2Fswim-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphform%2Fswim-rust/lists"}