How Multi-Device Sync Works
ClipSync uses a session-based architecture where devices share a common 5-character session code to sync clipboard content in real-time.Architecture Overview
- Session Creation: First device generates a unique 5-character alphanumeric code
- Session Joining: Other devices join using the same code
- Real-time Sync: All changes propagate instantly via Supabase Real-time
- Persistent Storage: Content persists in the database until manually deleted
src/service/doc.service.js:3-14, src/App.jsx:387-403
Complete Sync Workflow
Starting a New Session
Open ClipSync on First Device
Send Your First Clipboard Content
- Type or paste content into the text area
- Optionally attach files or images
- Click “Send to Clipboard”
src/service/doc.service.js:3-14A3X9K, 7BMT2, QP5WNSave Your Session Code
Session Code: A3X9KThis code is automatically saved in your browser’s local storage, so you’ll remain in the session even after closing the browser.Referenced in:
src/App.jsx:102, src/App.jsx:213localStorage under the key sessionCode (see src/App.jsx:65-82). This means you stay connected to your session across browser restarts.Joining from Another Device
Open ClipSync on Second Device
Enter Session Code
- Look for the “Enter session code to retrieve” input field
- Type the 5-character code from your first device
- Click the “Join” button
src/App.jsx:87-119Verify Connection
- Success message: “Joined session A3X9K successfully!”
- Your session code displayed at the top
- All existing clipboard history from the session
src/App.jsx:115Start Syncing
Adding More Devices
Repeat the joining process on as many devices as you need:- Desktop computers (Windows, Mac, Linux)
- Mobile phones (iOS, Android)
- Tablets
- Multiple browsers on the same device
Real-Time Synchronization
How Real-Time Updates Work
ClipSync uses Supabase Real-time (WebSocket) for instant synchronization:src/App.jsx:387-409
What Gets Synced
Text Content
Text Content
- Plain text up to 15,000 characters
- URLs (automatically converted to clickable links)
- Code snippets
- Formatted text (markdown, etc.)
src/App.jsx:169-170Files
Files
- Documents (.doc, .docx, .xls, .xlsx, .ppt, .pptx)
- PDFs (.pdf)
- Text files (.txt)
- Max size: 10MB per file
src/App.jsx:124-127Images
Images
- All image formats (.png, .jpg, .jpeg, .gif, .webp, etc.)
- Automatically compressed to max 0.2MB
- Max dimensions: 1920px width/height
- Original quality preserved for smaller images
src/App.jsx:140-147, src/compressedFileUpload.jsx:3-16Sensitive Content Flags
Sensitive Content Flags
- Checkbox to mark content as sensitive
- Sensitive content is replaced with asterisks in history view
- Still synced to all devices but hidden for privacy
src/App.jsx:531-536, src/utils/index.js:2-5Sync Speed
- Text content: Instant (< 100ms typically)
- Small files (< 1MB): 1-2 seconds
- Large files (up to 10MB): 5-10 seconds depending on connection
- Image compression: Adds 1-3 seconds before upload
Common Use Cases
1. Desktop to Mobile Transfer
Scenario: Copy a long text or link on your desktop and access it on your phone.On Desktop
- Create session or join existing one
- Paste content and click “Send to Clipboard”
On Mobile
- Open ClipSync (install as PWA for quick access)
- Join using session code
- Tap the copy icon next to the content
- Content is now in your phone’s clipboard
- Long URLs or links
- Addresses and contact info
- Confirmation codes and passwords
- Text you’re composing on desktop but need on mobile
2. Team Collaboration
Scenario: Share snippets, links, or files with team members in real-time.Create Team Session
Team Joins
Share Content
- Meeting links
- Code snippets
- Design files (up to 10MB)
- Documentation links
- Shared credentials (use sensitive flag)
src/App.jsx:441-448
3. Cross-Platform Development
Scenario: Develop on one OS and test on another.Share Test Data
Access on Test Device
Share Results
4. Temporary File Transfer
Scenario: Quickly send a document or image between devices without email or cloud storage.Upload File
Access on Other Device
Clean Up
src/App.jsx:121-165 (file upload system)
Session Management
Staying in a Session
Your session code is automatically saved in browser local storage:src/App.jsx:102, src/App.jsx:213
This means:
- You remain in the session after closing the browser
- You can close and reopen ClipSync without rejoining
- Clearing browser data will remove your session
Leaving a Session
Click Leave Button
src/App.jsx:485-494Confirm Action
Session Cleared
- Remove session code from local storage
- Clear clipboard history from view
- Disconnect from real-time updates
Deleting Session Content
Clear All Clipboard Items
Click Delete All Button
src/App.jsx:225-243Confirm Deletion
Content Deleted
- All clipboard items are deleted from the database
- Attached files are removed from storage
- All connected devices see the deletion in real-time
Edit or Delete Individual Items
Edit Item:- Click the green edit icon (✏️) next to an item
- Content loads into the editor
- Make changes and click “Send to Clipboard”
- Original item is deleted, new one is created
src/App.jsx:249-266
Best Practices
Security and Privacy
Referenced in:src/App.jsx:531-536, src/utils/index.js:2-5
- Use unique sessions: Create a new session for each use case or project
- Don’t share session codes publicly: Anyone with the code can access all content
- Mark sensitive content: Use the sensitive flag for passwords, API keys, credentials
- Clean up regularly: Delete old content you no longer need
- Leave sessions: Exit sessions you’re no longer using
Performance Optimization
For Large Files:- Compress images before upload (automatic for images)
- Stay under 10MB file size limit
- Use file sharing services for larger files
- Use search to find specific content (search box available in history)
- Delete old items to keep history manageable
- Consider creating separate sessions for different projects
src/App.jsx:412-420 (search functionality)
Network Considerations
Offline Behavior: When offline, ClipSync displays a warning banner:You are offline. Please connect to the internet to sync clipboard content.Referenced in:
src/App.jsx:27, src/App.jsx:40-53, src/App.jsx:474-477
What happens offline:
- Can view existing clipboard history
- Can type in the editor (saved to session storage)
- Cannot send or receive new content
- Cannot upload files
- Real-time sync pauses
- Reconnects automatically
- Fetches latest clipboard history
- Resumes real-time sync
src/App.jsx:40-53
Session Organization Tips
-
Personal vs. Shared Sessions
- Keep a personal session for your own devices
- Create separate sessions for collaboration
-
Project-Based Sessions
- One session per project or client
- Easier to track and clean up
-
Temporary Sessions
- Create throw-away sessions for one-time transfers
- Leave and forget after use
-
Long-Term Sessions
- Use for ongoing personal sync
- Regularly clean up old content
- Save the session code somewhere safe
Troubleshooting Multi-Device Sync
Content Not Appearing on Other Devices
Check these:- Both devices are using the exact same session code (case-insensitive)
- Both devices are online (check for offline warning banner)
- Browser console shows no errors
- Real-time subscription is active (visible in Network tab > WS)
- Refresh the page on the device not receiving updates
- Leave and rejoin the session
- Check your internet connection
Session Code Not Working
Error: “This session code does not exist” Referenced in:src/App.jsx:96-98
Causes:
- Typo in session code (double-check all 5 characters)
- Session was never created (ensure first device sent content)
- Database connectivity issue
- Verify the exact session code from the first device
- Ensure the first device successfully created the session
- Try creating a new session
Slow Sync Performance
If content takes > 5 seconds to sync:- Check file size: Large files (> 5MB) take longer
- Check internet speed: Slow connections affect sync speed
- Check device performance: Old devices may process slower
- Image compression: Large images need compression time
src/compressedFileUpload.jsx:3-16
Files Not Uploading
Common issues:- File exceeds 10MB limit (see error: “File size exceeds 10MB”)
- Unsupported file type
- Storage bucket not configured in Supabase
- No internet connection
src/App.jsx:125-127
Solution:
- Compress files before upload
- Verify file type is supported
- Check Supabase storage configuration
Advanced Features
Search Clipboard History
Open Search
src/App.jsx:628-636Type Search Query
View Results
src/App.jsx:412-420
Link Detection
URLs in clipboard content are automatically converted to clickable links:src/utils/index.js:6-10
Dark Mode Sync
Dark mode preference is saved per-device in local storage:src/App.jsx:23-26, src/App.jsx:56-62
Each device can use its own theme preference independent of the session.