A monorepo containing three services for dynamic container management and web app development.
This project consists of three main services:
- ClientApp - Next.js web application with three main windows
- ContainerGw - NestJS API gateway for container management
- AppContainer - Node.js service running inside Docker containers
- Node.js 18+
- pnpm
- Docker
- Docker Compose (optional)
# Install dependencies for all packages
pnpm install
# Build all packages
pnpm buildStart all services in development mode:
# Start all services in parallel
pnpm dev
# Or start individual services
pnpm start:client # Start ClientApp (Next.js)
pnpm start:gateway # Start ContainerGw (NestJS)
pnpm start:container # Start AppContainer (Node.js)# Build all packages
pnpm build
# Start in production mode
pnpm startSingle-page Next.js application with:
- Message Window: Displays system messages and notifications
- Terminal Window: Interactive terminal connected to container shell
- Preview Window: Embedded browser for viewing containerized web apps
Tech Stack:
- Next.js 14 with App Router
- TypeScript
- Tailwind CSS
- Socket.IO Client
- Turbopack for development
NestJS API gateway that manages Docker containers:
- Create/terminate containers
- WebSocket communication
- Container status monitoring
API Endpoints:
POST /api/containers- Create new containerDELETE /api/containers/:id- Terminate containerGET /api/containers/:id- Get container statusGET /api/containers- List all containers
WebSocket Events:
- Terminal I/O forwarding
- File transfers
- Zip file uploads
Tech Stack:
- NestJS
- TypeScript
- Socket.IO
- Dockerode
- ESLint
Node.js service running inside Docker containers:
- File system operations
- Terminal command execution
- Web app hosting on port 3000
- Zip file extraction
Features:
- Interactive shell access
- File upload/download
- Static web app serving
- npm/build script execution
- Create Container: ClientApp calls ContainerGw API
- WebSocket Connection: Direct communication between ClientApp and AppContainer
- File Transfer: Upload source code via zip files
- Terminal Access: Execute commands in container shell
- Web App Preview: View running applications in embedded browser
# Development
pnpm dev # Start all services in development
pnpm start:client # Start only ClientApp
pnpm start:gateway # Start only ContainerGw
pnpm start:container # Start only AppContainer
# Building
pnpm build # Build all packages
pnpm clean # Clean all build outputs
# Linting
pnpm lint # Lint all packagesPORT- Server port (default: 3001)
GATEWAY_URL- Container Gateway URL (default: http://localhost:3001)CONTAINER_ID- Unique container identifier
NEXT_PUBLIC_CONTAINER_GW_URL- Container Gateway URL for API calls
The ContainerGw service uses Docker to:
- Create containers from
node:alpineimage - Install npm and development tools
- Set up port forwarding (3000 for web apps)
- Manage container lifecycle
- Containers run in isolated environments
- File operations are sandboxed to container filesystem
- WebSocket connections are authenticated by container ID
- CORS is configured for development (modify for production)
- Install dependencies:
pnpm install - Start development servers:
pnpm dev - Make changes to packages in
packages/directory - Run linting:
pnpm lint - Build and test:
pnpm build