Skip to content

md-786910/repl-editor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

18 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ REPL Editor - Cloud IDE & Code Execution Platform

A scalable, containerized cloud IDE and code execution platform similar to Replit, built with modern web technologies. This platform allows users to create, manage, and execute code in isolated Docker containers with real-time collaboration features.

πŸ“Έ Project Screenshots

Dashboard & Container Management

Container Management

Container Management
Monitor and control running environments

Main Dashboard

Main Dashboard
Overview of active containers and workspaces

Code Editor & Development Environment

Code Editor

Code Editor
Monaco editor with syntax highlighting

Template Selection

Template Selection
Choose from pre-configured environments


πŸ“‹ Table of Contents

✨ Features

  • Multi-Language Support: Create workspaces for React, Node.js, HTML/CSS/JS, and more
  • Containerized Execution: Isolated Docker containers for each user workspace
  • Real-time Code Editing: Live code editor with syntax highlighting
  • Template-based Setup: Quick start with pre-configured development environments
  • User Management: Session-based user workspaces with persistent storage
  • Container Management: Automatic container lifecycle management with idle cleanup
  • Web-based Dashboard: Intuitive React frontend for managing environments

πŸ›  Tech Stack

Frontend

  • React 18+ - bootstrap UI library
  • Vite - Fast build tool and dev server
  • vs code-server Editor - VS Code-like code editor

Backend

  • Node.js 20+ - JavaScript runtime
  • Express.js - Web application framework
  • Docker SDK - Container management
  • WebSocket - Real-time communication
  • cors - Cross-origin resource sharing

Infrastructure

  • Docker - Containerization platform
  • Docker Compose - Multi-container orchestration
  • Nginx - Reverse proxy (optional)

πŸ“‹ Prerequisites

Before setting up the project, ensure you have the following installed:

  • Node.js (v18.0.0 or higher)
  • npm or yarn package manager
  • Docker (v20.0.0 or higher)
  • Docker Compose (v2.0.0 or higher)
  • Git for version control

System Requirements

  • RAM: Minimum 4GB (8GB recommended)
  • Storage: At least 10GB free space
  • OS: Linux, macOS, or Windows with WSL2

πŸ“ Project Structure

└── repl-editor/
    β”œβ”€β”€ backend/                    # Node.js backend (API, container management, logic)
    β”‚   β”œβ”€β”€ src/
    β”‚   β”‚   β”œβ”€β”€ command/            # custom vs code extension
    β”‚   β”‚   β”œβ”€β”€ config/             # Starter template configuration port mapping & command etc
    β”‚   β”‚   β”œβ”€β”€ constant/           # Constant for application level
    β”‚   β”‚   β”œβ”€β”€ event/              # EvenEmiiter configuration and accessbility
    β”‚   β”‚   β”œβ”€β”€ init/               # initializtion of docker instance node at once singleton
    β”‚   β”‚   └── docker.js           # docker service manager for creating,termination
    β”‚   β”‚   └── index.js            # Express app configuration
    β”‚   β”‚   └── terminal.js         # Loging and attach to external editor docker logs/shell
    β”‚   β”œβ”€β”€ package.json
    β”‚
    β”œβ”€β”€ dockerfiles/                # Dockerfiles for each starter template/environment
    β”‚   β”œβ”€β”€ node-starter.Dockerfile
    β”‚   β”œβ”€β”€ react-starter.Dockerfile
    β”‚   β”œβ”€β”€ html-starter.Dockerfile
    β”‚
    β”œβ”€β”€ frontend/                   # React-based dashboard and UI for managing containers
    β”‚   β”œβ”€β”€ src/
    β”‚   β”‚   β”œβ”€β”€ components/         # Reusable React components
    β”‚   β”‚   └── api.js              # Managing api axios services
    β”‚   β”‚   └── config.js           # Managing config/env exporter
    β”‚   β”‚   └── App.jsx             # Main App component
    β”‚   β”œβ”€β”€ public/
    β”‚   β”œβ”€β”€ package.json
    β”‚   └── vite.config.js
    β”‚
    β”œβ”€β”€ starter_templates/          # Prebuilt starter templates
    β”‚   β”œβ”€β”€ react-starter/          # React + Vite setup
    β”‚   β”œβ”€β”€ node-starter/           # Node.js API/app
    β”‚   β”œβ”€β”€ html-starter/           # Plain HTML/CSS/JS
    β”‚
    β”œβ”€β”€ user_workspaces/            # Per-user workspace directories (mounted into containers)
    β”‚   β”œβ”€β”€ user-user-001/
    β”‚   β”œβ”€β”€ user-user-002/
    β”‚   └── ...
    β”‚
    β”œβ”€β”€ /                    # Utility scripts
    β”‚   β”œβ”€β”€ build_docker_starter.sh # Build all Docker starter images
    β”‚   └── run_app.sh              # Run the complete application
    β”‚
    β”œβ”€β”€ .gitignore                  # Git ignore rules
    β”œβ”€β”€ docker-compose.yml          # Multi-container setup
    β”œβ”€β”€ package.json                # Root package.json
    └── README.md                   # Project documentation

Directory Details

backend/

Contains the API server, user/session management, and logic for:

  • Spinning up and managing Docker containers
  • Container lifecycle management
  • Idle container cleanup and termination
  • WebSocket connections for real-time updates
  • File system operations within user workspaces

dockerfiles/

Stores individual Dockerfiles for different development environments:

  • node-starter.Dockerfile - Node.js development environment
  • react-starter.Dockerfile - React + Vite development setup
  • html-starter.Dockerfile - Static HTML/CSS/JS environment

frontend/

React-based dashboard that users interact with to:

  • Create new development environments
  • Manage existing containers
  • Access code editors
  • Monitor container status
  • Configure environment settings

starter_templates/

Contains boilerplate source code for new environments:

  • Ready-to-use project templates
  • Pre-configured development setups
  • Best practices and folder structures
  • Sample code and documentation

user_workspaces/

Per-user directories where each user's code lives:

  • Persistent storage for user projects
  • Mounted as volumes into Docker containers
  • Maintains file permissions and ownership
  • Automatic backup and cleanup policies

πŸš€ Quick Start

1. Clone the Repository

git clone https://github.com/md-786910/repl-editor.git
cd repl-editor

2. Make Scripts Executable

chmod +x build_docker_starter.sh
chmod +x run_app.sh

3. Build Docker Images

./build_docker_starter.sh

4. Install Dependencies

# Install root dependencies
npm install

# Install backend dependencies
cd backend && npm install && cd ..

# Install frontend dependencies
cd frontend && npm install && cd ..

5. Start the Application

./run_app.sh

6. Access the Application

πŸ’» Usage

Creating a New Workspace

  1. Access Dashboard: Navigate to the frontend dashboard
  2. Select Template: Choose from available starter templates
  3. Configure Environment: Set up your development environment
  4. Start Coding: Access the integrated code editor

Managing Containers

  • View Active Containers: Monitor running environments
  • Start/Stop Containers: Control container lifecycle
  • Resource Monitoring: Check CPU and memory usage
  • Cleanup: Remove idle or unused containers

Code Editing

  • vs code-server Editor: VS Code-like editing experience
  • Syntax Highlighting: Support for multiple languages
  • Auto-completion: Intelligent code suggestions
  • File Explorer: Navigate your project structure

Running in Development Mode

# Start backend in development mode
cd backend
npm run dev

# Start frontend in development mode (in another terminal)
cd frontend
npm run dev

Building for Production

# Build frontend
cd frontend
npm run build

# Build and start backend
cd backend
npm run build
npm start

Adding New Templates

  1. Added new Template to existing Directory:

    mkdir starter_templates/new-template
  2. Add Dockerfile:

    touch dockerfiles/new-template.Dockerfile
  3. Update Build Script: Edit scripts/build_docker_starter.sh to include the new template

  4. Test Template:

    ./scripts/build_docker_starter.sh

🀝 Contributing

  1. Fork the Repository
  2. Commit Changes: git commit -m 'Add amazing feature'
  3. Push to Branch: git push origin feature/amazing-feature
  4. Open Pull Request

Development Guidelines

  • Follow ESLint and Prettier configurations
  • Write tests for new features
  • Update documentation as needed
  • Use conventional commit messages

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support


πŸ“Š Project Status

Build Status License Version Contributors

Happy Coding! πŸŽ‰

About

Repl code editor

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors