NodeLabs is a full-stack application designed to create, manage, and interact with QEMU-based virtual machines through a simple and modern web interface. It leverages QEMU's efficient qcow2 overlay system for instant node creation and integrates with Apache Guacamole to provide seamless, in-browser console access to the virtual nodes.
Click the thumbnail above to watch the full project demonstration video.
Deployed Simulation (Frontend Only):
https://network-lab-chi.vercel.app/
if the above doesnt work as expected (like api errors etc), try the below links:
https://network-lab-git-frontend-simulation-sheikh162s-projects.vercel.app/
https://network-ibjc4i8zg-sheikh162s-projects.vercel.app/
β οΈ Note:
This deployment is an early frontend simulation of the project.
The current version demonstrates the user interface and workflow only β virtual machine creation and backend integrations (e.g., QEMU, Guacamole) are not yet functional, but can be used when installed locally (follow instructions below).
A full version with live VM management will be released later on the main branch.
π Development done, full deployment yet to complete
The
masterbranch contains the main backend-integrated version of the project.It will support:
- Creating and managing real VM instances
- QEMU-based virtualization
- Guacamole-powered browser console access
- Persistent node management and API control
A functional frontend-only simulation is already live for previewing the UI flow.
- Complete VM Lifecycle Management: Create, run, stop, wipe, and delete virtual nodes via a clean user interface.
- Efficient Disk Storage: Utilizes QEMU's qcow2 copy-on-write overlays, where each VM only stores its changes from a central base image, saving significant disk space.
- Integrated Web Console: Access the graphical console of any running VM directly from the browser, powered by an integrated Apache Guacamole stack.
- Concurrent Operations: Designed to run and manage multiple isolated virtual machines simultaneously, with automatic VNC port allocation.
- Containerized Architecture: The entire application stack (Next.js App, Guacamole, Database) is managed with Docker Compose for simplified setup and consistent deployment.
The platform consists of several key services orchestrated by Docker Compose:
- Next.js Application: A full-stack Next.js app serving both the React frontend and the backend API routes. It communicates with the host system to execute QEMU commands.
- QEMU: The core hypervisor responsible for running the VMs. It is installed as a dependency within the Next.js container.
- Guacamole Stack:
- guacamole: The web client that provides the browser-based terminal access.
- guacd: The native proxy that translates between the web client and the VM's VNC server.
- postgres: A PostgreSQL database used by Guacamole to store its connection configurations.
| Component | Technology |
|---|---|
| Framework | Next.js (React, API Routes) |
| Language | TypeScript |
| Styling | Tailwind CSS, shadcn/ui |
| Virtualization | QEMU |
| Remote Access | Apache Guacamole, VNC |
| Database | PostgreSQL |
| Containerization | Docker, Docker Compose |
Follow these instructions to set up and run the project locally.
- Docker and Docker Compose must be installed.
- QEMU must be installed on the host machine for local development (
npm run dev). - A Base QCOW2 Image: You need a base OS disk image from which to create your VM overlays.
git clone [https://github.com/Sheikh162/network-lab.git](https://github.com/Sheikh162/network-lab.git)
cd network-lab The application expects base disk images to be located in the base_images/ directory.
Create the directory in root of the project if it doesn't exist, along with overlays, data/nodes.json:
Bash
# Create required directories
mkdir -p base_images overlays data
# Initialize nodes.json with an empty array
echo '[]' > data/nodes.jsonPlace your .qcow2 image files inside this folder. You can create your own or download pre-built cloud images.
Example using a downloaded cloud image:
Bash
# Download a Cirros test image
wget [https://download.cirros-cloud.net/0.5.2/cirros-0.5.2-x86_64-disk.img](https://download.cirros-cloud.net/0.5.2/cirros-0.5.2-x86_64-disk.img)
# Rename and move it to the correct location
mv cirros-0.5.2-x86_64-disk.img base_images/cirros.qcow2Create a .env.local file in the project root by copying the example:
Bash
cp .env.example .env.localThe entire stack is defined in the docker-compose.yml file. Run the following command from the project root to build and start all services except Next.js:
Bash
docker-compose up --buildThis command will:
- Pull the required images for Postgres and Guacamole.
- Start all services.
Since the Next.js application is not managed by Docker Compose, you'll need to run it directly on your local machine.
First, install the necessary dependencies using your preferred package manager.
Install Dependencies:
Bash
npm installThis command reads the package.json file and installs all the required Node.js packages into the node_modules directory. Start the Development Server: Once the dependencies are installed, start the Next.js development server.
Bash
npm run devThe frontend application will now be running and accessible in your web browser, typically at http://localhost:3000
- Access the Frontend: Open your web browser and navigate to
http://localhost:3000/lab. - Create a Node: Select a base image from the dropdown menu and click "Add Node". This will create a new qcow2 overlay file for the VM.
- Run the Node: Click the "Run" button (play icon) on a stopped node. The backend will start a QEMU instance and automatically register it as a new connection in Guacamole.
- Open the Console: Once the node's status is "running", click the node's name or screen area. This will open the Guacamole interface, giving you direct remote access.
- Manage Nodes:
- Stop: Shuts down the VM process. The state of the disk is preserved.
- Wipe: Resets the node to its original state by deleting and recreating its overlay disk.
- Delete: Permanently removes the node and its associated overlay disk.
The backend exposes the following REST API for managing nodes:
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/nodes |
Retrieve a list of all nodes and their status. |
| POST | /api/nodes |
Create a new node and its overlay disk. |
| POST | /api/nodes/:id/run |
Start the VM for the specified node/run/route.ts . |
| POST | /api/nodes/:id/wipe |
Reset a node's overlay disk/wipe/route.ts . |
Each virtual node uses a copy-on-write overlay disk created with a command similar to this:
Bash
qemu-img create -f qcow2 -o backing_file=/path/to/base.qcow2 /overlays/node_<id>.qcow2This approach provides:
- Space Efficiency: Only changes from the base image are stored in each overlay.
- Quick Provisioning: New nodes are created in seconds.
- Easy Reset: Deleting and recreating an overlay restores the original state.
- Isolation: Each node operates independently without affecting others.
When a VM starts, the backend:
- Launches QEMU with VNC enabled on a unique, automatically-determined port.
- Makes an API call to the Guacamole service to automatically register the VNC connection in its database.
- Returns the unique Guacamole console URL to the frontend for one-click access.
network-lab/
βββ assets/ # Demo videos and other assets
βββ base_images/ # Base QEMU images (you must create this)
βββ data/ # Stores the nodes database (nodes.json)
βββ init/ # SQL initialization scripts for Guacamole DB
βββ overlays/ # Node overlay disks (auto-generated)
βββ public/ # Static assets for Next.js
βββ src/
β βββ app/ # Next.js App Router pages and API routes
β βββ components/ # React components
β βββ lib/ # Core backend logic (nodeManager, guacamoleService)
βββ docker-compose.yml # Service orchestration
βββ .env.local # Local environment variables (you must create this)
βββ .env.example # Example environment variables
βββ .gitignore
βββ README.md
The application is configured through environment variables in .env.local and docker-compose.yml.
GUACAMOLE_ADMIN_PASSWORD: Sets the password for theguacadminuser in Guacamole. By default, password isguacadmin.
- Ensure all services are running:
docker-compose ps - Check guacd logs for connection errors:
docker-compose logs -f guacd
Bash
# View logs for all services
docker-compose logs -f
# View logs for a specific service
docker-compose logs -f guacamole