🔥 What is HackPair?
HackPair is a self-hosted, real-time code collaboration tool built for hackathon teams. It lets you and your teammates code together from anywhere — seeing each other's cursors, edits, and files in real-time.
One command to start. One extension to connect. That's it.
┌─────────────────────────────────────────────────────────┐
│ │
│ Leader runs: npx hackpair │
│ ↓ │
│ Team connects via VS Code extension │
│ ↓ │
│ Everyone sees each other's code & cursors │
│ │
└─────────────────────────────────────────────────────────┘
✨ Features
🔴 Live Cursors
See where your teammates are working with colored cursor labels in your editor
|
📝 Real-Time Sync
Code edits sync instantly across all connected team members
|
👥 Team Awareness
See who's online, what file they're on, and their activity
|
🔒 100% Private
Your code never leaves your machine. No cloud. No telemetry. No tracking.
|
⚡ Zero Config
No Docker, no database setup, no accounts. Just run and go.
|
🔄 Auto-Reconnect
Extension remembers your room. Reopen VS Code → back in the team instantly.
|
🚀 Quick Start
Prerequisites
- Node.js 18+ installed on leader's machine
- VS Code installed on all team members
1. Leader: Start the Server
# Clone or download HackPair
git clone https://github.com/Hussaincodes01/hackpair.git
cd hackpair
# Start the server
npx tsx packages/server/src/index.ts
You'll see:
╔══════════════════════════════════════╗
║ HackPair v0.1.0 ║
║ Real-time code collaboration ║
╚══════════════════════════════════════╝
Server running at:
→ http://192.168.1.100:3001
Share this URL with your team.
They connect via the VS Code extension.
Press Ctrl+C to stop.
Copy the URL — your team needs it to connect.
2. Team: Install the Extension
Download hackpair-0.1.0.vsix from the leader, then:
code --install-extension hackpair-0.1.0.vsix
3. Team: Connect & Join
- Open VS Code
- Click the HackPair icon in the sidebar (left panel)
- Click "Connect" → Enter the server URL your leader shared
- Click "Join" → Enter your display name
- Click "Create Room" (if you're the first) or enter the invite code
Done! You're now collaborating in real-time.
🎯 How It Works
┌──────────────┐ ┌──────────────┐
│ Alice's │ │ Bob's │
│ VS Code │ │ VS Code │
└──────┬───────┘ └──────┬───────┘
│ │
│ ┌──────────────┐ │
└────┤ HackPair ├─────┘
│ Server │
│ (Leader's │
│ Machine) │
└──────────────┘
Each member:
- Connects to the leader's server via WebSocket
- Broadcasts their cursor position and code edits
- Receives updates from all other members
- Sees colored cursors for each teammate
🎨 What You'll See
┌─────────────────────────┐
│ ⚡ HackPair │
├─────────────────────────┤
│ 🏠 My Team │
│ │
│ Invite Code: ABC123 │
│ [Click to copy] │
│ │
│ Team Online (3) │
│ ───────────────── │
│ 🔵 Alice (you) │
│ 🟢 Bob │
│ 🟡 Charlie │
│ │
│ [Leave Room] │
└─────────────────────────┘
Editor (with teammates)
1 │ import { createApp } from 'vue';
2 │ import App from './App.vue';
3 │ ←── 🟢 Bob is here
4 │ const app = createApp(App);
5 │ app.mount('#app');
6 │
🌐 Network Options
Same WiFi (Local Network)
Leader shares their local IP (shown in terminal):
http://192.168.1.100:3001
Over Internet (Remote Team)
Use ngrok to expose your server:
npx ngrok http 3001
This gives you a public URL like:
https://abc123.ngrok.io
🛠️ Project Structure
hackpair/
├── packages/
│ ├── server/ # Fastify + Socket.io server
│ │ └── src/
│ │ ├── index.ts # Server entry point
│ │ ├── database.ts # SQLite (sql.js, zero native deps)
│ │ ├── routes/api.ts # REST API
│ │ └── socket/handler.ts # Real-time WebSocket handler
│ │
│ ├── extension/ # VS Code extension
│ │ └── src/
│ │ ├── extension.ts # Main activation
│ │ ├── socket-client.ts # WebSocket client
│ │ ├── cursor-manager.ts # Remote cursor display
│ │ └── sidebar.ts # Webview sidebar panel
│ │
│ ├── shared/ # Shared types & schemas
│ └── cli/ # CLI packaging
│
├── packages/extension/
│ └── hackpair-0.1.0.vsix # Installable extension
│
└── package.json
⚙️ Tech Stack
| Component |
Technology |
Why |
| Server |
Fastify |
Fast, lightweight HTTP framework |
| Real-time |
Socket.io |
Reliable WebSocket with auto-reconnect |
| Database |
sql.js |
SQLite in pure WASM — zero native deps |
| CRDT |
Y.js |
Conflict-free real-time collaboration |
| Extension |
VS Code API |
Native IDE integration |
| Language |
TypeScript |
End-to-end type safety |
🔧 Development
# Clone the repo
git clone https://github.com/Hussaincodes01/hackpair.git
cd hackpair
# Install dependencies
npm install
# Build shared types
npm run build --workspace=packages/shared
# Start server in dev mode
npm run dev --workspace=packages/server
# Build extension
npm run build --workspace=packages/extension
📋 API Reference
REST Endpoints
| Method |
Endpoint |
Description |
POST |
/api/rooms |
Create a new room |
GET |
/api/rooms/:id |
Get room details |
POST |
/api/rooms/:id/join |
Join a room |
GET |
/api/rooms/lookup?code=XXX |
Find room by invite code |
GET |
/api/rooms/:id/activity |
Get room activity |
GET |
/api/rooms/:id/progress |
Get team progress |
WebSocket Events
| Event |
Direction |
Description |
code:edit |
Both |
Code content changed |
cursor:move |
Both |
Cursor position changed |
presence:file |
Both |
Active file changed |
presence:join |
Server → Client |
Teammate joined |
presence:leave |
Server → Client |
Teammate left |
event:log |
Both |
File created/deleted |
🤝 Contributing
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Commit your changes
- Open a Pull Request
📄 License
MIT License — see LICENSE for details.