{"id":26313372,"url":"https://github.com/arijitcodes/microstream-hub","last_synced_at":"2026-02-21T11:02:11.369Z","repository":{"id":279865220,"uuid":"940183085","full_name":"arijitcodes/microstream-hub","owner":"arijitcodes","description":"The central hub for MicroStream, a lightweight, real-time communication system for microservices. Routes messages between services, handles service discovery, and ensures seamless communication with WebSockets. Perfect for building scalable, event-driven architectures.","archived":false,"fork":false,"pushed_at":"2025-03-27T12:18:47.000Z","size":688,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-13T01:38:04.058Z","etag":null,"topics":["ipc","message-broker","microservices","microstream","microstream-hub","nodejs","real-time","service-discovery","service-mesh","service-registry","socket-io","typescript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/arijitcodes.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"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}},"created_at":"2025-02-27T18:43:32.000Z","updated_at":"2025-03-27T12:18:51.000Z","dependencies_parsed_at":"2025-02-28T06:36:31.642Z","dependency_job_id":"9cdb19d4-53c8-423b-accf-0f4cc0a59221","html_url":"https://github.com/arijitcodes/microstream-hub","commit_stats":null,"previous_names":["arijitcodes/microstream-hub"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/arijitcodes/microstream-hub","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arijitcodes%2Fmicrostream-hub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arijitcodes%2Fmicrostream-hub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arijitcodes%2Fmicrostream-hub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arijitcodes%2Fmicrostream-hub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arijitcodes","download_url":"https://codeload.github.com/arijitcodes/microstream-hub/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arijitcodes%2Fmicrostream-hub/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29679049,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T09:33:50.764Z","status":"ssl_error","status_checked_at":"2026-02-21T09:33:19.949Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["ipc","message-broker","microservices","microstream","microstream-hub","nodejs","real-time","service-discovery","service-mesh","service-registry","socket-io","typescript"],"created_at":"2025-03-15T11:15:13.562Z","updated_at":"2026-02-21T11:02:11.339Z","avatar_url":"https://github.com/arijitcodes.png","language":"JavaScript","readme":"# MicroStream Hub 🏢\n\n\u003cdiv align=\"center\"\u003e\n   \u003cimg src=\"https://iamarijit.dev/img/projects/MicroStream-Icon.png\" height=\"350\"/\u003e\n\u003c/div\u003e\n\nThe central hub for Microstream, a lightweight, real-time communication system for microservices. Routes messages between services, handles service discovery, and ensures seamless communication with WebSockets. Perfect for building scalable, event-driven architectures.\n\nAuthor: [Arijit Banerjee](#author)  \nLicense: [MIT](./LICENSE)\n\n\u003c!-- shields.io Badges --\u003e\n\n\u003c!-- Websites / Links - Up / Down --\u003e\n\n[![GitHub Repository Link](https://img.shields.io/website?url=https%3A%2F%2Fgithub.com%2Farijitcodes%2Fmicrostream-hub\u0026style=for-the-badge\u0026logo=github\u0026label=repository\u0026labelColor=%23232323)](https://github.com/arijitcodes/microstream-hub) \u0026nbsp;\u0026nbsp;\n\n\u003c!-- GitHub Badges --\u003e\n\n[![GitHub License](https://img.shields.io/github/license/arijitcodes/microstream-hub?style=for-the-badge\u0026logo=github\u0026labelColor=232323\u0026color=404040)](https://github.com/arijitcodes/microstream-hub/blob/main/LICENSE) \u0026nbsp;\n[![GitHub language count](https://img.shields.io/github/languages/count/arijitcodes/microstream-hub?style=for-the-badge\u0026logo=github\u0026labelColor=%23232323\u0026color=%23404040)](https://github.com/arijitcodes/microstream-hub) \u0026nbsp;\n[![GitHub top language](https://img.shields.io/github/languages/top/arijitcodes/microstream-hub?style=for-the-badge\u0026logo=github\u0026labelColor=%23232323)](https://github.com/arijitcodes/microstream-hub) \u0026nbsp;\n[![GitHub last commit (branch)](https://img.shields.io/github/last-commit/arijitcodes/microstream-hub/main?style=for-the-badge\u0026logo=github\u0026labelColor=%23232323)](https://github.com/arijitcodes/microstream-hub/commits/main) \u0026nbsp;\n\n[![GitHub contributors](https://img.shields.io/github/contributors/arijitcodes/microstream-hub?style=for-the-badge\u0026logo=github\u0026labelColor=232323\u0026color=404040)](https://github.com/arijitcodes/microstream-hub/graphs/contributors) \u0026nbsp;\n[![GitHub pull requests](https://img.shields.io/github/issues-pr/arijitcodes/microstream-hub?style=for-the-badge\u0026logo=github\u0026labelColor=232323\u0026color=404040)](https://github.com/arijitcodes/microstream-hub/pulls) \u0026nbsp;\n[![GitHub issues](https://img.shields.io/github/issues/arijitcodes/microstream-hub?style=for-the-badge\u0026logo=github\u0026labelColor=232323\u0026color=404040)](https://github.com/arijitcodes/microstream-hub/issues) \u0026nbsp;\n[![GitHub repo size](https://img.shields.io/github/repo-size/arijitcodes/microstream-hub?style=for-the-badge\u0026logo=github\u0026labelColor=232323\u0026color=404040)](https://github.com/arijitcodes/microstream-hub) \u0026nbsp;\n[![GitHub code size](https://img.shields.io/github/languages/code-size/arijitcodes/microstream-hub?style=for-the-badge\u0026logo=github\u0026labelColor=232323\u0026color=404040)](https://github.com/arijitcodes/microstream-hub) \u0026nbsp;\n\n\u003c!-- Others --\u003e\n\n[![Semantic-Release Badge](https://img.shields.io/badge/semantic--release-e10079?style=for-the-badge\u0026logo=semantic-release\u0026labelColor=%23232323)](https://github.com/semantic-release/semantic-release) \u0026nbsp;\n[![Commitizen Friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen?style=for-the-badge\u0026labelColor=%23232323\u0026color=brightGreen)](https://commitizen.github.io/cz-cli/) \u0026nbsp;\n[![Conventional Commits Badge](https://img.shields.io/badge/conventional_commits-404040?style=for-the-badge\u0026logo=conventionalcommits\u0026labelColor=%23232323\u0026color=%23404040)](https://www.conventionalcommits.org) \u0026nbsp;\n\n\u003chr\u003e\n\n## Table of Contents 📚\n\n- [Features ✨](#features-)\n- [How Does It Work? 🌟](#how-does-it-work-)\n- [Deployment 🚀](#deployment-)\n- [Client SDK 🚀](#client-sdk-)\n- [Author 👨‍💻](#author-)\n- [Contributing 🤝](#contributing-)\n- [License 📜](#license-)\n\n\u003chr\u003e\n\n## Features ✨\n\n- 🏢 Central WebSocket server for real-time communication between microservices.\n- 🔗 Service discovery and registration.\n- 📡 Request routing and response handling.\n- ❤️ Heartbeat mechanism to detect and remove inactive services.\n- 📊 Configurable logging for better observability.\n- 🔄 Real-time inter-service communication using WebSockets.\n- ⚡ Synchronous request-response pattern without HTTP overhead.\n- 🔍 Auto-discovery and connection management.\n\n\u003chr\u003e\n\n## How Does It Work? 🌟\n\n**MicroStream** simplifies communication between microservices using a **centralized hub-and-spoke architecture**, also known as a **star network**. In this model, the **[MicroStream Hub](https://github.com/arijitcodes/microstream-hub)** acts as the central communication point, and your microservices, equipped with the **[MicroStream Client](https://github.com/arijitcodes/microstream-client)**, connect to the Hub and communicate through it.\n\nHere's how it works:\n\n### 🌟 The Star Network Concept\n\nImagine a star:\n\n- The **center of the star** is the **[MicroStream Hub](https://github.com/arijitcodes/microstream-hub)**.\n- The **points of the star** are your **microservices** (each equipped with the **[MicroStream Client](https://github.com/arijitcodes/microstream-client)**).\n\n![MicroStream Star Network Diagram](https://mermaid.ink/svg/eyJjb2RlIjoiZ3JhcGggVERcbiAgICBIdWJbTWljcm9TdHJlYW0gSHViXSAtLT4gU2VydmljZTFbU2VydmljZSAxXVxuICAgIEh1YiAtLT4gU2VydmljZTJbU2VydmljZSAyXVxuICAgIEh1YiAtLT4gU2VydmljZTNbU2VydmljZSAzXVxuICAgIEh1YiAtLT4gU2VydmljZTRbU2VydmljZSA0XVxuICAgIEh1YiAtLT4gU2VydmljZTVbU2VydmljZSA1XVxuIiwibWVybWFpZCI6eyJ0aGVtZSI6ImRlZmF1bHQiLCJsaW5lV2lkdGgiOiIzIn19)\n\nIn this setup:\n\n- The **Hub** acts as the central communication point.\n- **Services** (nodes) connect to the Hub and communicate through it, **not directly with each other**.\n\n### 🚀 How It Works in Practice\n\n1. **Service Registration**:\n\n   - Each microservice connects to the Hub using the **[MicroStream Client](https://github.com/arijitcodes/microstream-client)**.\n   - The **[Hub](https://github.com/arijitcodes/microstream-hub)** automatically detects and registers the service.\n\n2. **Request-Response Communication in Real-Time**:\n\n   - When **Service A** needs to talk to **Service B**, it sends a request to the **[Hub](https://github.com/arijitcodes/microstream-hub)**.\n   - The **[Hub](https://github.com/arijitcodes/microstream-hub)** routes the request to **Service B**.\n   - **Service B** processes the request and sends a response back through the **[Hub](https://github.com/arijitcodes/microstream-hub)**.\n   - All communication happens in **real-time** over WebSockets, ensuring fast and reliable data exchange.\n\n3. **Auto-Discovery**:\n\n   - Once connected, the **[Hub](https://github.com/arijitcodes/microstream-hub)** keeps track of all connected services, so you don’t need to manually configure connections between services. However, you still need to specify the target service and method when sending a request.\n\n4. **Heartbeat Mechanism**:\n   - Services send regular \"heartbeats\" to the **[Hub](https://github.com/arijitcodes/microstream-hub)** to confirm they’re active.\n   - If a service stops sending heartbeats, the **[Hub](https://github.com/arijitcodes/microstream-hub)** removes it from the network.\n\n### ✨ Why Choose MicroStream?\n\n**MicroStream** is designed to make microservice communication **simple**, **efficient**, and **scalable**. Here’s why you’ll love it:\n\n- **Easy Setup**: Minimal configuration required to get started.\n- **Real-Time Request-Response Communication**: Built on WebSockets for instant, reliable data exchange.\n- **Auto-Service-Management**: Once connected, the **[Hub](https://github.com/arijitcodes/microstream-hub)** keeps track of all services, simplifying network management.\n- **Scalable**: Easily add more services without reconfiguring the network.\n- **Lightweight**: Minimal overhead compared to traditional REST or gRPC.\n- **Flexible**: Works seamlessly with any microservice architecture.\n\n\u003chr\u003e\n\n## Deployment 🚀\n\n### Running via Docker 🐳\n\n```bash\ndocker compose up --build\n```\n\nTo change the port in Docker Compose, you can set the `PORT` environment variable in the `docker-compose.yml` file:\n\n```yaml\nversion: \"3.8\"\nservices:\n  microstream-hub:\n    build: .\n    ports:\n      - \"${PORT:-3000}:3000\"\n    environment:\n      - PORT=3000\n    restart: unless-stopped\n```\n\n### Running Locally 🏃‍♂️\n\n#### Installation 🛠️\n\n```bash\nnpm install\n```\n\n#### Running the Hub\n\n```bash\nnode src/hub.js\n```\n\n#### Configuration Example\n\nTo change the port, you can set the `PORT` environment variable:\n\n```bash\nPORT=4000 node src/hub.js\n```\n\n\u003chr\u003e\n\n## Client SDK 🚀\n\nWe provide a client SDK for easy integration with the MicroStream Hub.\n\n- [MicroStream Client SDK on npm](https://www.npmjs.com/package/microstream-client)\n- [MicroStream Client SDK Repository](https://github.com/arijitcodes/microstream-client)\n\n\u003chr\u003e\n\n## Author 👨‍💻\n\nAuthor: [Arijit Banerjee](https://www.github.com/arijitcodes)\n\nAbout: Full Stack Web Developer | Cyber Security Enthusiast | Actor\n\nSocial Media: \u0026nbsp;\n[![Instagram](https://i.ibb.co/4t76vTc/insta-transparent-14px.png) Instagram](https://www.instagram.com/arijit.codes)\n\u0026nbsp;\n[![Linkedin](https://i.stack.imgur.com/gVE0j.png) LinkedIn](https://www.linkedin.com/in/arijitban)\n\u0026nbsp;\n[![GitHub](https://i.stack.imgur.com/tskMh.png) GitHub](https://github.com/arijitcodes)\n\u0026nbsp;\n[![Website](https://i.ibb.co/wCV57xR/Internet-1.png) Website](https://iamarijit.dev)\n\nEmail: arijit.codes@gmail.com\n\n\u003chr\u003e\n\n## Contributing 🤝\n\nWe welcome contributions! Please see our [CONTRIBUTING.md](./CONTRIBUTING.md) for guidelines on how to contribute to this project.\n\n\u003chr\u003e\n\n## License 📜\n\nThis project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.\n\n\u003chr\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farijitcodes%2Fmicrostream-hub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farijitcodes%2Fmicrostream-hub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farijitcodes%2Fmicrostream-hub/lists"}