ShellSync transforms your terminal into an interactive, real-time collaborative canvas. Instantly share your terminal session with anyone, anywhere, right in their browser. Perfect for pair programming, debugging sessions, live demos, and educational purposes.
_____ _ _ _ _____
/ ___|| | | || |/ ___|
\ `--. | |__ ___ | || |\ `--. _ _ _ __ ___
`--. \| '_ \ / _ \| || | `--. \| | | || '_ \ / __|
/\__/ /| | | || __/| || |/\__/ /| |_| || | | || (__
\____/ |_| |_| \___||_||_|\____/ \__, ||_| |_| \___|
__/ |
|___/
- Real-Time Collaboration: Share your terminal session live with multiple users. Keystrokes and output are synced instantly for everyone.
- Infinite Canvas Interface: Say goodbye to traditional tabbed interfaces. Arrange terminals on an infinite, pan-and-zoom canvas.
- Draggable & Resizable Terminals: Move and resize terminals anywhere on the canvas to create the perfect layout for your needs.
- Cross-Platform Agent: A single, lightweight command-line agent written in Go that runs on macOS, Windows, and Linux.
- Web-Based Client: Collaborators don't need to install a thing. They can join from their web browser with a simple URL.
- Self-Hostable: Control and run the entire stack on your own infrastructure, ensuring your data remains private and secure.
ShellSync uses a three-component architecture optimized for performance, scalability, and ease of use.
graph TD
subgraph Your_Machine
A[Go Agent]
end
subgraph Your_Server
B[gRPC Server]
C[Go Backend]
D[WebSocket Hub]
end
subgraph Collaborators
E[Browser 1]
F[Browser 2]
G[Browser N]
end
%% Connections
A -->|PTY Output gRPC| B
B -->|PTY Input gRPC| A
B <--> C
C <--> D
E <-->|WebSocket| D
F <-->|WebSocket| D
G <-->|WebSocket| D
%% Flow annotations
A -.->|1. Connects via gRPC| B
C -.->|2. Creates Session| A
A -.->|3. Provides Sharable URL| E
E -.->|4. Joins via WebSocket| D
- The Agent (Go): A command-line tool you run on your machine. It creates a local shell process (PTY) and securely streams the terminal input/output over a high-performance gRPC connection to the backend.
- The Backend (Go): The central hub of the system. It handles gRPC connections from agents, WebSocket connections from web clients, and manages session state. It takes output from the agent and broadcasts it to all connected browsers in that session.
- The Frontend (React): A modern, web-based interface that provides the infinite canvas where terminals are displayed. It communicates with the backend over WebSockets to provide a seamless, real-time experience.
| Component | Technology |
|---|---|
| Frontend | React, Next.js, TypeScript, Tailwind CSS, Xterm.js |
| Backend | Go, Gorilla WebSocket, Gorilla Mux |
| Agent | Go, Cobra (for CLI), gRPC |
| Communication | gRPC (Agent ↔ Backend), WebSockets (Backend ↔ Frontend) |
| API Definition | Protobuf |
Follow these instructions to get ShellSync up and running locally.
- Go 1.21+
- Node.js 18+ and npm
protoc(Protocol Buffers compiler)
-
Clone the repository:
git clone https://github.com/your-username/shellsync.git cd shellsync -
Generate Protobuf Code: The project uses a
Makefileto simplify tasks. Generate the necessary Go and gRPC code from the.protofile.make proto
-
Install Frontend Dependencies:
cd frontend npm install cd ..
-
Install Backend Dependencies:
go mod tidy
-
Start the Backend Server:
make run-server
This will start the gRPC and WebSocket server on ports
5001and5000respectively. -
Run the Agent (in a new terminal):
make run-client
The agent will connect to the server, create a session, and output a sharable URL.
-
Start Collaborating: Open the URL provided by the agent in your web browser. Share this URL with others to have them join your session instantly.
You can use the Makefile to build production-ready binaries.
-
Build the Server:
make build-server
The binary will be placed in
bin/server. -
Build the Client (Agent): The
build-clientcommand is a powerful cross-compiler that builds the agent for multiple operating systems and architectures.make build-client
The binaries will be placed in the
bin/directory, ready for distribution.
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.
