A real-time, end-to-end encrypted shared clipboard built with Next.js, Socket.IO, and MongoDB.
Quickly and privately sharing text or files between devices can be cumbersome. Standard tools like messaging apps are often slow, require logins, and are not built for privacy-focused, temporary data sharing.
This application is a simple, secure, and real-time shared clipboard with the following features:
- End-to-End Encryption: All content is encrypted and decrypted directly in your browser. The server never sees your unencrypted data.
- Real-Time Sync: Changes instantly appear on all connected devices using WebSockets.
- Password-Protected: Rooms are secured by a password that is never sent to the server.
- Text & File Sharing: Supports both rich text notes and file uploads.
- Account-Free: No sign-up required for quick, ephemeral use.
The app uses a Next.js and React frontend for the UI and client-side cryptography. The backend consists of Next.js API Routes running a Socket.IO server for real-time events and a REST endpoint for file handling. MongoDB stores the encrypted data blobs. The browser's native Web Crypto API derives a secret key from your password, ensuring all data is encrypted before it leaves your device.
Follow these steps to get the project running on your local machine.
Note: If you don't have
pnpm
installed, you can install it globally usingnpm
(which comes with Node.js):npm install -g pnpm
-
Clone the repository:
git clone https://github.com/parthg2112/clipboard.git cd clipboard
-
Install dependencies:
pnpm install
-
Set up environment variables: Create a new file named
.env.local
in the root of the project and add your MongoDB connection string.# .env.local MONGODB_URI="your_mongodb_connection_string" CLIPBOARD_DB_NAME="your_database_name" SOCKET_PORT=3000 NEXT_PUBLIC_SOCKET_PORT=3000 NEXT_PUBLIC_APP_URL=http://localhost:3000
Important: Make sure your MongoDB password in the URI is URL-encoded if it contains special characters (like
@
,:
,#
). -
Run the development server:
pnpm dev
-
Open the application: Navigate to
http://localhost:3000
in your web browser. Create a room by entering any password, and open the same URL on another device or tab with the same password to see the real-time sync in action.