โ† Back to Portfolio

hashdrop

HashDrop is a secure, peer-to-peer file transfer application built with Next.js and WebRTC, enabling direct, end-to-end encrypted file sharing between devices with no cloud storage, no tracking, and no data retention.

TypeScript

HashDrop ๐Ÿš€

A secure, peer-to-peer file transfer application built with Next.js and WebRTC. Share files directly between devices at lightspeed. No cloud, no limits, no tracking.

Next.js TypeScript License


Screenshot 2026-01-10 at 17 23 39

โœจ Features

๐Ÿ”’ Security & Privacy

  • End-to-End Encryption: WebRTC DTLS/SRTP encryption (same as Zoom, Google Meet)
  • SHA-256 File Verification: Cryptographic hashing ensures file integrity
  • No Cloud Storage: Files never touch our servers or any cloud storage
  • Zero Data Retention: No logs, no tracking, no metadata storage
  • Code-Based Access Control: Only the person with the unique code can access files
  • Single Connection Limit: Prevents unauthorized access even if code is leaked
  • 5-Minute Code Expiry: Transfer codes automatically expire for security

โšก Performance & Reliability

  • Direct P2P Transfer: Files stream directly between devices via WebRTC
  • Real-time Progress: Live progress tracking with speed and ETA
  • Automatic Download: Files download automatically when transfer completes
  • Duplicate Chunk Protection: Ensures data integrity during transfer
  • File Size Validation: Supports files up to 10GB with built-in DoS protection
  • Resumable Transfers: Robust chunk-based transfer system

๐ŸŽจ User Experience

  • Human-Readable Codes: Easy-to-share transfer codes (e.g., "Cosmic-Falcon")
  • QR Code Sharing: Instant connection via QR code scanning
  • Dynamic OG Images: Beautiful link previews with transfer codes for Discord, Twitter, etc.
  • Auto-Copy Toggle: Optional clipboard auto-copy (privacy-first)
  • Transfer History: Track your recent transfers with statistics
  • Image Preview: Preview images before downloading
  • Keyboard Shortcuts: Fast navigation with keyboard commands
  • Responsive Design: Works seamlessly on desktop and mobile

๐ŸŒ Zero Friction

  • No Account Required: Completely anonymous, no signup
  • No Installation: Works directly in the browser
  • Cross-Platform: Works on any device with a modern browser
  • Text Sharing: Share text and links instantly

๐Ÿ›ก๏ธ Security Enhancements (Latest)

Critical Security Fixes

โœ… Multi-Connection Prevention: Only the first peer can connect, preventing unauthorized access

โœ… Enhanced Code Entropy: 6,400 possible combinations (80ร—80) vs previous 1,600

โœ… Duplicate Chunk Detection: Protects against data corruption attacks

โœ… File Size Limits: 10GB maximum file size to prevent DoS

โœ… Chunk Count Limits: Maximum 1M chunks to prevent memory exhaustion

โœ… Input Validation: All user inputs sanitized and validated (XSS protection)

โœ… OG Image Security: Transfer code parameters validated in Open Graph images

Privacy-First Design

โœ… Auto-Copy Disabled by Default: Clipboard permission only requested when user enables it

โœ… Transparent Security: Detailed "How Does It Work?" section educates users

โœ… Warning Messages: Clear warnings about code sharing best practices


๐Ÿš€ Tech Stack

CategoryTechnology
FrameworkNext.js 16 (App Router, Turbopack)
LanguageTypeScript 5
P2PPeerJS 1.5.4 (WebRTC wrapper)
StateZustand 5.0.2
StylingTailwind CSS v4.1
AnimationsFramer Motion 12.23
UI ComponentsLucide React (icons), Sonner (toasts)
File HandlingJSZip, React Dropzone
ChartsRecharts 3.6
TestingJest 29, React Testing Library 16

๐Ÿ“ฆ Getting Started

Prerequisites

  • Node.js 18+ and npm

Installation

  1. Clone the repository:

    git clone https://github.com/metesahankurt/hashdrop.git
    cd hashdrop
    
  2. Install dependencies:

    npm install
    
  3. Run the development server:

    npm run dev
    
  4. Open in browser:

    • Go to http://localhost:3000
    • Open in two different browsers (e.g., Chrome and Firefox) to test file transfer locally

Build for Production

npm run build
npm run start

๐Ÿงช Testing

Run unit tests:

npm run test

Run tests in watch mode:

npm run test:watch

Generate coverage report:

npm run test:coverage

๐Ÿ“ Project Structure

hashdrop/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ app/                          # Next.js App Router
โ”‚   โ”‚   โ”œโ”€โ”€ layout.tsx               # Root layout with metadata
โ”‚   โ”‚   โ”œโ”€โ”€ page.tsx                 # Home page
โ”‚   โ”‚   โ”œโ”€โ”€ api/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ og/                  # Open Graph image generation
โ”‚   โ”‚   โ”œโ”€โ”€ privacy/                 # Privacy policy page
โ”‚   โ”‚   โ””โ”€โ”€ terms/                   # Terms of service page
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”œโ”€โ”€ layout/                  # Layout components
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ minimal-header.tsx   # Header with logo
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ hamburger-menu.tsx   # Settings menu
โ”‚   โ”‚   โ”‚
โ”‚   โ”‚   โ”œโ”€โ”€ transfer/                # Core transfer logic
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ connection-manager.tsx   # P2P connection & codes (730 lines)
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ transfer-status.tsx      # Progress tracking (430 lines)
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ warp-dropzone.tsx        # File upload
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ text-share.tsx           # Text/link sharing
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ qr-code-display.tsx      # QR code generation
โ”‚   โ”‚   โ”‚
โ”‚   โ”‚   โ””โ”€โ”€ ui/                      # UI components
โ”‚   โ”‚       โ”œโ”€โ”€ transfer-history.tsx     # Transfer history modal
โ”‚   โ”‚       โ”œโ”€โ”€ statistics-dashboard.tsx # Statistics panel
โ”‚   โ”‚       โ”œโ”€โ”€ image-preview-modal.tsx  # Image preview
โ”‚   โ”‚       โ”œโ”€โ”€ info-section.tsx         # Informational content
โ”‚   โ”‚       โ””โ”€โ”€ keyboard-shortcuts-modal.tsx
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ lib/                         # Utilities
โ”‚   โ”‚   โ”œโ”€โ”€ code-generator.ts        # Secure code generation
โ”‚   โ”‚   โ”œโ”€โ”€ file-hash.ts             # SHA-256 hashing
โ”‚   โ”‚   โ”œโ”€โ”€ file-utils.ts            # File helpers
โ”‚   โ”‚   โ”œโ”€โ”€ storage.ts               # LocalStorage management
โ”‚   โ”‚   โ”œโ”€โ”€ preferences.ts           # User preferences
โ”‚   โ”‚   โ”œโ”€โ”€ notifications.ts         # Browser notifications
โ”‚   โ”‚   โ”œโ”€โ”€ error-handler.ts         # Error handling
โ”‚   โ”‚   โ”œโ”€โ”€ animations.ts            # Framer Motion configs
โ”‚   โ”‚   โ””โ”€โ”€ zip-utils.ts             # Multi-file compression
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ store/
โ”‚       โ””โ”€โ”€ use-warp-store.ts        # Zustand global state
โ”‚
โ”œโ”€โ”€ __tests__/                       # Jest unit tests
โ”œโ”€โ”€ public/                          # Static assets
โ””โ”€โ”€ package.json

๐Ÿ” How It Works

Transfer Flow

1. SENDER
   โ†“
   Drops file โ†’ Generates unique code (e.g., "Cosmic-Falcon")
   โ†“
   Code displayed with QR code
   โ†“
   Shares code via secure channel (WhatsApp, Signal, email)
   โ†“
   Waits for receiver to connect

2. RECEIVER
   โ†“
   Enters code or scans QR code
   โ†“
   Clicks "Connect"

3. PEER CONNECTION (via PeerJS)
   โ†“
   Both peers connect to signaling server (only for discovery)
   โ†“
   WebRTC establishes direct encrypted connection (DTLS/SRTP)
   โ†“
   Signaling server no longer involved

4. FILE TRANSFER
   โ†“
   Sender calculates SHA-256 hash
   โ†“
   Sends metadata (filename, size, hash)
   โ†“
   File split into 16KB chunks (base64 encoded)
   โ†“
   Chunks sent with index numbers
   โ†“
   Receiver reassembles chunks in order
   โ†“
   Receiver calculates SHA-256 hash
   โ†“
   Hash verification (match = success โœ…)
   โ†“
   Auto-download triggers (if enabled)

Security Layers

LayerTechnologyPurpose
TransportWebRTC DTLSEncrypts data in transit
Data ChannelSRTPSecure real-time protocol
IntegritySHA-256Detects tampering/corruption
Access ControlUnique CodesPrevents unauthorized access
Connection LimitSingle PeerBlocks multi-recipient attacks
PrivacyNo LoggingZero data retention

๐ŸŽฏ Key Features Explained

1. Code Generation

  • Format: Adjective-Noun (e.g., "Cosmic-Falcon", "Stellar-Phoenix")
  • Entropy: 12.6 bits (6,400 combinations)
  • Random Source: Web Crypto API (cryptographically secure)
  • Expiry: 5 minutes automatic expiration

2. File Transfer Protocol

  • Chunk Size: 16KB per chunk
  • Encoding: Base64 for binary data
  • Ordering: Index-based reassembly
  • Verification: SHA-256 hash check

3. Security Mechanisms

  • Single Connection: Only first peer accepted
  • Duplicate Rejection: Chunks validated by index
  • Size Limits: 10GB max file size
  • Chunk Limits: 1M chunks maximum
  • Hash Mismatch: Transfer rejected if hash fails

4. User Preferences

  • Auto-Copy Code: Optional (default: OFF)
  • Auto-Download: Optional (default: ON)
  • Error Notifications: Optional (default: ON)

โš™๏ธ Configuration

Environment Variables

No environment variables required! HashDrop is 100% client-side.

User Preferences

Accessible via hamburger menu (top-right):

  • Auto-copy Code: Automatically copy transfer codes to clipboard
  • Auto-download Files: Automatically download files when transfer completes
  • Error Notifications: Show browser notifications for errors

Keyboard Shortcuts

  • Cmd/Ctrl + K: Toggle transfer history
  • Cmd/Ctrl + S: Toggle statistics dashboard
  • Cmd/Ctrl + ?: Show keyboard shortcuts
  • ESC: Close all modals

๐Ÿ› Known Limitations

  1. NAT Traversal: Some restrictive firewalls may block WebRTC connections (TURN server not configured)
  2. Browser Compatibility: Requires modern browser with WebRTC support
  3. File Size: Practical limit ~10GB (browser memory constraints)
  4. Connection: Both users must be online simultaneously

๐Ÿค Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ‘จโ€๐Ÿ’ป Author

Mete ลžahan Kurt


๐Ÿ™ Acknowledgments

  • PeerJS: Simplified WebRTC wrapper
  • Next.js: Amazing React framework
  • Tailwind CSS: Utility-first CSS framework
  • Framer Motion: Beautiful animations
  • Vercel: Hosting and deployment

๐Ÿ”ฎ Roadmap

  • End-to-end file encryption (AES-256)
  • Password-protected transfers
  • TURN server configuration (better NAT traversal)
  • Transfer resume capability
  • Mobile app (React Native)
  • Batch file compression optimization
  • Custom branding options

๐Ÿ“Š Statistics

  • Code Entropy: 12.6 bits (6,400 combinations)
  • Max File Size: 10GB
  • Chunk Size: 16KB
  • Code Expiry: 5 minutes
  • Encryption: DTLS/SRTP (AES-128/256)
  • Hash Algorithm: SHA-256

Made with โค๏ธ by Mete ลžahan Kurt

โญ Star this repo if you found it useful!

Live Demo โ€ข Report Bug โ€ข Request Feature