Monaco Editor

The browser-based code editor that powers VS Code, embeddable in any web application.

Library
npm
v0.57.0
46,817 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
92 /100 Excellent
Development Activity 96
Maintenance 96
Community 76
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
81 /100 Excellent
Architecture 88
Code Quality 80
Innovation 85
Learning Curve 72

Monaco Editor is the code-editing component extracted directly from Visual Studio Code, giving web applications the same editing experience — IntelliSense, syntax highlighting, multi-cursor editing, and a diff viewer — that millions of VS Code users rely on every day.

It ships as an ESM (or legacy AMD) bundle with rich language support for TypeScript, JavaScript, JSON, CSS, and HTML out of the box, plus a monaco.languages API for registering tokenizers, completion providers, and hover providers for any language you need. Because it’s generated straight from VS Code’s source, its behavior, keybindings, and theming stay in lockstep with the editor developers already know.

What You Get

  • A fully-featured code editor component with IntelliSense, multi-cursor editing, code folding, and minimap navigation
  • Built-in language support for TypeScript, JavaScript, JSON, CSS, and HTML, plus dozens of syntax-highlighted languages via Monarch tokenizers
  • A side-by-side and inline diff editor for reviewing and merging changes
  • ESM and legacy AMD builds, plus a community webpack plugin for trimming the bundle to only the languages and features you use

Common Use Cases

  • Embedding a full code editor into a web-based IDE or REPL (e.g. Codesandbox-style products)
  • Adding a JSON/YAML config editor with schema validation to an admin dashboard
  • Building a diff/review UI for comparing generated or user-submitted code

Under The Hood

Architecture Monaco Editor is architecturally split into two layers: monaco-editor-core (built directly from VS Code’s src/vs/editor sources and published as a separate npm package) provides the core text-editing engine, model/URI system, and rendering, while this package (src/editor.ts, src/index.ts) layers language-specific features on top by importing feature registration modules from src/features/register.all.ts (find, folding, hover, codeLens, diffEditor, and roughly 50 other feature modules) and language definitions from src/languages/definitions/ (84 Monarch-based tokenizers for languages like abap, apex, yaml, and csharp). The build pipeline (build/build-monaco-editor.ts, gulpfile.js) compiles src/ with TypeScript and bundles ESM output plus a legacy AMD/min build for browser <script> consumption, with monaco.d.ts as the sole versioned public API surface. A companion package, monaco-lsp-client (its own directory with its own package.json/build), bridges Monaco to Language Server Protocol servers.

Tech Stack The editor itself is TypeScript compiled to ES5-targeted, strict-mode output (src/tsconfig.json: target es5, strict true, custom @/* path alias), with 41.68% of the codebase in TypeScript and 56.88% in JavaScript (much of the JS is generated/bundled core rather than hand-written source). Build tooling includes esbuild, rollup (with @rollup/plugin-alias and @rollup/plugin-node-resolve), Parcel for the samples, and clean-css/postcss-url for the CSS pipeline; monaco-editor-core is pinned to a specific nightly VS Code build via the vscodeRef commit hash in package.json, which is the actual mechanism keeping Monaco in sync with VS Code.

Code Quality Testing is narrow but targeted: language definitions each ship a co-located .test.ts (84 language folders, e.g. src/languages/definitions/yaml/yaml.test.ts, src/languages/definitions/csharp/csharp.test.ts) run via Node’s built-in test runner (npm run test:grammars uses —test against src/languages/definitions//*.test.ts), and a separate Playwright-based smoketest suite (test/smoke/) validates the packaged webpack/esbuild/vite bundles end-to-end in a browser rather than unit-testing editor internals directly — reasonable given the core editor logic is inherited from VS Code’s own, separately tested codebase. Formatting is enforced via Prettier + pretty-quick on a Husky pre-commit hook (.husky/, .prettierrc), and check-samples.ts validates that all documented samples actually build.

API Design The public API is exposed entirely through monaco.d.ts, which the README explicitly calls out as the only versioned contract — everything else is private and can break between releases, an unusually disciplined API-surface policy for a project this size. Getting started is a single monaco.editor.create(domElement, options) call, and the model/URI abstraction (docs/integrate-esm.md, README’s ‘Concepts’ section) gives a clean mental model for multi-file editing scenarios. The tradeoff is a nontrivial bundling story: because the editor ships as raw ESM/AMD source rather than a single pre-bundled file, consumers need a bundler-specific integration (webpack plugin, Vite config, or manual worker setup for language services), which the docs address with dedicated per-bundler sample projects (samples/browser-esm-webpack, browser-esm-vite, browser-esm-parcel, and others) rather than a single copy-paste snippet.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers