{"id":27933607,"url":"https://github.com/eiselems/mdns-poc","last_synced_at":"2025-05-07T04:59:27.664Z","repository":{"id":289812915,"uuid":"972481165","full_name":"eiselems/mdns-poc","owner":"eiselems","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-25T15:28:01.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-07T04:59:24.542Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eiselems.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2025-04-25T06:37:34.000Z","updated_at":"2025-04-25T15:28:05.000Z","dependencies_parsed_at":"2025-04-25T07:33:20.235Z","dependency_job_id":"26fa5635-23ba-487c-b6f7-6de8b79e02de","html_url":"https://github.com/eiselems/mdns-poc","commit_stats":null,"previous_names":["eiselems/mdns-poc"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eiselems%2Fmdns-poc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eiselems%2Fmdns-poc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eiselems%2Fmdns-poc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eiselems%2Fmdns-poc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eiselems","download_url":"https://codeload.github.com/eiselems/mdns-poc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252816938,"owners_count":21808704,"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":"2025-05-07T04:59:27.084Z","updated_at":"2025-05-07T04:59:27.652Z","avatar_url":"https://github.com/eiselems.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mDNS Service Discovery Proof-of-Concept\n\nThis project demonstrates service discovery in a local network using multicast DNS (mDNS) technology. It consists of three components that work together to showcase how services can discover each other without centralized configuration.\n\n## Components\n\n### 1. Backend Service\n\nA simple Node.js server that:\n* Broadcasts itself as an mDNS service on the local network\n* Provides a basic API endpoint\n* Can be run multiple times on different ports to simulate multiple services\n\n### 2. BFF (Backend-For-Frontend) Service\n\nActs as a middleware that:\n* Discovers backend services via mDNS\n* Provides an API for the frontend to get the list of discovered services\n* Proxies requests from frontend to the appropriate backend service\n\n### 3. Frontend\n\nA simple HTML page that:\n* Polls the BFF for discovered backend services\n* Displays the list of available services\n* Allows testing API calls to each discovered service\n\n## Prerequisites\n\n* Node.js (v16+)\n* npm\n\n## Installation\n\n```bash\n# Clone the repository\ngit clone https://github.com/eiselems/mdns-poc.git\ncd mdns\n\n# Install dependencies\nnpm install\n```\n\n## Running the Application\n\n### Step 1: Start the BFF Service\n\n```bash\nnpm run start:bff\n```\n\nThis will start the BFF service on port 1337. The BFF will begin scanning for backend services.\n\n### Step 2: Start One or More Backend Services\n\nIn a new terminal:\n\n```bash\n# Start with default port (8080)\nnpm run start:backend\n\n# OR start with a custom port\nBACKEND_PORT=8081 npm run start:backend\n\n# Start additional backends in new terminals\nBACKEND_PORT=8082 npm run start:backend\n```\n\nEach backend will broadcast itself with a unique service name.\n\n### Step 3: Open the Frontend\n\nOpen `index.html` in your web browser. You'll see:\n\n1. A list of discovered backend services that updates every 5 seconds\n2. Buttons to test calling each backend's API\n\n## Testing Across Network Devices\n\nTo test service discovery across multiple devices on your local network:\n\n1. Make sure all devices are on the same network\n2. Start the BFF on one machine\n3. Start backends on multiple machines (or multiple on the same machine)\n4. Access the frontend from any device by pointing the browser to `http://\u003cBFF_HOST_IP\u003e:1337`\n\n\u003e **Note:** mDNS might be blocked by some corporate networks or firewalls.\n\n## How It Works\n\n1. **Backend Service**: Broadcasts its presence using mDNS with service type `_my-cool-app._tcp`\n2. **BFF Service**: Listens for services with the same type and maintains a registry\n3. **Frontend**: Polls the BFF's `/devices` endpoint and displays discovered services\n4. When you click \"Call Hello World\", the frontend sends a request to the BFF's `/proxy/{serviceName}/api/v1/hello-world` endpoint\n5. The BFF forwards the request to the appropriate backend and returns the response\n\n## Running on Different Network Setups\n\n* **Single Machine**: All components can run on the same machine for testing\n* **Local Network**: Backend services can run on multiple machines while the BFF aggregates them\n* **Across Networks**: Note that mDNS typically doesn't span across different subnets without some kind of relay or configuration\n\n\n---\n\nThis project is a proof-of-concept and not intended for production use.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feiselems%2Fmdns-poc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feiselems%2Fmdns-poc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feiselems%2Fmdns-poc/lists"}