Codelet logoCodelet

Introduction

A minimal web IDE for the browser — a full VS Code-shaped workbench, or just the code editor inside it, built on CodeMirror

codelet is a minimal web IDE for the browser, built on CodeMirror. The Workbench is the whole of it: a VS Code-shaped shell with a file tree, tabs, breadcrumbs, a command palette, a panel and extensions, mounted into a DOM element you already control. No CSS file, no build step of its own.

The editor inside it also ships on its own, as Editor, for a page that needs one code field rather than an IDE — a config box, a snippet, a single file in a playground. Everything else in this guide is about the workbench.

Workbench (codelet/workbench)Editor (codelet)
ShowsA file tree, tabs, a panel and a command paletteOne code field
Good forAn in-browser IDE, a course platform, a code review toolA config field, a code snippet, a single-file playground
GuideWorkbenchStandalone editor

#See it running

That is a real Workbench, with a file tree, tabs, a Search view and TypeScript hovers and diagnostics — nothing on a server. Open the tree, edit a file, press Mod-P.

#Installation

npm i codelet

react and vue are optional peer dependencies. Install one only if you use the codelet/react or codelet/vue wrapper.

#Package entries

Every package below is a separate entry point, so a page only ships what it imports.

#Core

EntryWhat it gives you
codeletEditor, the standalone code editor, and renderEditorHTML for server rendering
codelet/themesrangi's own themes, converted to Theme objects

#Framework wrappers

EntryWhat it gives you
codelet/react<CodeEditor />, a React wrapper around Editor
codelet/vue<CodeEditor />, the same wrapper for Vue

#Workbench

EntryWhat it gives you
codelet/workbenchWorkbench, the VS Code-shaped shell, and FileSystem
codelet/workbench/serverrenderWorkbench(), the shell's markup for a server
codelet/extensionsthe extension API: a subset of the vscode namespace, plus defineExtension

#Built-in extensions

EntryWhat it gives you
codelet/extensions/searchthe sidebar Search view
codelet/extensions/extensionsthe Extensions view: what the workbench is running, with a button to stop and restart each one
codelet/extensions/vsixOpen VSX marketplace search, with a .vsix unpacked and run in the page
codelet/extensions/logsa Logs tab in the panel, capturing console output and errors
codelet/extensions/terminala terminal tab in the panel
codelet/extensions/terminal/just-basha shell to run in that terminal, over the workbench's own files
codelet/extensions/webcontainerNode itself, in the terminal, over a filesystem kept in step with the workbench's
codelet/extensions/chata chat side bar backed by WebLLM, with tools over the filesystem and a shell
codelet/extensions/livea workspace shared with whoever opens a link
codelet/extensions/mediaimage, video and audio preview tabs
codelet/extensions/npmthe workspace's package.json scripts, runnable as tasks
codelet/extensions/tasksan activity bar pane listing whatever tasks are available to run
codelet/extensions/settingsthe reader's settings as an editable tab
codelet/extensions/tardownloads any folder in the tree as a .tar.gz
codelet/extensions/githubopens any repository from GitHub in the workbench
codelet/extensions/scma Source Control pane in the activity bar
codelet/extensions/markdowna rendered Markdown preview, beside the file
codelet/extensions/htmlan HTML preview, beside the file, sandboxed until you trust it
codelet/extensions/remotea real filesystem behind the tree, backed by a server
codelet/extensions/lspthe language client: diagnostics, go-to-definition, hover, completion, signature help
codelet/extensions/lsp/typescripta TypeScript language server, running in a worker
codelet/extensions/lsp/css, /html, /json, /markdownlanguage servers for those languages

#Server

EntryWhat it gives you
codelet/serverthe other end of codelet/extensions/remote: a file server for one directory

#Bundle size

Measured minified and gzipped, with pnpm size:

BuildSize
Editor alone120.7 kB
Workbench217.3 kB
Workbench with every built-in extension319.2 kB

Extensions are opt-in and tree-shaken: a workbench that never imports the terminal, chat or any other extension pays nothing for it. The last row is every extension bundled at once, not what a typical page ships.

#Where to go next