DEV Community

Aditya Sorathiya
Aditya Sorathiya

Posted on

Magic Nearby Transfer for PasteDB β€” Send Code to Nearby Devices Without QR Codes or Links πŸš€

Ever wanted to send a code snippet from one device to another without generating a QR code, copying a link, or messaging yourself?
I built Nearby Transfer into PasteDB. It lets you send a public paste directly to another nearby device with just a few taps.
It feels a bit like magic.

Nearby Transfer in PasteDB

Normally, sharing a paste means:
Copying a URL
Sending it through WhatsApp/Discord
Scanning a QR code
Nearby Transfer skips all of that.
If the receiver is nearby, you simply select their device and send the paste instantly.


πŸ§‘β€πŸ’» Receiver

Open PasteDB.
Go to Transfer Page.
Become discoverable:
Mobile: Hold 3 fingers on the screen for 3 seconds, or press and hold the Be Discoverable button for 3 seconds.

Desktop/Laptop: Press and hold the Be Discoverable button for 3 seconds.
Your device becomes visible to nearby users for 10 seconds.


πŸ“€ Sender

Open any public paste to share.
Click Nearby Share.
Nearby discoverable devices appear.
Select the device.
The paste opens instantly on the receiver's device.

No QR code.
No copy-paste.
No messaging apps.

πŸ“ Location Permission

Nearby Transfer uses your approximate location to find nearby devices.
For the best experience, both the sender and receiver should allow location access.
Location is only used to improve nearby discovery.

🌐 Try it

PasteDB
https://pastedb.netlify.app⁠

Transfer Page
https://pastedb.netlify.app/transfer⁠

GitHub
https://github.com/sorathiya903/pastedb⁠

I'd love to hear your feedback or ideas for improving the feature!

Top comments (4)

Collapse
 
frank_signorini profile image
Frank

This is super cool! Are you primarily using mDNS/Bonjour for device discovery, or something like

Collapse
 
aditya_sorathiya_069252f4 profile image
Aditya Sorathiya • Edited

View Nearby Transfer FastAPI Route

It's a lightweight discovery system built on WebSockets.

When the receiver opens the Nearby Transfer page, it connects to a WebSocket and when user holds the Be Discoverable button for 3 seconds then device sends a register request.

The server temporarily registers that device (for about 10 seconds), along with its approximate location and device information.

When the sender opens Nearby Share, it sends a find request over another WebSocket connection. The server checks its list of currently registered receivers, filters nearby devices based on location (within ~110 to 50 meters), and returns the matching devices.
After the sender selects a device, it sends a send request with the paste URL. The server forwards that URL directly to the receiver through its existing WebSocket connection. The receiver immediately opens the paste, and the device is then removed from the available list.
This way, only devices that have explicitly enabled Nearby Receive are discoverable, and they're only visible for a short time.

You can view the route at
pastedb.netlify.app/paste/fastapir...

Or

sorathiya903.github.io/pastedb/pas...

Collapse
 
shiwei_xie_24a93f54203fb3 profile image
shiwei xie

Nice write-up! For devs who deal with messy copied text, TextStow might help β€” it's a Mac menu bar tool combining clipboard history with prompt templates and text cleanup. Free: textstow.com

Collapse
 
aditya_sorathiya_069252f4 profile image
Aditya Sorathiya

If netlifyis banned in your region the try this url
sorathiya903.github.io/pastedb/