{"id":30105078,"url":"https://github.com/lexzaiello/melon","last_synced_at":"2026-05-18T03:34:36.853Z","repository":{"id":112455988,"uuid":"205951968","full_name":"lexzaiello/melon","owner":"lexzaiello","description":":watermelon: A modular peer-to-peer communications library for Java with minimal overhead.","archived":false,"fork":false,"pushed_at":"2020-10-13T15:45:01.000Z","size":120,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-24T16:02:54.854Z","etag":null,"topics":["decentralized","framework","java","maven","networking","p2p","p2p-library"],"latest_commit_sha":null,"homepage":"","language":"Java","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/lexzaiello.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-02T23:37:36.000Z","updated_at":"2024-01-26T18:16:11.000Z","dependencies_parsed_at":"2023-05-15T04:30:42.308Z","dependency_job_id":null,"html_url":"https://github.com/lexzaiello/melon","commit_stats":null,"previous_names":["lexzaiello/melon","dowlandaiello/melon"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lexzaiello/melon","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lexzaiello%2Fmelon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lexzaiello%2Fmelon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lexzaiello%2Fmelon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lexzaiello%2Fmelon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lexzaiello","download_url":"https://codeload.github.com/lexzaiello/melon/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lexzaiello%2Fmelon/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33163765,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T22:39:12.733Z","status":"online","status_checked_at":"2026-05-18T02:00:06.436Z","response_time":71,"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":["decentralized","framework","java","maven","networking","p2p","p2p-library"],"created_at":"2025-08-09T23:45:00.129Z","updated_at":"2026-05-18T03:34:36.834Z","avatar_url":"https://github.com/lexzaiello.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# melon\n\n:watermelon: Modular peer-to-peer communications library for Java with minimal overhead.\n\n## Introduction\n\nMelon is a modular peer-to-peer communications library for Java. Melon provides\na flexible, dev-oriented API for networking in Java that can be dissected,\nreconfigured, and built upon to serve a user's needs.\n\n### Core Components of the Melon Framework\n\n* `Hosts`\n\n   The `Host` class is the furthest layer of abstraction that Melon provides.\n   Hosts serve as fully configured, assembled \"kits\" of individual building\n   blocks. By default, a host has a preconfigured configuration, but individual\n   properties of a host can be changed through options passed in to the `Host`\n   constructor.\n* `Transports`\n\n   The `Transport` interface represents any generic network transport.\n   As of yet, only a `Tcp` transport comes with Melon.\n* `Multi-Addresses`\n\n   A multiaddress is a way of representing the address, port, and id of a\n   specific peer. In Melon, multiaddresses are the main method of communicating\n   internet addresses.\n   \n   Multiaddresses are usually contain the ip protocol, ip address, transport\n   protocol, port, and public key of a peer encoded via hexadecimal. For example:\n   \n   `/ip4/108.41.124.60/tcp/3000/Qmcpo2iLBikrdf1d6QU6vXuNb6P7hwrbNPW9kLAH8eG67z`\n* `Peerstores`\n    \n   A `Peerstore` is the main method of \"caching\" connections to known peers in\n   Melon. Once a connection to a peer is established, it is saved in the\n   `Peerstore.`\n* `Pubsub`\n\n   Pubsub is a method of message propagation in distributed networks. Melon\n   implements this functionality through the `SubscriptionManager` class.\n   An instance of this class is included, by default, in all `Hosts`.\n* `Upgrades`\n\n    `Upgrades` come in many different forms. The most common kind, transport\n    upgrades, can add support for all kinds of features to a given transport,\n    simply by calling `.withUpgrade()`. The `Secio` upgrade, for example,\n    implements communications encryption for any `Transport`.\n* `Options`\n\n    When a `Host` is initialized, a user might want to, for example, use a\n    custom transport for communications. This can be achieved through the use\n    of the `TransportOption`.\n\n## Getting Started\n\nTo start using the Melon framework in your Java application, add Melon as a\ndependency in your `Pom.xml` file:\n\n```xml\n\u003c!-- Melon P2P --\u003e\n\u003cdependency\u003e\n  \u003cgroupId\u003emelon\u003c/groupId\u003e\n  \u003cartifactId\u003emelon\u003c/artifactId\u003e\n  \u003cversion\u003e1.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nThen, feel free to use the standard Melon `Host`, or construct your own using\nany of the predefined `Options` (or make your own)!\n\n### Making a New Host\n\n```java\nimport com.dowlandaiello.melon.host.Host;\n\nclass MelonExample {\n    public myMethod() {\n        Host host = new Host(); // Use the default host options\n    }\n}\n```\n\n### Initializing a new Host with Options\n\n```java\nimport com.dowlandaiello.melon.host.Host;\nimport com.dowlandaiello.melon.host.Host.TransportOption;\nimport com.dowlandaiello.melon.transport.Tcp;\n\nclass MelonExample {\n    public myMethod() {\n        Host host = new Host(new TransportOption(new Tcp())); // Initialize a new host with the TCP transport option\n    }\n}\n```\n\n### Starting an Initialized Host\n\n```java\nimport com.dowlandaiello.melon.host.Host;\n\nclass MelonExample {\n    public myMethod() {\n        Host host = new Host(); // Use the default host options\n        host.listen(3000); // Listen on port 3000\n    }\n}\n```\n\n### Connecting a Host to an Existing Network\n\n```java\nimport com.dowlandaiello.melon.host.Host;\n\nclass MelonExample {\n    public myMethod() {\n        Host host = new Host(); // Construct the default host\n        host.listen(3000); // Listen on port 3000\n        \n        host.peerstore.bootstrap(\"/ip4/...\", host.transport, host.keypair.getPublic()); // Bootstrap the peerstore from a particular peer\n    }\n}\n```\n\n### Publishing a Message\n\n```java\nimport com.dowlandaiello.melon.host.Host;\nimport com.dowlandaiello.melon.pubsub.Message;\n\nclass MelonExample {\n    public myMethod() {\n        Host host = new Host(); // Construct the default host\n        host.listen(3000); // Listen on port 3000\n        \n        host.peerstore.bootstrap(\"/ip4/...\", host.transport, host.keypair.getPublic()); // Bootstrap the peerstore from a particular peer\n        \n        host.pubsub.publish(new Message(\"some_topic\", new String(\"You've got mail!\"))); // Publish a message\n    }\n}\n```\n\n### Subscribing to a Topic\n\n```java\nimport com.dowlandaiello.melon.host.Host;\nimport com.dowlandaiello.melon.pubsub.Message;\n\nclass MelonExample {\n    public myMethod() {\n        Host host = new Host(); // Construct the default host\n        host.listen(3000); // Listen on port 3000\n        \n        host.peerstore.bootstrap(\"/ip4/...\", host.transport, host.keypair.getPublic()); // Bootstrap the peerstore from a particular peer\n        \n        host.pubsub.subscribe(\"some_topic\", (Message message) -\u003e {\n            System.out.println((String) message.contents); // We've got mail!\n        }); // Subscribe to the some_topic topic\n    }\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flexzaiello%2Fmelon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flexzaiello%2Fmelon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flexzaiello%2Fmelon/lists"}