toml-node

A zero-dependency, spec-compliant TOML parser for Node.js with BigInt and Temporal support.

Library
npm
v5.0.0
327stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
57/100Fair
Development Activity60
Maintenance36
Community52
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
73/100Good
Architecture80
Code Quality72
Innovation85
Learning Curve55

toml is a TOML parser for Node.js that scores 702/708 (99.2%) on the official toml-test compliance suite, covering the full TOML v1.1.0 specification including dotted keys, inline tables, array of tables, and multiline strings. It ships with zero runtime dependencies, requires Node.js 20 or later, and is built on the Peggy parser generator, which compiles a PEG grammar (src/toml.pegjs) into the parser at build time.

Beyond spec compliance, the library is deliberately careful about lossless data representation: integers outside JavaScript’s safe integer range throw by default rather than silently rounding, with an opt-in bigint mode to parse the full 64-bit range exactly, and date/time values can be returned as native Temporal objects instead of Date/strings. Recent releases have also patched a prototype-pollution vulnerability (CVE-2026-63376) and a stack-overflow denial-of-service on deeply nested input, with nesting depth now bounded and configurable via maxDepth.

What You Get

  • A single parse(input, options) function that turns TOML text into plain JavaScript objects
  • Full TOML v1.1.0 spec support: dotted/quoted keys, inline tables, arrays of tables, multiline strings
  • Lossless 64-bit integer handling via an opt-in bigint mode instead of silent rounding
  • Optional Temporal output for date/time values, with a polyfill fallback for runtimes without native Temporal
  • Bundled TypeScript type definitions (index.d.ts)

Common Use Cases

  • Loading .toml configuration files for CLI tools and Node.js applications
  • Parsing Cargo.toml, pyproject.toml, or other TOML-based manifests programmatically
  • Validating TOML documents against the spec before writing them to disk
  • Migrating configuration from JSON/YAML to TOML in a Node.js build pipeline

Under The Hood

Architecture index.js is a thin entry point that delegates to lib/parser.js (generated by Peggy from the src/toml.pegjs grammar) and lib/compiler.js (a hand-written semantic reducer). The parser produces a typed AST (Assign, ObjectPath, ArrayPath, Integer, Array, InlineTable, Date-family nodes), and compiler.js’s compile() walks that AST with closure-scoped state (assignedPaths/valueAssignments/explicitTablePaths Sets plus a WeakSet of “owned” containers) to enforce TOML’s redefinition rules and guard against prototype-pollution-style key traversal, producing a plain object tree rooted in Object.create(null) tables. This two-stage grammar-parse-then-semantic-reduce split cleanly separates syntax from TOML’s table/array redefinition semantics; changes to the core compile reducer would ripple through every value type.

Tech Stack Plain CommonJS JavaScript with no runtime dependencies; devDependencies are limited to peggy (compiles the .pegjs grammar into lib/parser.js at build time via npm run build) and @js-temporal/polyfill (used to exercise Temporal support in tests on runtimes lacking a native Temporal global). Tests run on Node’s built-in node:test/node:assert rather than an external framework, and CI (.github/workflows/ci.yml) runs the unit suite plus the official toml-test spec suite across Node 20/22/24.

Code Quality test/test_toml.js exercises parsing behavior with deepStrictEqual fixture comparisons against real TOML files (test/*.toml) and includes explicit regression tests for the prototype-pollution fix (rejectsWithoutObjectPrototypeMutation). test/spec-test.js runs the external toml-test compliance suite. Errors are never swallowed: both the parser and compiler throw Error instances augmented with line/column via a shared genError helper. The project uses plain JS with a hand-authored .d.ts rather than TypeScript, and a legacy .jshintrc rather than a modern linter/formatter, but CI enforces both build and test on every push across three Node versions.

API Design The public surface is a single function, toml.parse(input, options), with no class instantiation or required configuration for the common case. Advanced behavior (bigint, useTemporal/temporal, maxDepth) is opt-in and orthogonal, and each option is documented in the README with a runnable example. Thrown errors carry line and column properties, making them easy to surface in editor tooling or CLI diagnostics, and TypeScript types ship with the package despite the implementation itself being plain JavaScript.

Used by 6 apps in this directory

TypeScript
98%
Other

Dokploy

Devops · Hosting Control Panel · Security

37,130

Self-hosted PaaS that deploys apps and databases on your own VPS using Docker, Traefik, and multi-build-system orchestration

View details
88
Repo Health
76
Technical
64
Dependency
Built with
TypeScript98%
Updated 3 days ago
Python
63%
BSD 3

Flagsmith

Developer Tools · Devops · Ab Testing Experimentation

6,539

Open-source feature flagging, remote config, and A/B/multivariate testing platform for web, mobile, and server-side apps — self-host or use the hosted SaaS.

View details
90
Repo Health
82
Technical
63
Dependency
Built with
Python63%
TypeScript31%
Updated 2 days ago
TypeScript
38%
Apache 2.0

Label Studio

AI Development · Data Engineering

28,222

Label Studio is an open-source, multi-type data labeling platform that lets teams annotate images, text, audio, video, and time series data with a configurable XML-based UI and export annotations in formats ready for any ML framework.

View details
93
Repo Health
87
Technical
67
Dependency
Built with
TypeScript38%
JavaScript27%
Python25%
Updated today
TypeScript
77%
AGPL 3.0

massCode

Developer Tools · Productivity · Code Editors

6,977

A free, local-first developer workspace unifying snippets, notes, HTTP requests, calculations, drawings, and dev tools in one desktop app.

View details
87
Repo Health
87
Technical
62
Dependency
Built with
TypeScript77%
Vue22%
Updated yesterday
Python
99%
Apache 2.0

Rasa Open Source

AI Assistants · AI Development

21,315

Rasa Open Source is a Python machine learning framework for building contextual, multi-turn chatbots and voice assistants that understand natural language and maintain conversation state.

View details
65
Repo Health
78
Technical
63
Dependency
Built with
Python99%
Updated 1 months ago
Rust
93%
Other

Tabby

AI Code Assistants

33,868

Self-hosted AI coding assistant — run GitHub Copilot-grade code completion on your own hardware with no cloud dependency.

View details
60
Repo Health
78
Technical
61
Dependency
Built with
Rust93%
Updated 2 months 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

Search