Skip to content

Conversation

Nkovaturient
Copy link

@Nkovaturient Nkovaturient commented Jun 24, 2025

✨ Add Js-peer Workshop Lessons 1 & 2 with Robust Automation and Testing

Description

This PR introduces the first two lessons of the Js-peer Universal Connectivity Workshop. These lessons are designed to teach new developers how to build robust, event-driven peer-to-peer applications using js-libp2p. The structure, validation, and automation closely follow the standards set by the Rust workshop, ensuring a high-quality, reproducible learning experience.


Integration Highlights

  • Lesson 1: Identity & Swarm Basics

    • Teaches PeerId generation, basic node setup, and printing listening addresses.
    • Includes clear objectives, step-by-step instructions, and progressive hints.
    • Robust validation using a custom check.py script and Docker Compose.
  • Lesson 2: TCP Transport

    • Guides students through adding TCP transport, Noise encryption, and Yamux multiplexing.
    • Emphasizes robust error handling and event-driven connection management.
    • Includes detailed instructions, error handling best practices, and validation.
  • Automation & Testing

    • Provided a reusable Bash script (test_lesson.sh) for automated lesson validation.
    • Each lesson can be built, run, and validated in isolation using Docker Compose and the provided check scripts.
    • Output is parsed for correctness, and results are clearly indicated with codes (✅/❌).
  • Structure & Consistency

    • Lessons are organized under en/js/ with a clear, repeatable directory structure.
    • All files (lesson.yaml, lesson.md, Dockerfile, index.js, check.py, docker-compose.yaml) are included and follow best practices.

Relevant Resources

Copy link
Collaborator

@dhuseby dhuseby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this PR! However, it is missing the en/js/setup.md file that explains the commands to run to start a new project that uses js-libp2p and the en/js/deps.py script that checks for all of the commands needed to create/compile/run a js project that uses js-libp2p. I can't test it any further until those are there.

@Nkovaturient
Copy link
Author

Thank you for the review, working on it!

@Nkovaturient
Copy link
Author

Hello @dhuseby

QnA

  1. Need your help in correctly configuring the setup.md, ig for each workshop, the dir universal-connectivity is created and the subsequent rust/js/py lessons are setup, right? Can you look at the current setup.md for js-lessons and provide guidance on it.

  2. How does Checkpoint lessons should be graded/implemented?scores? need clarification.

As for the latest commits inculcates following changes:

  • Scaffolded and implemented Lesson 1 (Identity & Swarm Basics) with Docker, npm, and robust validation
  • Scaffolded and implemented Lesson 2 (TCP Transport) with error handling, event-driven logic, and stack consistency
  • Scaffolded and implemented Lesson 3 (Ping Protocol, Checkpoint 1) with identify, ping, and direct-message protocols
  • Added direct-message.js: production-grade, event-driven, error-resilient direct message protocol implementation

Further TODOs

  • Scaffold and implement future lessons (Gossipsub, DHT, NAT traversal, etc.).
  • Add instructor checkpoint integration for live classroom validation.
  • Expand automated CI coverage for all lessons.

Console Output:

Lesson 1: (Identity & Swarm Basics)

Screenshot (611)

Lesson 2 (TCP Transport)

Screenshot (610)

Lesson 3 (Ping Protocol)

Screenshot (609)

luu-alex and others added 2 commits June 26, 2025 00:23
@luu-alex
Copy link

luu-alex commented Jun 28, 2025

@Nkovaturient Hey there! I'll help create the set up/checks and deps for js. As well I think there is quite a bit of work needed for each lesson. Is there a chance you can split each lesson into its own seperate PR? it'll be easier to manage and review 😄
@dhuseby as well, will we need to add the js guide to workshops? Edit: looking at state.txt i understand the techincal implementations more. thanks!

@luu-alex
Copy link

luu-alex commented Jun 29, 2025

Created a PR to edit the docker files and configs to structure for the workshop flow.
Nkovaturient#2
@dhuseby should all these files be added in /app? or is the user supposed to be creating this on their own project

@Nkovaturient
Copy link
Author

Nkovaturient commented Jul 10, 2025

Updates

03-ping-protocol/check.py

  • Purpose: Validates the implementation of the ping protocol.
    • Provides clear, actionable feedback for each step and prints a summary of what was achieved.

04-circuit-relay-v2

  • Demonstrates p2p connections between two peers where one(listener) peer is behind a NAT/firewall(unreachable) however can be connected via a circuit-relay-v2 reservations medium tht sends inbound connections from listener node to dialer node, facilitating communications.

05-identify-protocol

  • Implements identify protocol lesson tht facilitates exchange of info with other peers in the network, including addresses, public keys, and capabilities.

06-gossipsub-module

  • Lesson 6 implements extensible baseline pubsub protocol: gossipsub to clarify how p2p connections and messages are communicated between connected peers in a network.

General Setup/Pattern

  • Each lesson folder contains:
    • A robust check.py script tailored to the protocol/module being taught.
    • An app/ directory with the actual node implementations for the lesson.

Core features are setup just Lesson 4 and 5 are under active development ..🚧

@luu-alex
Copy link

luu-alex commented Jul 15, 2025

finished lesson 2, added more relevant info and fixed docker. added checker as well. Will continue fixing the next lessons

@dhuseby
Copy link
Collaborator

dhuseby commented Jul 31, 2025

perhaps this will help you figure out the structure of the content: https://github.com/libp2p/workshop/blob/main/WORKSHOP_AUTHORING.md

Copy link
Collaborator

@dhuseby dhuseby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still need to clean some stuff up.

@Nkovaturient
Copy link
Author

Hey @dhuseby
I have revamped the js-lessons setup

  • Updated deps.py - Removed Docker and docker-compose checks, now only validates Node.js and npm
  • Modified setup.md - Added proper heading structure with ## 1. Project Setup for the directory creation section
  • Modified lesson.yaml - to include status indicators
  • Cleaned up structure - Removed test scripts

Thanks for the Workshop_Authoring_MD, will go through it.
Is there anything else to take care of?

parth-soni07 and others added 6 commits August 9, 2025 19:12
Merge PR #8 from Nkovaturient/feat/lesson-3-fixes
* fix(l5): Identify-Protocol-checkpoint

* feat: Add Lesson 5 (Identify Protocol) for JavaScript track

- Complete lesson implementation with libp2p identify protocol
- Fixed PeerId generation and private key handling
- Added Docker containerization with proper networking
- Included comprehensive validation with check.py
- Updated workshop.yaml to support JavaScript lessons
- All tests passing: Node.js direct, Docker Compose, Python checker

Resolves: JavaScript Lesson 5 implementation
Testing: Validated with multiple test methods

* Add js-libp2p support and complete lesson paths for js in workshop.yaml

* Revert "fix(l5): Identify-Protocol-checkpoint"

This reverts commit 85ca2c3.

---------

Co-authored-by: Hany Almnaem <[email protected]>
* Added Lesson 03 & 04 with dockerization

* Updated peer-id generation logic

* minor changes to lesson03 app/index.js
@Nkovaturient Nkovaturient requested a review from dhuseby August 31, 2025 15:20
@Nkovaturient
Copy link
Author

@dhuseby
I, Alex, Parth and Hany have so far completed this js-workshop lessons.
Patiently awaiting your review and further guidance on this.

Hany-Almnaem and others added 4 commits September 12, 2025 18:07
* feat: enhance GossipSub lesson with multi-peer demonstration

Transform basic GossipSub lesson into comprehensive multi-peer demo:

- Replace single-peer setup with realistic 2-peer network
- Demonstrate actual peer-to-peer message exchange
- Add professional educational documentation
- Implement proper mesh formation and validation
- Show bidirectional GossipSub messaging in action

Educational improvements:
- Students experience real decentralized messaging
- See authentic libp2p peer discovery and connection
- Understand GossipSub mesh topology formation
- Validate actual pub/sub message propagation

The lesson now demonstrates true GossipSub capabilities instead
of basic topic subscription, providing realistic P2P learning.

* feat: implement coordinated multi-peer GossipSub demonstration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants