{"id":17949725,"url":"https://github.com/hadashia/vitalrouter","last_synced_at":"2025-04-14T20:54:59.353Z","repository":{"id":216026938,"uuid":"736128365","full_name":"hadashiA/VitalRouter","owner":"hadashiA","description":"The source-generator powered zero-allocation in-memory message passing library for Unity and .NET.","archived":false,"fork":false,"pushed_at":"2024-10-28T02:31:08.000Z","size":92198,"stargazers_count":236,"open_issues_count":6,"forks_count":15,"subscribers_count":8,"default_branch":"main","last_synced_at":"2024-10-29T10:06:00.415Z","etag":null,"topics":["dependency-injection","eventbus","mruby","pubsub","unity","unity3d"],"latest_commit_sha":null,"homepage":"","language":"C#","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/hadashiA.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":"hadashiA"}},"created_at":"2023-12-27T04:12:05.000Z","updated_at":"2024-10-28T04:29:54.000Z","dependencies_parsed_at":"2024-02-10T04:25:29.298Z","dependency_job_id":"02fd9e58-a243-48cc-84d4-982dbbfb780f","html_url":"https://github.com/hadashiA/VitalRouter","commit_stats":null,"previous_names":["hadashia/vitalrouter"],"tags_count":39,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hadashiA%2FVitalRouter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hadashiA%2FVitalRouter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hadashiA%2FVitalRouter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hadashiA%2FVitalRouter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hadashiA","download_url":"https://codeload.github.com/hadashiA/VitalRouter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248961112,"owners_count":21189991,"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":["dependency-injection","eventbus","mruby","pubsub","unity","unity3d"],"created_at":"2024-10-29T09:32:23.283Z","updated_at":"2025-04-14T20:54:59.314Z","avatar_url":"https://github.com/hadashiA.png","language":"C#","funding_links":["https://github.com/sponsors/hadashiA"],"categories":[],"sub_categories":[],"readme":"# VitalRouter\n\n[![GitHub license](https://img.shields.io/github/license/hadashiA/VitalRouter)](./LICENSE)\n![Unity 2022.2+](https://img.shields.io/badge/unity-2022.2+-000.svg)\n\nVitalRouter, is a source-generator powered zero-allocation fast in-memory messaging library for Unity and .NET.\n\nIt can declaratively do async handler/async middleware/sequence control, etc., and could serve as a thin framework to promote unidirectional control flow.\n\n```csharp\n[Routes]\n[Filter(typeof(Logging))]\n[Filter(typeof(ExceptionHandling))]\n[Filter(typeof(GameStateUpdating))]\npublic partial class ExamplePresenter\n{\n    // Declare event handler\n    [Route]\n    void On(FooCommand cmd)\n    {\n        // Do something ...\n    }\n\n    // Declare event handler (async)\n    [Route] \n    async UniTask On(BarCommand cmd)\n    {\n        // Do something for await ...\n    }\n    \n    // Declare event handler with extra filter\n    [Route]\n    [Filter(typeof(ExtraFilter))]\n    async UniTask On(BuzCommand cmd, CancellationToken cancellation = default)\n    {\n        // Do something after all filters runs on.\n    }\n       \n    // Declare event handler with specifies behavior when async handlers are executed concurrently\n    [Route(CommandOrdering.Sequential)]\n    async UniTask On(BuzCommand cmd, CancellationToken cancellation = default)\n    {\n        // Do something after all filters runs on.\n    }\n}\n```\n\nIn games, or complex GUI application development, patterns such as central event aggregator/message broker/mediator are powerful patterns to organize N:N relationships.\nAssembling an asynchronous function pipeline can be even more effective.\n\n### Features\n\n- Zero allocation message passing\n- Thread-safe\n- Pub/Sub, Fan-out\n- Async / Non-async handlers\n- Fast declarative routing pattern\n- Naive event handler pattern\n- Async interceptor pipelines\n    - Parallel, queueing, or other sequential control.\n- DI friendly. Also support without DI.\n- **Optional Extensions**\n    - UniTask support\n    - R3 integration\n    - MRuby scripting\n\n## Documentation\n\nVisit [vitalrouter.hadashikick.jp](https://vitalrouter.hadashikick.jp) to see the full documentation.\n\n## Installation\n\n### Unity\n\n- **Prerequirements:**\n    - Unity 2022.2+\n        - This limitation is due to the use of the Incremental Source Generator.\n- **Optional**\n    - Install UniTask \u003e= 2.5.5\n        - If [UniTask](https://github.com/Cysharp/UniTask) is installed, `VITALROUTER_UNITASK_INTEGRATION` flag is turned on and the optimized GC-free code is executed.\n        - See [UniTask Integration](../extensions/unitask) section for more details.\n    - Install VContainer \u003e= 1.15.1\n        - For bringing in DI style, VitalRouter supports Integration with VContainer, a fast and lightweight DI container for Unity.\n        - See [DI](../di/vcontainer) section for more details.\n\nThen, add git URL from Package Manager:\n\n```\nhttps://github.com/hadashiA/VitalRouter.git?path=/src/VitalRouter.Unity/Assets/VitalRouter#1.6.5\n```\n\n### .NET\n\nTHe following NuGet packages are available.\n\n| Package | Latest version |\n|:------------ |:----------- |\n| VitalRouter | [![NuGet](https://img.shields.io/nuget/v/VitalRouter)](https://www.nuget.org/packages/VitalRouter) | \n| VitalRouter.Extensions.DependencyInjection | [![NuGet](https://img.shields.io/nuget/v/VitalRouter.Extensions.DependencyInjection)](https://www.nuget.org/packages/VitalRouter.Extensions.DependencyInjection) | \n\n\u003e [!NOTE]\n\u003e For Unity, use of the above package is recommended instead of Nuget.\n\n\n## Async interceptor pipeline\n\nPipelining of async interceptors for published messages is possible. This is a general strong pattern for data exchange.\n\n\u003cimg src=\"./website/docs/assets/diagram_interceptors.svg\" alt=\"Interceptor Diagram\" width=\"50%\" /\u003e\n\n[Read more](https://vitalrouter.hadashikick.jp/pipeline/interceptor)\n\n## UniTask Integration\n\nUniTask is a fast async/await extension for Unity. VitalRouter actively supports UniTask.\n\n[Read more](https://vitalrouter.hadashikick.jp/extensions/unitask)\n\n## R3 Integration\n\nR3 is the next generation Reactive Extensions implementation in the C# world. It is an excellent alternative to asynchronous streams, but also an excellent alternative to local events.\n\nVitalRouter supports the ability to work with R3.\n\n[Read more](https://vitalrouter.hadashikick.jp/extensions/r3)\n\n## MRuby scripting?\n\nIt is very powerful if the publishing of commands can be controlled by external data.\n\nFor example, when implementing a game scenario, most of the time we do not implement everything in C# scripts. It is common to express large amounts of text data, branching, flag management, etc. in a simple scripting language or data format.\n\nVitalRouter offers an optional package for this purpose before integrating [mruby](https://github.com/mruby/mruby). ([blog](https://medium.com/@hadashiA/vitalrouter-mruby-generic-ruby-scripting-framework-for-unity-d1b2234a5c33) / [blog (Japanease)](https://hadashikick.land/tech/vitalrouter-mruby)\n\nFiber in mruby and async/await in C# are fully integrated.\n\n![MRuby and C# Diagram](./website/docs/assets/diagram_mruby.svg)\n\n[Read more](https://vitalrouter.hadashikick.jp/extensions/mruby)\n\n## LISENCE\n\nMIT\n\n## AUTHOR\n\n@hadashiA\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhadashia%2Fvitalrouter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhadashia%2Fvitalrouter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhadashia%2Fvitalrouter/lists"}