An interactive terminal that runs in the browser using WebSockets, built with Node.js and xterm.js.
- Real-time terminal interaction via WebSockets.
- Supports full terminal interactivity (e.g., Vim, Nano).
- Options for shared or individual terminal sessions.
- Node.js - v16 or higher.
- NPM
The project consists of two parts, the backend (Node.js server) and the frontend (xterm.js terminal interface), just like a typical web application.
-
Clone this repository:
git clone https://github.com/EDDYMENS/interactive-terminal.git
-
Navigate to the project directory:
cd interactive-terminal
-
Install dependencies:
npm install
-
Start the server:
npm run start
-
The demo runs on port
6060
by default. You can modify this by editing the port number in the configuration section of the/src/server.js
file.
The frontend automatically loads in your browser at http://localhost:6060
when the server starts. The client-side code is located in /src/client.js
.
- Port Configuration: To change the default port, update the port number in the
/src/server.js
file. - Shared or Individual Sessions: The terminal can either run as a shared session for all users or create an individual session per user. This can be configured by setting the boolean value of
setSharedTerminalMode(false);
inserver.js
.
For a detailed breakdown of how the different parts of this code work and how to extend the functionality, refer to the complete tutorial on Eddymens.com.
- Introduced the option for both shared and individualized sessions.
- Cosmetic changes and restructuring of the demo code.
- Added support for copy-pasting in the terminal.
- Enabled full terminal interactivity (e.g., Vim support).
- Initial release.
This project is licensed under the MIT License. See the LICENSE file for details.