Prerequisites
Before you begin, ensure you have the following installed on your system:Node.js
Package Manager
Git
Code Editor
Verify Installation
Check Node.js Version
Check npm Version
Check Git Version
Supabase Account Setup
Create Supabase Project
Sign Up for Supabase
- Go to supabase.com
- Click “Start your project”
- Sign up with GitHub or email
Create New Project
- Click “New Project”
- Choose an organization (or create one)
- Fill in project details:
- Name: ClipSync (or any name)
- Database Password: Generate a strong password
- Region: Choose closest to you
- Click “Create new project”
- Wait for project to finish setting up (~2 minutes)
Get API Credentials
- Navigate to Settings → API
- Copy the following values:
- Project URL (under “Project URL”)
- anon public key (under “Project API keys”)
.env file.Set Up Database Tables
Open SQL Editor
Create Tables
Enable Realtime
- Navigate to Database → Replication
- Find the
clipboardtable - Toggle Enable Realtime to ON
Set Up Storage Bucket
Navigate to Storage
Create Bucket
- Click “New bucket”
- Name:
clipboard - Public bucket: Toggle ON (files need to be publicly accessible)
- Click “Create bucket”
Configure Bucket Policies
- Click on the
clipboardbucket - Go to Policies tab
- Add the following policies:
Allow Upload Policy
Allow Upload Policy
Allow Public Access Policy
Allow Public Access Policy
Allow Delete Policy
Allow Delete Policy
Project Setup
Clone Repository
Clone the Repo
<repository-url> with the actual repository URL.Navigate to Client Directory
client/ subdirectory.Install Dependencies
- npm
- yarn
- pnpm
- bun
package.json:12-38
Environment Configuration
Create .env File
.env file in the client/ directory:Add Environment Variables
.env:Update Storage URL (if needed)
src/App.jsx:YOUR_PROJECT_ID with your actual Supabase project ID.Reference: src/App.jsx:156src/config/supabase.js:1-7
Verify Configuration
Check .env File
.env file looks like this:Add to .gitignore
.env is in .gitignore to avoid committing secrets:Running Locally
Development Server
Reference:package.json:7
- npm
- yarn
- pnpm
- bun
Start Development Server
Open in Browser
Test Functionality
- Enter some text in the clipboard textarea
- Click “Send to Clipboard”
- A session code should be generated
- Verify the clipboard entry appears in the history
Development Workflow
File Watching
src/ for changes. Save any file to see instant updates.Error Handling
Network Access
http://192.168.1.100:5173)Build and Preview
Production Build
Reference:package.json:8
- npm
- yarn
- pnpm
- bun
- Runs type checking (if TypeScript is configured)
- Bundles and minifies all assets
- Optimizes images and fonts
- Generates service worker for PWA
- Outputs production-ready files to
dist/
- HTML, CSS, JS files (minified & hashed)
- Service worker
- PWA manifest
- Static assets (images, fonts, icons)
Preview Production Build
Reference:package.json:10
- npm
- yarn
- pnpm
- bun
dist/.
Lint Code
Reference:package.json:9
- npm
- yarn
eslint.config.js:7-38
Development Tips
VS Code Extensions
ESLint
dbaeumer.vscode-eslintHighlights linting errors in real-timeTailwind CSS IntelliSense
bradlc.vscode-tailwindcssAutocomplete for Tailwind classesES7+ React Snippets
dsznajder.es7-react-js-snippetsReact code snippets and shortcutsPrettier
esbenp.prettier-vscodeCode formatting on saveBrowser DevTools
- React DevTools
- Network Tab
- Application Tab
- Inspect component tree
- View component props and state
- Profile performance
Testing Realtime Sync
Open Multiple Tabs
Join Same Session
Test Sync
Test Delete
Testing Offline Mode
Open DevTools
Simulate Offline
- Go to Network tab
- Change throttling to “Offline”
- Reload the page
Verify Offline Banner
Go Back Online
- Change throttling back to “Online”
- The app should reconnect automatically
- Clipboard history should refetch
src/App.jsx:40-53
Common Development Issues
Port Already in Use
Port Already in Use
Port 5173 is already in useSolution:Supabase Connection Failed
Supabase Connection Failed
- Verify
.envvariables are correct - Check Supabase project is running (not paused)
- Ensure you’re using the correct API URL (not the reference ID)
- Restart the dev server after changing
.env
Realtime Not Working
Realtime Not Working
- Verify Realtime is enabled for the
clipboardtable - Check browser console for WebSocket errors
- Ensure both tabs are using the same session code
- Check Supabase realtime quota (free tier has limits)
File Upload Fails
File Upload Fails
- Verify storage bucket
clipboardexists - Check bucket policies allow public uploads
- Ensure bucket is set to public
- Update hardcoded storage URL in
src/App.jsx:156