yaml

A definitive TypeScript parser and stringifier for YAML, supporting 1.1 and 1.2 with comment and CST access.

Library
npm
v2.9.1
1,692 stars
ISC

Repository Health

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

Technical Analysis

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

yaml is a JavaScript/TypeScript library for parsing and stringifying YAML, the human-friendly data serialization standard. It supports both the YAML 1.1 and 1.2 specifications and all common data schemas, passes the full yaml-test-suite, and can accept any string as input without throwing, parsing as much YAML out of it as it can. Unlike many YAML libraries that only expose a JSON.parse/JSON.stringify-style surface, yaml exposes three progressively deeper API layers: simple parse/stringify functions, a mutable Document/AST layer that preserves comments and blank lines for round-trip editing, and a raw Lexer/Parser/Composer pipeline for tools that need to work directly with YAML source. It has zero runtime dependencies, ships its own TypeScript types, runs on Node.js and in browsers, and includes a command-line tool for validating, lexing, and inspecting YAML streams.

What You Get

  • parse()/stringify() functions that mirror the JSON.parse/JSON.stringify API for drop-in YAML handling
  • A Document class that preserves comments, blank lines, and anchors so files can be edited and re-serialized without clobbering formatting
  • Full YAML 1.1 and 1.2 spec support, verified against the official yaml-test-suite
  • Direct access to the Lexer, Parser, and Composer layers for building custom YAML tooling
  • Zero runtime dependencies and bundled TypeScript types with no separate @types package needed
  • A command-line tool (npx yaml) for validating, lexing, and inspecting YAML streams from the shell

Common Use Cases

  • Loading and writing application configuration files (CI pipelines, Docker Compose, Kubernetes manifests, app configs)
  • Programmatically editing existing YAML files (e.g. bumping a version field) while preserving comments and formatting
  • Building developer tools that need to parse, lint, or transform YAML source, using the CST/Composer layers directly
  • Converting between YAML and JSON/JS objects in build scripts and data pipelines

Under The Hood

Architecture — yaml is organized as a strict pipeline of four layers, each exported independently for tools that need to stop early: a Lexer (src/parse/lexer.ts) turns raw source into lexical tokens; a Parser (src/parse/parser.ts, ~970 lines) builds a lossless Concrete Syntax Tree (CST) from those tokens, preserving every character including comments and whitespace; a Composer (src/compose/composer.ts) walks the CST and resolves it into a Document (src/doc/Document.ts) containing typed content nodes (YAMLMap, YAMLSeq, Scalar, Alias, Pair); and the top-level parse/stringify/parseDocument functions (src/public-api.ts) compose these stages into a JSON.parse/JSON.stringify-shaped convenience API. Because the CST retains full source fidelity, a Document can be mutated and re-stringified without losing comments or formatting, which is the library’s core architectural differentiator versus JSON-style YAML parsers.

Tech Stack — Written entirely in TypeScript (99.3% of the codebase) with a small JavaScript sliver, compiled via Rolldown, and published with zero runtime dependencies. Development tooling is Vitest for tests, ESLint (typescript-eslint) for linting, and Prettier for formatting; the package targets modern Node.js (^20.19 || ^22.12 || >=24) and ships as an ESM-only package with bundled .d.ts declarations, so no separate @types/yaml package is needed.

Code Quality — The tests/ directory contains 23+ dedicated test files covering the lexer, CST, line-counter, visit/traversal, directives, collection access, and full compliance against the official yaml-test-suite and a JSON test suite, in addition to per-module tests under tests/doc/. src/public-api.ts shows careful, explicit handling of JSON.parse/JSON.stringify-compatible overloads (reviver/replacer disambiguation, indent-as-number-or-string handling, keepUndefined option) rather than loose any-typed shortcuts. Error handling is centralized through a dedicated YAMLError/YAMLParseError/YAMLWarning hierarchy (src/errors.ts) with a prettifyError helper that attaches line/column context via LineCounter, rather than throwing raw exceptions.

API Design — The public surface deliberately mirrors JSON.parse/JSON.stringify (parse(src, reviver?, options?), stringify(value, replacer?, options?)) so migrating from JSON handling is close to a drop-in swap, while still layering in a mutable Document API and raw Lexer/Parser/Composer/CST exports for consumers who need deeper control. Documentation is extensive (docs/01_intro.md through docs/10_yaml_syntax.md plus a dedicated errors guide and CLI guide) and the root src/index.ts barrel file gives a single, well-organized entry point to the entire public API surface.

Used by 99 apps in this directory

TypeScript
71%
Apache 2.0

open-design

Design Tools

98,365

Local-first, open-source Claude Design alternative that turns your existing coding agent CLI into a full agentic design studio — with 259+ skills, 142+ design systems, and sandboxed artifact delivery across web, desktop, and mobile surfaces.

View details
85
Repo Health
86
Technical
72
Dependency
Built with
TypeScript 71%
HTML 22%
Updated 5 days ago
TypeScript
97%
GPL 3.0

OpenKnowledge

Code Editors · Knowledge Management · Note Taking

4,337

A beautiful, local-first markdown IDE that turns any git repo into a live collaborative workspace for humans and AI coding agents like Claude, Codex, and OpenCode.

View details
79
Repo Health
89
Technical
64
Dependency
Built with
TypeScript 97%
Updated 5 days ago
Python
37%
Other

Open WebUI

AI Agents · AI Assistants

153,390

The extensible, privacy-first AI platform that runs Ollama, OpenAI, and any LLM backend behind a polished, feature-packed web interface.

View details
91
Repo Health
75
Technical
66
Dependency
Built with
Python 37%
Svelte 34%
JavaScript 21%
Updated 5 days ago
TypeScript
99%
Other

openclaude

AI Agents · AI Code Assistants

33,554

Run Claude Code workflows against any LLM — OpenAI, Gemini, Ollama, and 200+ backends — from a single terminal-first CLI.

View details
85
Repo Health
78
Technical
71
Dependency
Built with
TypeScript 99%
Updated 1 weeks ago
TypeScript
91%
MIT

OpenClaw

AI Agents · AI Assistants

390,670

An open-source AI assistant that runs on your own hardware and meets you in Discord, Slack, WhatsApp, iMessage, Telegram, and 20+ other channels, with native apps for every major platform.

View details
88
Repo Health
88
Technical
68
Dependency
Built with
TypeScript 91%
Updated 5 days ago
Go
78%
Apache 2.0

OpenMeter

Developer Tools · Invoicing Finance

2,350

Open-source metering and billing engine for AI, agentic, and DevTool monetization — ingest usage events in real time and turn them into accurate invoices automatically.

View details
86
Repo Health
81
Technical
66
Dependency
Built with
Go 78%
TypeScript 17%
Updated 1 weeks ago
TypeScript
93%
MIT

OpenReel Video

Video Editors

5,211

A browser-based, GPU-accelerated video editor with multi-track timelines, color grading, and 4K export — no uploads, no installs, no watermarks.

View details
66
Repo Health
80
Technical
74
Dependency
Built with
TypeScript 93%
Updated 1 months ago
TypeScript
94%
Apache 2.0

Openship

Devops · Hosting Control Panel

12,979

Openship is an open-source, self-hostable deployment platform that points at a repo and builds, ships, routes, and TLS-terminates the app — driven from a desktop app, web dashboard, or CLI.

View details
84
Repo Health
85
Technical
65
Dependency
Built with
TypeScript 94%
Updated 6 days ago
TypeScript
96%
MIT

OpenWiki

Developer Tools

16,824

A LangChain-built CLI that writes and maintains codebase documentation automatically — generates an initial wiki, refreshes it as the repo changes, and can open a daily PR of documentation updates via GitHub Actions.

View details
82
Repo Health
66
Technical
87
Dependency
Built with
TypeScript 96%
Updated 6 days ago

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