{"id":43925128,"url":"https://github.com/cmd-stream/cmd-stream-go","last_synced_at":"2026-05-05T03:06:48.886Z","repository":{"id":185101029,"uuid":"673003994","full_name":"cmd-stream/cmd-stream-go","owner":"cmd-stream","description":"High-performance Distributed Command Pattern (DCP) library for Go","archived":false,"fork":false,"pushed_at":"2026-04-29T21:39:52.000Z","size":360,"stargazers_count":88,"open_issues_count":0,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2026-04-29T23:31:05.086Z","etag":null,"topics":["command-pattern","dcp","distributed-command-pattern","distributed-systems","golang","high-performance","networking"],"latest_commit_sha":null,"homepage":"","language":"Go","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/cmd-stream.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"ko_fi":"ymzncnk"}},"created_at":"2023-07-31T16:41:58.000Z","updated_at":"2026-04-29T21:39:56.000Z","dependencies_parsed_at":"2023-07-31T18:20:28.095Z","dependency_job_id":"0b228102-ae5b-40dc-81ce-6f5fdb317ccb","html_url":"https://github.com/cmd-stream/cmd-stream-go","commit_stats":null,"previous_names":["cmd-stream/cmd-stream-go"],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/cmd-stream/cmd-stream-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmd-stream%2Fcmd-stream-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmd-stream%2Fcmd-stream-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmd-stream%2Fcmd-stream-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmd-stream%2Fcmd-stream-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cmd-stream","download_url":"https://codeload.github.com/cmd-stream/cmd-stream-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmd-stream%2Fcmd-stream-go/sbom","scorecard":{"id":294054,"data":{"date":"2025-08-11","repo":{"name":"github.com/cmd-stream/cmd-stream-go","commit":"3280be2b081148918e62631d9ac11f9e3b9895e6"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.3,"checks":[{"name":"Maintained","score":10,"reason":"26 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T19:01:02.152Z","repository_id":185101029,"created_at":"2025-08-17T19:01:02.152Z","updated_at":"2025-08-17T19:01:02.152Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32633446,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-04T10:08:07.713Z","status":"online","status_checked_at":"2026-05-05T02:00:06.033Z","response_time":54,"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":["command-pattern","dcp","distributed-command-pattern","distributed-systems","golang","high-performance","networking"],"created_at":"2026-02-06T23:05:10.309Z","updated_at":"2026-05-05T03:06:48.880Z","avatar_url":"https://github.com/cmd-stream.png","language":"Go","funding_links":["https://ko-fi.com/ymzncnk"],"categories":["Distributed Systems"],"sub_categories":["Search and Analytic Databases"],"readme":"# cmd-stream: High-Performance Distributed Command Pattern (DCP) for Go\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/cmd-stream/cmd-stream-go.svg)](https://pkg.go.dev/github.com/cmd-stream/cmd-stream-go)\n[![GoReportCard](https://goreportcard.com/badge/cmd-stream/cmd-stream-go)](https://goreportcard.com/report/github.com/cmd-stream/cmd-stream-go)\n[![codecov](https://codecov.io/gh/cmd-stream/cmd-stream-go/graph/badge.svg?token=RXPJ6ZIPK7)](https://codecov.io/gh/cmd-stream/cmd-stream-go)\n[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/12510/badge)](https://www.bestpractices.dev/projects/12510)\n[![Follow on X](https://img.shields.io/twitter/url?url=https%3A%2F%2Fx.com%2Fcmdstream_lib)](https://x.com/cmdstream_lib)\n\n**cmd-stream** is a high-performance networking library that implements the \nDistributed [Command Pattern](https://en.wikipedia.org/wiki/Command_pattern) (DCP) \nfor Go. Designed for low-latency communication over TCP/TLS, it provides a \nflexible, decoupled alternative to traditional RPC by treating requests as \nfirst-class Command objects.\n\nThe architecture is straightforward: a client sends Commands to the server, \nwhere an Invoker executes them, and a Receiver provides the actual server-side\nfunctionality.\n\n*Want to learn more about how the Command Pattern applies to network\ncommunication?  Check out [this series of posts](https://medium.com/p/f9e53442c85d)*.\n\n## Contents\n\n- [cmd-stream: High-Performance Distributed Command Pattern (DCP) for Go](#cmd-stream-high-performance-distributed-command-pattern-dcp-for-go)\n  - [Contents](#contents)\n  - [Why cmd-stream?](#why-cmd-stream)\n  - [Overview](#overview)\n  - [Benchmarks](#benchmarks)\n  - [Stress Testing](#stress-testing)\n  - [Installation](#installation)\n  - [How To](#how-to)\n    - [Quick Look](#quick-look)\n    - [Additional Resources](#additional-resources)\n  - [Network Protocols Support](#network-protocols-support)\n  - [High-performance Communication Channel](#high-performance-communication-channel)\n  - [cmd-stream and RPC](#cmd-stream-and-rpc)\n  - [Architecture](#architecture)\n  - [Contributing \\\u0026 Security](#contributing--security)\n  - [Version Compatibility](#version-compatibility)\n\n## Why cmd-stream?\n\nIt delivers high-performance and resource efficiency by multiplexing asynchronous\nrequests over long-lived connections, minimizing network overhead. This helps\nreduce infrastructure costs and scale more effectively.\n\n## Overview\n\n- Works over TCP, TLS or mutual TLS.\n- Has an asynchronous client that uses only one connection for both sending\n  Commands and receiving Results.\n- Supports server streaming, i.e. a Command can send back multiple Results.\n- Provides reconnect and keepalive features.\n- Supports the Circuit Breaker pattern.\n- Has OpenTelemetry integration.\n- Can work with various serialization formats.\n- Follows a modular design.\n\n## Benchmarks\n\n![QPS Benchmark](https://github.com/ymz-ncnk/go-client-server-benchmarks/blob/main/results/qps/img/qps.png)\n\nSee [go-client-server-benchmarks](https://github.com/ymz-ncnk/go-client-server-benchmarks)\nfor detailed performance comparisons.\n\n## Stress Testing\n\nThe library has successfully passed a **12-hour continuous stress test**, ensuring \nstability under extreme conditions.\n\nFor more details on the testing methodology and results, see [stress-test-go](https://github.com/cmd-stream/stress-test-go).\n\n## Installation\n\nTo obtain the library, use: \n\n```bash\ngo get github.com/cmd-stream/cmd-stream-go\n```\n\n## How To\n\nGetting started is easy:\n\n1. Implement the Command Pattern.\n2. Use one of the codecs:\n   - [codec-json-go](https://github.com/cmd-stream/codec-json-go) - simple and\n   easy-to-use JSON codec (ideal for prototyping).\n   - [codec-protobuf-go](https://github.com/cmd-stream/codec-protobuf-go) -\n   Protobuf-based codec (requires code generation).\n   - [codec-mus-stream-go](https://github.com/cmd-stream/codec-mus-stream-go) -\n   high-performance MUS codec (requires code generation).\n\n**Tip:** Start with JSON for simplicity, and switch to MUS later for maximum\nperformance.\n\n### Quick Look\n\nHere's a minimal end-to-end example showing how Commands can be defined, sent,\nand executed over the network:\n\n```go\n// Calc handles arithmetic logic.\ntype Calc struct{}\n\nfunc (c Calc) Add(a, b int) int { return a + b }\nfunc (c Calc) Sub(a, b int) int { return a - b }\n\n// AddCmd executes addition via Calc.\ntype AddCmd struct{ A, B int }\n\nfunc (c AddCmd) Exec(ctx context.Context, calc Calc, proxy core.Proxy) error {\n  _, err := proxy.Send(CalcResult(calc.Add(c.A, c.B)))\n  return err\n}\n\n// SubCmd executes subtraction via Calc.\ntype SubCmd struct{ A, B int }\n\nfunc (c SubCmd) Exec(ctx context.Context, calc Calc, proxy core.Proxy) error {\n  _, err := proxy.Send(CalcResult(calc.Sub(c.A, c.B)))\n  return err\n}\n\n// CalcResult represents the Command output.\ntype CalcResult int\n\n// LastOne indicates if this is the final result for the Command.\nfunc (r CalcResult) LastOne() bool { return true }\n\nfunc main() {\n  // Imports and error handling omitted for brevity.\n\n  const addr = \"127.0.0.1:9000\"\n\n  // 1. Setup codecs with all supported Command and Result types.\n  reg := cdcjson.NewRegistry(\n    cdcjson.WithCmd[Calc, AddCmd](),\n    cdcjson.WithCmd[Calc, SubCmd](),\n    cdcjson.WithResult[Calc, CalcResult](),\n  )\n  serverCodec := cdcjson.NewServerCodecWith(reg)\n  clientCodec := cdcjson.NewClientCodecWith(reg)\n\n  // 2. Start server.\n  server, _ := cmdstream.NewServer(Calc{}, serverCodec)\n  go server.ListenAndServe(addr)\n  time.Sleep(100 * time.Millisecond)\n\n  // 3. Create sender.\n  sender, _ := cmdstream.NewSender(addr, clientCodec)\n\n  // 4. Send commands.\n  sum, _ := sender.Send(context.Background(), AddCmd{A: 2, B: 3})\n  fmt.Println(sum) // Output: 5\n\n  diff, _ := sender.Send(context.Background(), SubCmd{A: 8, B: 4})\n  fmt.Println(diff) // Output: 4\n}\n```\n\nSee the [calc_json example](https://github.com/cmd-stream/examples-go/tree/main/calc_json) for the full implementation.\n\n### Additional Resources\n\n- [Examples](https://github.com/cmd-stream/examples-go)\n- [Stress Testing Suite](https://github.com/cmd-stream/stress-test-go)\n- [OpenTelemetry Instrumentation](https://github.com/cmd-stream/otelcmd-stream-go)\n\n## Network Protocols Support\n\nBuilt on Go’s standard `net` package, `cmd-stream` supports\nconnection-oriented protocols, such as TCP, TLS, and mutual TLS (for client\nauthentication).\n\n## High-performance Communication Channel\n\nTo maximize performance between services:\n\n1. Use N parallel clients. More connections typically improve throughput, until a saturation point.\n2. Pre-establish all connections instead of opening them on-demand.\n3. Keep connections alive to avoid the overhead from reconnections.\n\nThese practices, implemented via the [Group](group/), can significantly\nenhance throughput and reduce latency between your services.\n\n## cmd-stream and RPC\n\nAlready using RPC? You can use `cmd-stream` as a faster transport layer. See\nthe [RPC example](https://github.com/cmd-stream/examples-go/tree/main/rpc).\n\n## Architecture\n\n`cmd-stream` is built on a layered architecture that ensures clear separation of \nconcerns while maintaining maximum performance:\n\n- [core](core/): The core client and server definitions.\n- [delegate](delegate/): All communication-related tasks and connection\n  initialization.\n- [handler](handler/): Server-side Command processing.\n- [transport](transport/): Delivery of Commands and Results over the network.\n- [sender](sender/): High-level sender implementation.\n- [testkit](testkit/): Data and foundations for integration tests.\n\n`cmd-stream` was designed in such a way that you can easily replace any part\nof it.\n\n## Contributing \u0026 Security\n\nWe welcome contributions of all kinds! Please see [CONTRIBUTING.md](CONTRIBUTING.md) \nfor details on how to get involved.\n\nIf you find a security vulnerability, please refer to \n[Security Policy](SECURITY.md) for instructions on how to report it privately.\n\nFor bugs, feedback, or feature requests, please open an issue!\n\n## Version Compatibility\n\nFor a complete list of compatible module versions, see [VERSIONS.md](VERSIONS.md).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmd-stream%2Fcmd-stream-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcmd-stream%2Fcmd-stream-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmd-stream%2Fcmd-stream-go/lists"}