• This repository has been archived on 25/Nov/2023
  • Stars
    star
    364
  • Rank 116,292 (Top 3 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🔗 zero-config peer-to-peer encrypted live folder syncing that respects your `.gitignore`

Banner

portal

Zero-config peer-to-peer encrypted live folder syncing tool that respects your .gitignore. Built on top of the Hypercore protocol with emphasis on being zero-config, secure, and decentralized.

Demos

Uploading Files Downloading Files

Installation

Binary

Pre-packaged binary, no external dependencies required! You can find the binaries on the latest release here.

With Node.js

# Requires node >=v12.22.1
$ npm i -g portal-sync

# Start using portal
$ portal new

# or 
$ portal join [sessionID]

Troubleshooting

  • On MacOS, ensure you give your terminal full disk access permission. (System preferences > Security & privacy > Privacy > Full disk access)

Highlights

  • Ephemeral: As soon as you close your portal, no further content can be downloaded from it. No data is stored anywhere except on the host device.
  • Decentralized: There is no central portal server that all data is routed through. portal only uses public servers to maintain a DHT (distributed hash table) for peer discovery.
  • One-to-many: A single host can sync data to any number of connected peers.
  • Stream-based: Utilizes file streaming to handle files of arbitrary size (regardless of whether they fit in memory or not)
  • Efficient: Changes in single files means that only one file needs to be synced. portal tracks which files have changed to avoid resyncing entire folders wherever possible. A priority queue is used to optimize concurrent operations.
  • Secure: Like Dat, all data is encrypted using the read key. Only those that possess your current 32-byte portal session ID can view the data you share.

Architecture

Project Architecture

Publish-subscribe Model

Portal relies on a publish-subscribe event model to drive its render and update cycles. File tree structure and individual file statuses are stored in a trie structure known as the Registry. On the host side, there is a local Registry that listens to file changes on the host machine and broadcasts them to an append-only Hypercore that is used as an event log. A drive syncing hook listens for changes in the local registry and streams file changes from disk to a Hyperdrive. On the client side, a remote Registry listens for changes in the event log and replicates changes locally. A drive download hook listens for changes in the remote registry and streams file changes from the Hyperdrive to the local disk.

Connection

Portals are identified by unique* 32-byte keys. When a client 'joins' a portal, portal looks up the session key using Hyperswarm and establishes a connection to the host using UDP holepunching.

*8.63x10-78 chance of collision

How is this different from Dat?

Might seem similar to another similar project built on top of the Hypercore protocol called Dat but there are a few key differences.

  1. Dat relies on nodes to keep seeding archives and drives and aims to be a distributed filesystem whereas portal focuses purely on being one-to-many for file sharing/syncing.
  2. No footprint. Because portal is designed to be zero-config, it doesn't leave any dotfiles laying around, whereas Dat stores secrets and metadata in a ~/.dat folder.
  3. Dat tracks version history. Although portal runs on the same underlying protocols, I haven't found a need to utilize version histories yet.
  4. portal respects your .gitignore so it doesn't sync anything you don't want (like pesky node_modules)

Developing

  1. Clone the repository and ensure you have node >= v12.22.1
  2. Run yarn to install deps and yarn dev to enable hot-reload
  3. Run yarn link to register portal as a valid executable

More Repositories

1

quartz

🌱 a fast, batteries-included static-site generator that transforms Markdown content into fully functional websites
TypeScript
6,508
star
2

cursor-chat

💬 cursor chat à la Figma for digital co-existing + presence
TypeScript
219
star
3

bft-json-crdt

🏰 the first JSON-like Byzantine Fault Tolerant CRDT
Rust
201
star
4

hugo-obsidian

simple GitHub action to parse Markdown Links into a .json file for Hugo
Go
148
star
5

docker-explained

🐋 wtf is docker and why is everyone talking about it
Dockerfile
121
star
6

ctrl-v

📋 a modern, open-source pastebin with latex and markdown rendering support
JavaScript
117
star
7

tabspace

✍️ A scratchspace for your new Tab page
TypeScript
115
star
8

jackyzha0.github.io

✨ website v3
TypeScript
97
star
9

telescopic-text

🔭 an open-source library to help with creating expandable text
TypeScript
88
star
10

nanoDB

💾 a simple, easy, and debuggable document database for prototyping and hackathons
Go
74
star
11

miniraft

🚣‍♀️ <1kloc, well-documented Raft consensus algorithm implementation
Rust
46
star
12

DroneNet

Decentralized drone swarm communication for search and rescue missions
Python
35
star
13

min-react

Yet another minimal React template
JavaScript
17
star
14

paypaya

[🏆 5th place + Best Fintech at HackWestern] PayPaya -- SMS Money Transfer for Low Bandwidth Regions with Biometric Authentication
Python
15
star
15

rs-openai

A Rust crate for easy serving of OpenAI's API with rate limiting and token use tracking out of the box
Rust
12
star
16

discord-steward

🌿 A pace-layered approach to high-volume Discord Servers.
TypeScript
10
star
17

lite.css

a dead-simple just-add-water css library
HTML
10
star
18

template-react

For when create-react-app just doesn't give you what you want.
JavaScript
9
star
19

PacketBook

[🏆 Top 30 at nwHacks 2018, SAP iXP Prize] PacketBook SMS financial inclusion platform powered by the Stellar Blockchain
JavaScript
7
star
20

play

artifact from interact circle on hackathon culture + play
JavaScript
7
star
21

NEAT-genetic-algo

BIOL111 Group Project
Python
6
star
22

treehacks2020-backend

[🏆 Azure Prize at TreeHacks] readAR -- 🌲 TreeHacks 2020 Backend
Python
5
star
23

hruid

human-readable base16 IDs
JavaScript
5
star
24

hackTheNorth2018

📱 Tapp.it! - Cryptopayments over NFC
Java
5
star
25

Speech2Braille

[🏆 Silver Medal at CWSF] Tensorflow Implementation of TIMIT Deep BLSTM-CTC with Tensorboard Support
Python
5
star
26

go-auth-w-mongo

Simple session based authentication with Mux and MongoDB
Go
4
star
27

lhd-build-python-webapp

The Python Webapp workshop at UBC LHD 2019!
HTML
3
star
28

go-remote-debug

A quick tutorial on debugging containerized Go applications!
Go
3
star
29

htn22

HTN22 - Intro to Computer Networking and Peer-to-peer
HTML
3
star
30

front-proxy-PoC

Simple Envoy Service Mesh with External Authorization and Custom Header Injection.
Go
3
star
31

blog

some mildly coherent ramblings
CSS
3
star
32

jackyzha0

a cool readme
TypeScript
3
star
33

dotfiles

dotfiles n things
Lua
3
star
34

monGo-driver-wrapper

A small Go wrapper to reduce boilerplate of using the official Go Mongo Driver
Go
2
star
35

curius-viz

JavaScript
2
star
36

website-v2

✨ now with templating and other cool stuff ✨
CSS
2
star
37

riverbed

TypeScript
2
star
38

groupCalendar

A Group Web Calendar created with Meteor
JavaScript
1
star
39

python-spacegame

2D Top Down Space Shooter
Python
1
star
40

y-webrtc-signalling

a simple y-webrtc signalling server for use in serverless environments
JavaScript
1
star
41

apcs-spaceshooter

Short project for APCS A
Java
1
star
42

wholesome-bot

A fun little web scrapping project to bring some happiness to the world
HTML
1
star
43

dailycodingproblem

Python
1
star
44

gameoflife

Java Implementation of Conway's Game of Life
Java
1
star