A production-ready, browser-based code editor built with React, TypeScript, and Monaco Editor. Features a VS Code-like interface with multi-language support, real-time preview, GitHub Gist integration, and modern development tools.
- Monaco Editor Integration - Full VS Code editing experience with IntelliSense
- Multi-language Support - JavaScript, TypeScript, HTML, CSS, Python, Go, Rust, Java, and more
- File Management - Create, rename, delete files and folders with drag-and-drop
- Tabbed Interface - Open multiple files with unsaved indicators
- Live Preview - Real-time HTML/CSS/JS preview with console output
- Terminal Integration - Built-in terminal with xterm.js for logs and output
- Dark/Light Themes - Beautiful themes with Monaco editor synchronization
- GitHub Gist Integration - Save and load workspaces to/from GitHub Gists
- Workspace Persistence - Auto-save to localStorage with export/import
- Code Formatting - Prettier integration with format-on-save
- Keyboard Shortcuts - Full keyboard navigation and VS Code-style shortcuts
- Settings Panel - Customizable editor preferences and behavior
- React + TypeScript - Type-safe, component-based architecture
- Vite - Lightning-fast development and optimized builds
- Tailwind CSS - Utility-first styling with consistent design system
- Responsive Design - Works seamlessly on desktop, tablet, and mobile
- Node.js 16+ and npm/yarn
- Modern browser with ES2020 support
# Clone the repository
git clone https://github.com/your-username/web-editor.git
cd web-editor
# Install dependencies
npm install
# Start development server
npm run dev
The editor will open at http://localhost:5173
File Management:
- Create files: Click the "+" button in the explorer
- Create folders: Click the folder icon in the explorer
- Rename: Right-click file/folder β Rename
- Delete: Right-click file/folder β Delete
Editing:
- Open files by clicking in the explorer
- Multiple tabs support with unsaved indicators (β’)
- Auto-completion and syntax highlighting
- Format code:
Ctrl/Cmd + Shift + F
Preview:
- Click the play button to start live preview
- HTML/CSS/JS files are automatically combined
- Console output appears in the terminal panel
- Supports responsive preview and external links
Shortcut | Action |
---|---|
Ctrl/Cmd + S |
Save current file |
Ctrl/Cmd + B |
Toggle file explorer |
Ctrl/Cmd + Shift + J |
Toggle terminal |
Ctrl/Cmd + P |
Quick file search (Monaco) |
Ctrl/Cmd + Shift + F |
Format code |
Ctrl/Cmd + / |
Toggle line comment |
Alt + Click |
Multi-cursor |
-
Setup:
- Go to GitHub Settings β Personal Access Tokens
- Generate token with
gist
scope - Enter token in the GitHub Gist modal
-
Save Workspace:
- Click GitHub icon in toolbar
- Enter description and set visibility
- Click "Save to Gist"
-
Load Workspace:
- Get Gist ID from URL (e.g.,
abc123def456
) - Enter ID in "Load from Gist" field
- Click "Load"
- Get Gist ID from URL (e.g.,
src/
βββ components/ # React components
β βββ EditorShell.tsx # Main layout container
β βββ FileExplorer.tsx # File tree navigation
β βββ MonacoEditor*.tsx # Editor integration
β βββ PreviewPanel.tsx # Live preview iframe
β βββ TerminalPanel.tsx # Console/terminal
β βββ ...
βββ lib/ # Core utilities
β βββ fileSystem.ts # File operations
β βββ gistApi.ts # GitHub API client
β βββ workspacePersistence.ts # localStorage
β βββ ...
βββ types/ # TypeScript definitions
βββ hooks/ # Custom React hooks
βββ styles/ # Tailwind CSS
- Monaco Editor - VS Code's editor engine
- xterm.js - Terminal emulation
- Prettier - Code formatting
- JSZip - Workspace export/import
- GitHub API - Gist integration
Uses React hooks and context for state management:
EditorShell
- Main application stateThemeProvider
- Theme contextuseLocalStorage
- Persistent preferences
# Install Vercel CLI
npm i -g vercel
# Build and deploy
npm run build
vercel --prod
# Build project
npm run build
# Deploy dist/ folder to Netlify
# Or connect GitHub repo for automatic deployments
# Install gh-pages
npm install --save-dev gh-pages
# Add to package.json scripts:
# "deploy": "gh-pages -d dist"
# Build and deploy
npm run build
npm run deploy
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
EXPOSE 5173
CMD ["npm", "run", "preview"]
VITE_GITHUB_CLIENT_ID=your_github_client_id
VITE_APP_VERSION=1.0.0
Themes: Modify src/lib/themeManager.ts
Languages: Add language definitions in src/lib/fileSystem.ts
Shortcuts: Update keyboard handlers in src/components/EditorShell.tsx
npm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
npm run lint # Run ESLint
npm run type-check # TypeScript checking
- Add language to
getLanguageFromExtension()
infileSystem.ts
- Ensure Monaco supports the language (most are built-in)
- For custom languages, register with Monaco editor
- Language Servers: Implement
monaco-languageclient
integration - Extensions: Create plugin system in
src/lib/extensions.ts
- Collaboration: Add real-time sync with WebSockets
- AI Integration: Connect to code completion APIs
- Sandboxed iframe for preview execution
- Sanitized HTML/CSS/JS content
- No arbitrary code execution on main thread
- Tokens stored in localStorage (encrypt in production)
- Scoped permissions (gist access only)
- No server-side token storage
- Language Servers: Limited to Monaco's built-in IntelliSense
- File System: Browser localStorage has size limits (~5-10MB)
- Preview: Only supports front-end technologies
- Collaboration: No real-time collaboration features
- Extensions: No VS Code extension compatibility
- Vim/Emacs key bindings
- Split editor views
- Advanced search and replace
- Project templates
- Language server protocol integration
- Real-time collaboration
- Plugin system architecture
- Git integration
- Container-based code execution
- AI-powered code completion
- Advanced debugging tools
- Team workspaces
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
git clone https://github.com/your-username/web-editor.git
cd codeharbor-web-editor
npm install
npm run dev
MIT License - see LICENSE for details.
- Monaco Editor - Microsoft's excellent web editor
- Tailwind CSS - For the beautiful, utility-first styling
- React Team - For the amazing framework
- Vite - For the lightning-fast build tool
- π Bug Reports: GitHub Issues
- π‘ Feature Requests: GitHub Discussions
- π§ Email: [email protected]
- π¬ Discord: CodeHarborHub Community
Built with β€οΈ by the CodeHarborHub team