Skip to content

YashasVM/cd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cd banner

A clearer, faster browser-to-browser file handoff app.

Status Origin Stack

Important

This is a fork of Sha, modified and modernized with a clearer UI, cleaner codebase, and faster transfer behavior. It exists as a separate project to maintain a clean separation from the clunkiness of the old project while preserving the original idea.

What is cd?

cd is a direct browser-to-browser file sharing app. Pick files, get a friendly receive code, share the code or QR link, and keep both browser tabs open while the transfer runs.

Sender Browser -> WebRTC Data Channel -> Receiver Browser
       |                 ^
       |                 |
       +-- PeerJS signaling for connection setup

Links

Link Purpose
cd Repository Modernized fork and active codebase
Original Sha Repository Source project this fork split from
New main website Main Cd website, New UI, and Upgraded memes
Vite Local dev server and production build tool
PeerJS WebRTC signaling library
QRCode Sender QR generation
html5-qrcode Receiver camera QR scanning
Cloudflare Workers Static Assets Deployment target configured by wrangler.jsonc

Features

Transfer Flow

Feature Details
Direct P2P Transfer Files transfer between browsers over WebRTC data channels
No Server Storage The hosted app does not intentionally store transferred file contents
Multi-File Batches Send one file or many files in a single session
Friendly Codes Human-readable receive words with compact joining
Share Links Receiver links support ?receive=code deep linking
QR Handoff Sender generates a QR code for quick joining

Modernization Goals

Area What Changed
UI Rebuilt into a sharper, clearer brutalist workbench
Codebase Moved from loose static scripts into a Vite ES module app
Speed Uses binary chunks, file streams, and data-channel backpressure
Safety Avoids CDN script injection and keeps file handling in browser APIs
Deployment Builds to dist/ for cleaner Cloudflare static asset hosting

Quick Start

1. Install

npm install

2. Run Locally

npm run dev

Open the local Vite URL in two browser windows or on two devices.

3. Send

  1. Choose or drop one or more files.
  2. Share the generated code, copy the join link, or show the QR code.
  3. Keep the sender tab open until the receiver connects.

4. Receive

  1. Switch to Receive, open a receive link, or scan the QR code.
  2. Connect with the code.
  3. Save streamed files when prompted, or let the browser download Blob fallbacks.

Developer Setup

Prerequisites

  • Node.js 18 or newer
  • npm 9 or newer
  • Git
  • A modern Chromium, Firefox, or Safari browser for WebRTC testing

Clone

git clone https://github.com/YashasVM/cd.git
cd cd

Install Dependencies

npm install

Start Dev Server

npm run dev

Vite prints a local URL, usually http://127.0.0.1:5173/. Open it in two browser windows to test send and receive on one machine.

Build Production Assets

npm run build

The production build is written to dist/.

Run Dependency Audit

npm run audit

Preview Production Build

npm run preview

Deploy Notes

wrangler.jsonc points Cloudflare at ./dist, so deploy after running npm run build. The repo is structured for static asset hosting; no server-side file storage process is required.

Manual QA Checklist

  • Send one small file.
  • Send multiple files in one batch.
  • Receive with manual code entry.
  • Receive with a copied receive link.
  • Receive by scanning the generated QR code.
  • Try an invalid code and an unavailable sender.
  • Test at least one large file to watch speed and backpressure behavior.

Architecture

+-------------------+        PeerJS signaling        +-------------------+
|   Sender Browser  | <----------------------------> | Receiver Browser |
|                   |                                |                  |
| File picker/drop  |                                | Code/QR scanner  |
| Manifest builder  |                                | Manifest reader  |
| Stream reader     |                                | Save/download    |
+---------+---------+                                +---------+--------+
          |                                                    ^
          |              WebRTC data channel                   |
          +----------------------------------------------------+
                         Raw binary chunks

Runtime Defaults

Parameter Value
App Runtime Vite vanilla JavaScript with ES modules
Signaling peerjs@1.5.5
QR Generation qrcode@1.5.4
QR Scanning html5-qrcode@2.3.8
Hosting Target Cloudflare static assets from dist/
Buffer Guard Data channel backpressure before large buffered queues build up

Repository Layout

/
|-- index.html              App shell and accessible transfer views
|-- src/
|   |-- main.js             Sender, receiver, WebRTC, QR, and transfer logic
|   `-- style.css           Brutalist responsive interface
|-- favicon.svg             App icon
|-- package.json            Scripts and dependencies
|-- package-lock.json       Locked dependency graph
|-- wrangler.jsonc          Cloudflare static asset config
`-- README.md               Project documentation

Build and Checks

npm run build
npm run audit

Cloudflare serves the production build from dist/, as configured in wrangler.jsonc.


Safety Notes

  • File contents are sent over WebRTC data channels between connected browsers.
  • The hosted app serves static assets and does not intentionally store transferred files.
  • PeerJS signaling helps establish the connection, but it is not a file storage layer.
  • Share codes are temporary secrets. Send them only to the intended receiver.
  • The sender should keep the tab open until the transfer completes.
  • Browser support, NAT behavior, VPNs, and local network policies can affect peer connectivity.

Made by @yashas.vm

A modernized split from Sha: clearer UI, cleaner code, faster handoffs.

About

Modernized fork of Sha with a clearer UI, cleaner codebase, and faster WebRTC file transfers.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors