{"id":19178069,"url":"https://github.com/cmdruid/nostr-socket-workshop","last_synced_at":"2025-07-09T14:10:44.316Z","repository":{"id":179311848,"uuid":"663280468","full_name":"cmdruid/nostr-socket-workshop","owner":"cmdruid","description":"A developer workshop that teaches how to build on Nostr.","archived":false,"fork":false,"pushed_at":"2024-12-24T21:58:03.000Z","size":130,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-07T20:43:50.659Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/cmdruid.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":"2023-07-07T00:53:25.000Z","updated_at":"2024-12-24T21:58:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"a44234e3-f499-40e4-ac2e-3333e20998d6","html_url":"https://github.com/cmdruid/nostr-socket-workshop","commit_stats":null,"previous_names":["cmdruid/nostr-socket-workshop"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cmdruid/nostr-socket-workshop","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmdruid%2Fnostr-socket-workshop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmdruid%2Fnostr-socket-workshop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmdruid%2Fnostr-socket-workshop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmdruid%2Fnostr-socket-workshop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cmdruid","download_url":"https://codeload.github.com/cmdruid/nostr-socket-workshop/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmdruid%2Fnostr-socket-workshop/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264473897,"owners_count":23613961,"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-11-09T10:36:52.524Z","updated_at":"2025-07-09T14:10:44.298Z","avatar_url":"https://github.com/cmdruid.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NostrSocket Workshop\n\nThis workshop is an introduction to development using the nostr protocol.\n\nWe will be building an example project called `NostrSocket`, which communicates using a virtual socket over the nostr network.\n\n**UPDATE 01/21/24:**  \n\nThere have been a number of significant changes to the `nostr-tools` library. I have decided to freeze the versions of the packages in this repository, so that the code examples will continue to work into the future. If you run into any problems, please feel free to submit an issue ticket. Thank you!\n\n## Overview\n\nThis demo project is broken down into 4 parts:\n\n### Part 0: The Boilerplate\n\nIn this section, we cover setting up the project from scratch, plus review the boilerplate code that we are starting with.\n\n * Git clone repo.\n * Make sure node is up-to-date (v19).\n * Install all dependencies.\n * Review boilerplate code.\n\n### Part 1: Subscribe to Events\n\nIn this section, we demonstrate how to connect to a relay and request events using the `nostr-tools` library.\n\n * Connecting to a relay pool.\n * Subscribe and listen to events.\n * Log the responses to console.\n\n### Part 2: Sign and Publish Events\n\nIn this section, we will publish our own notes to a relay. We'll also cover the use of hashing, digital signatures, and signing devices.\n * Craft a note for publishing.\n * Sign and publish notes to the pool.\n * Parse and validate the response.\n\n### Part 3: Create an Encrypted Channel\n\nIn this section, we will add encryption to our messages, and cover how to tag and filter those messages.\n\n * Setup our `encrypt` and `decrypt` methods. \n * Adjust filter to subscribe to tagged events.\n * Adjust publisher to encrypt and tag events.\n * Adjust handler to decrypt the tagged responses.\n\n### Part 4: Add an EventEmitter API.\n\nIn this section, we will complete our socket by adding a basic EventEmitter API, then move our traffic into the emitter. As a bonus, we will cover publishing our library to a package manager, and importing it onto different machines.\n\n * Extend a basic EventEmitter class.\n * Forward events from nostr to event emitter.\n * Compile, bundle and publish our library.\n * Wrap-up and demonstration of `NostrSocket`.\n\n## Setup\n\nTo begin, use `git clone` to download this repo onto your local machine.\n\n```bash\n# Check that you have git and node installed.\nwhich git \u0026\u0026 which node\n# Check you are using the latest version of node (v19+).\nfnm current # or `nvm current`\n# Clone the repo onto your machine.\ngit clone https://github.com/cmdruid/nostr-socket-workshop\n# Enter the project directory.\ncd nostr-socket-workshop\n```\n\nOnce downloaded, enter the project directory, then enter any lesson step to follow along. You will have to install dependencies for each step by running `yarn install` or `npm install` when you first begin the lesson.\n\n```bash\n## Enter the directory of a lesson.\ncd part_00\n## Install any dependencies.\nnpm install\n## Run the example scratch file.\nnpm run scratch\n```\n\n## Questions / Issues\n\nPlease feel free to post an issue of you have any questions, or need clarification on something here.\n\n## Resources\n\n**Fast Node Manager**  \nhttps://fnm.vercel.app  \n\n**Nostr Implementation Proposals**  \nhttps://nips.be  \nhttps://github.com/nostr-protocol/nips  \n\n**nostr-tools**  \nhttps://github.com/nbd-wtf/nostr-tools\n\n**nostr army knife**  \nhttps://nak.nostr.com\n\n**Nostr Watch**  \nhttps://nostr.watch  \n\n**nostr.band**  \nhttps://nostr.band  \n\n## Contact\n\nYou can find me on twitter at `@btctechsupport` or on nostr at `npub1gg5uy8cpqx4u8wj9yvlpwm5ht757vudmrzn8y27lwunt5f2ytlusklulq3`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmdruid%2Fnostr-socket-workshop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcmdruid%2Fnostr-socket-workshop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmdruid%2Fnostr-socket-workshop/lists"}