Skip to content

A file-sharing system that allows users to directly share and download files without relying on a central server. Built with networking protocols, the system ensures efficient, secure, and scalable file transfers between peers.

Notifications You must be signed in to change notification settings

imjhaji03/Datadrop-File-Sharing-System

Repository files navigation

Datadrop

Simple, secure, and direct peer-to-peer file sharing.
Connect & Share. No cloud, no intermediaries.

Java 11+ Next.js PM2

✨ Showcase

Datadrop provides a clean and seamless experience for sharing files directly between any two devices with a web browser. The process is simple: select a file, share the code, and download.

1. Select a File & Get Invite Code 2. Receive & Download on Any Device
Desktop Share View Mobile Receive View

🚀 Features

  • Direct Datadrop Transfer: Files are sent directly from the sender to the receiver, ensuring privacy and speed.
  • Simple Invite Codes: Share files easily using a temporary, system-generated invite code.
  • Drag & Drop UI: Modern, responsive interface for an effortless user experience.
  • No File Size Limits: Your transfer capacity is only limited by your own network.
  • Cross-Platform: Works on any OS with Java, Node.js, and a modern web browser.

🛠️ Technology Stack

  • Backend: Java (via Spring Boot) with Maven for dependency management.
  • Frontend: Next.js, React, and Tailwind CSS for a modern, responsive UI.
  • Process Management: PM2 for running the backend and frontend as persistent services on a server.

⚙️ How It Works

Datadrop uses a central Java server for coordination (i.e., "handshaking") but establishes a direct connection for the file transfer itself.

  1. File Upload (Sender): A user uploads a file. The UI sends a request to the Java backend. The backend starts a temporary file server on an available port and returns the port number as an Invite Code.
  2. File Sharing: The sender shares the Invite Code with the receiver.
  3. File Download (Receiver): The receiver enters the code. Their browser connects directly to the sender's temporary file server to download the file. The central server is not involved in the transfer itself.

📦 Getting Started

Prerequisites

  • Java 11+ (JDK)
  • Node.js 18+ and npm
  • Maven 3.6+
  • Docker (optional, for Docker-based setup)

Option 1: Quick Start Scripts (Easiest)

These scripts handle building the backend and launching both servers for you.

Linux/macOS:

./start.sh

Windows:

start.bat

Option 2: Manual Setup

Backend (Terminal 1):

# Build the Java project
mvn clean package

# Run the backend server
java -jar target/Datadrop-1.0-SNAPSHOT.jar

The backend server will start on port 8080.

Frontend (Terminal 2):

# Navigate to the UI directory
cd ui

# Install dependencies
npm install

# Run the development server
npm run dev

The frontend will be available at http://localhost:3000.

🏗️ Deployment

For detailed instructions on deploying to a VPS, see DEPLOYMENT.md.

The recommended method for a production environment is using PM2, a process manager for Node.js applications that can also manage the Java backend. This ensures that your services automatically restart if they crash.

PM2 Setup in Terminal Datadrop backend and frontend running as managed services with PM2.

🔒 Security Considerations

This application is a proof-of-concept and does not include advanced security features.

  • No Encryption: File data is transferred in plaintext. Do not use for sensitive information.
  • No Authentication: Anyone with a valid Invite Code can initiate a download.
  • For production use, consider implementing end-to-end encryption (E2EE) and robust network security policies.
View Low Level Design (LLD)
classDiagram
%% --- Backend Components (Java / Spring Boot) ---
    class DatadropApplication {
        +main(String[] args)
    }
    class FileController {
<<Rest Controller>>
+uploadFile(MultipartFile file, HttpServletRequest request)
}
class FileService {
<<Service>>
+startFileServer(MultipartFile file) int
}

%% --- Frontend Components (Next.js / React) ---
class HomePage {
-file: File
-shareInfo: object
+handleFileSelect()
+renderChildComponent()
    }
class FileUpload {
+handleDragDrop(event)
+generateShareLink()
}
class FileDownload {
-inviteCode: string
-senderIp: string
+triggerDownload()
}

%% --- Key Data Structures ---
class ApiData {
<<Data Transfer Object>>
+MultipartFile Request
+string host
+string inviteCode
}
class Datadrop_Connection {
<<HTTP Request>>
Direct GET to http://<sender_ip>:<invite_code>
}

%% --- RELATIONSHIPS ---
DatadropApplication ..> FileController : "Initializes"
HomePage --> FileUpload : "Displays"
HomePage --> FileDownload : "Displays"

FileUpload --|> FileController : "Makes API call to /api/upload"
FileController --> FileService : "Delegates to"

%% This shows the direct Datadrop link, not connected to the main server
FileDownload ..> Datadrop_Connection : "Initiates direct download"

%% --- NOTES AND ANNOTATIONS ---
note for FileController "Exposes the REST API endpoint for initiating a share. Returns the sender's IP and a port."
note for FileService "Core logic: Finds an open port and starts a temporary HTTP server on the sender's machine to serve the file."
note for FileUpload "Handles file selection via UI and calls the backend API to generate the share information."
note for Datadrop_Connection "This is the direct data transfer. It's an HTTP request from the receiver's browser to the sender's temporary server, not the main backend."
Loading

About

A file-sharing system that allows users to directly share and download files without relying on a central server. Built with networking protocols, the system ensures efficient, secure, and scalable file transfers between peers.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published