{"id":15732295,"url":"https://github.com/stopsopa/dashboard-mediator","last_synced_at":"2025-06-28T13:36:32.670Z","repository":{"id":57163023,"uuid":"164177210","full_name":"stopsopa/dashboard-mediator","owner":"stopsopa","description":"...to have common point of communication between microservices","archived":false,"fork":false,"pushed_at":"2021-01-29T00:14:07.000Z","size":292,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T06:27:47.196Z","etag":null,"topics":[],"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/stopsopa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-05T03:12:38.000Z","updated_at":"2021-01-29T00:14:09.000Z","dependencies_parsed_at":"2022-09-01T03:21:13.924Z","dependency_job_id":null,"html_url":"https://github.com/stopsopa/dashboard-mediator","commit_stats":null,"previous_names":[],"tags_count":76,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stopsopa%2Fdashboard-mediator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stopsopa%2Fdashboard-mediator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stopsopa%2Fdashboard-mediator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stopsopa%2Fdashboard-mediator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stopsopa","download_url":"https://codeload.github.com/stopsopa/dashboard-mediator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246409778,"owners_count":20772547,"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":[],"created_at":"2024-10-04T00:08:53.090Z","updated_at":"2025-03-31T03:25:43.702Z","avatar_url":"https://github.com/stopsopa.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OBSOLITE\nFurther investigation of sockets in node made solution provided by this repository underpowered\n\n\n[![npm version](https://badge.fury.io/js/%40stopsopa%2Fmediator.svg)](https://www.npmjs.com/package/@stopsopa/mediator)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/stopsopa/dashboard-mediator/blob/master/LICENSE)\n\n\n## Table of Contents\n\n\u003c!-- toc --\u003e\n\n- [What's that?](#whats-that)\n- [Why?](#why)\n- [Deploy locally](#deploy-locally)\n- [Configuration of services](#configuration-of-services)\n- [To run local formation](#to-run-local-formation)\n  * [Main service (mediator service)](#main-service-mediator-service)\n  * [Passive service (just listening)](#passive-service-just-listening)\n  * [Active service (only sending to mediator directly and to listener)](#active-service-only-sending-to-mediator-directly-and-to-listener)\n  * [Standalone service (sending and listening)](#standalone-service-sending-and-listening)\n- [Using npm libraries to interact with mediator and attached services](#using-npm-libraries-to-interact-with-mediator-and-attached-services)\n- [Deploy in heroku](#deploy-in-heroku)\n- [Dev notes:](#dev-notes)\n\n\u003c!-- tocstop --\u003e\n\n# What's that?\n\nIt a server (let's call it \"mediator\" for the purpose of this doc) that is capable of registering multiple services (let's call them \"child nodes\") and later it can proxy incomming traffic between registered child nodes.  \n\nAs a part of this repository special libraries are provided to establish communication from child nodes in order to register such child node to mediator and establish connection with other child nodes. \n\nEach child node is registering to mediator under its own unique name, this name will be later used to refer particular child nodes in order to distinguish where traffic should be redirected after it reached mediator.\n\nThere is additional parameter that child node have to give during registration which is \"group name\". Groups are useful if dealing with multiple sets/formations/groups of many nodes, or example if there is need to broadcast message across multiple child nodes.\n\n# Why?\n\nThings get easier if in systems with multiple microservices (that have to communicate with each other) you have one common point of communication.   \n\nDue to this architecture in case if particular microservice have to be moved to different machine there is usually no need to reconfigure other microservices to properly communicate with moved service.\n    \n# Deploy locally\n\n    # git clone ...\n    # copy .env and SETUP EVERYTHING PROPERLY IN .env\n    cp .env.local .env\n    # run docker mysql \n    # WARNING: give mysql container little time to properly start (you can track state using \"docker ps\")\n    \n    make doc       \n    # fixtures\n    make fixtures\n    # run server\n    node index.js\n    # finish\n    \n# Configuration of services\n\nThere are two sets of passwords/keys: \n\nFirst is to encode body of each request this password have to be deployed to each children nodes but NOT to mediator main node. Mediator (main/parent) node doesn't have to know how to decrypt body of request it's responsibility is to just pass the request to another child node. By default it is **PROTECTED_AES256** that can be found in [example standalone service](standalone-node/.env)\n\nSecond key is used to authenticate incoming traffic from children nodes to mediator. In example code it is **PROTECTED_BASIC_AND_JWT** key.\n        \n# To run local formation\n\nIn order to create local formation of nodes, run accordingly:\n(each instruction in separate terminal)\n\n\n(**WARNING**: It's good idea to run mediator first because after that, all following client services will try to register itself to mediator, without this mediator won't be able to proxy traffic from one service to another)\n\n## Main service (mediator service)\n\n    make start\n    \n## Passive service (just listening)  \n\n    make client\n    \n## Active service (only sending to mediator directly and to listener)\n\n    make sender\n    \n## Standalone service (sending and listening)\n\n[This](standalone-node/server.js) standalone service is actually very good as an example how to configure any application to communicate with or through mediator service.\n\nJust remember about minimal [dependencies](standalone-node/package.json). \n\n    # go to other directory (beyound main repo) and run:\n    npx @stopsopa/mediator\n    # and follow instructio on the screen\n    \nAt the end just visit all services through browser and check what's available.\n\n# Using npm libraries to interact with mediator and attached services\n\n\n# Deploy in heroku\n\n    git clone git@github.com:stopsopa/dashboard-mediator.git dashboard-mediator/runtime\n    cd dashboard-mediator/runtime\n    \n    heroku login\n    \n    # check if\n    heroku config\n    # has correct CLEARDB_DATABASE_URL env variable \n    # can be set by: \n    #       heroku config:set CLEARDB_DATABASE_URL=\"mysql://username:password@us-cdbr-iron-east-01.cleardb.net/database_name?reconnect=true\"\n    # for more details see HOROKU.md   \n    \n    heroku create dashboard-mediator\n    \n    make u\n    \n# Dev notes:\n\nTo update project just change what's necessary and run:\n\n    make u  \n    \n... of course you have to be logged to npm (*npm login*)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstopsopa%2Fdashboard-mediator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstopsopa%2Fdashboard-mediator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstopsopa%2Fdashboard-mediator/lists"}