Skip to content

A secure, decentralized peer-to-peer (P2P) ToDo list app built using Autobase, Blind Pairing, and Hyperswarm on the Pear Runtime.

Notifications You must be signed in to change notification settings

usama9500/todo-peer-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

P2P Collaborative ToDo App

Node.js Autobase Blind%20Pairing Pear%20Runtime

A minimal peer-to-peer ToDo list app built with Autobase, Blind Pairing, and Corestore, running on the Pear Runtime.

This application allows two users to collaborate on a task list in real time — without any server — by pairing over a decentralized P2P network using secure invites.


Features

  • Create and share a ToDo list across peers
  • Real-time syncing using Autobase view
  • Mark tasks as done (replicated across peers)
  • Secure pairing with invite-based blind connection
  • CLI-based task management

Setting Up

To set up the project manually:

  1. Create a new project folder:

    mkdir todo-peer-app && cd todo-peer-app
  2. Initialize a Node.js project:

    npm init -y
  3. Install required packages:

    npm install autobase corestore hyperswarm blind-pairing
  4. Add Source Files in src/

Create the folder and files:

mkdir src
touch src/index.js src/pairing.js src/view.js
  • index.js: CLI entry point that handles commands like add, done, list, etc., and interacts with Autobase.
  • pairing.js: Handles blind pairing logic. Generates invites (--invite) or joins via provided invite string.
  • view.js: Manages the Autobase view using event sourcing (task, markDone). Defines apply(), open(), and close() functions.

These files define the app’s logic for pairing, syncing tasks, and CLI interaction. You'll find detailed examples in the docs/ folder or the repo reference.


Running the App

Open two terminals.

Terminal 1 (Inviter)

node src/index.js --store=store-a --invite
  • Generates and prints a pairing invite
  • Starts a shared Autobase
  • Allows writing tasks to the shared log

Terminal 2 (Invitee)

Use the invite printed above:

node src/index.js --store=store-b 'invite:BASE64_STRING_HERE'
  • Connects securely to the inviter
  • Syncs and participates in the shared ToDo list

CLI Commands (Inside App Prompt)

Command Description
add <task> Adds a new task
done <index> Marks the task at that index as done
list Displays current ToDo list
history Shows raw log entries (JSON)
clear Clears the terminal
exit Exits the application

Folder Structure

todo-peer-app/
├── src/
│   ├── index.js         # CLI command interface
│   ├── pairing.js       # Blind pairing logic
│   ├── view.js          # Autobase view & apply logic
├── docs/                # Documentation files
├── package.json         # Dependencies and metadata
└── README.md            # Project overview

Documentation

  • docs/walkthrough.md – Step by step walkthrough
  • docs/architecture.md – System architecture
  • docs/functions_refenrence.md – Function descriptions

🧪 Sample Interaction

📝 > add Clean the room
📝 > done 0
📝 > list

📋 ToDo List:
0. ✅ Clean the room

Built With

About

A secure, decentralized peer-to-peer (P2P) ToDo list app built using Autobase, Blind Pairing, and Hyperswarm on the Pear Runtime.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published