Skip to content

SylphxAI/molt

πŸš€ Molt

CI License: MIT Bun Turbo

High-performance data transformation stack for JSON, YAML, TOML, INI, CSV, XML, MessagePack, and TOON.

πŸ† 415x faster YAML | 9x faster TOML | 2-3x faster INI | 30-60% LLM token savings

πŸ“¦ npm | πŸ™ GitHub | 🐦 X


πŸ“¦ Packages

Core Data Formats

Package Status Performance Features
@sylphx/molt-json βœ… Stable 1.7-2.5x faster Dirty JSON, Type preservation, Streaming, Validation
@sylphx/molt-yaml βœ… Stable 2-415x faster πŸ”₯ Anchors, Multi-doc, Full YAML 1.2
@sylphx/molt-toml βœ… Stable 2-9x faster ⚑ Nested tables, Arrays, Type-safe
@sylphx/molt-ini βœ… Stable 2-3x faster Git config, PHP config, Windows INI
@sylphx/molt-csv βœ… Stable 1.4-7.6x faster Type conversion, WASM, Streaming
@sylphx/molt-xml βœ… Stable Matches fastest Dirty XML cleaning ⭐

Binary & AI-Optimized Formats

Package Status Performance Features
@sylphx/molt-msgpack βœ… Stable Competitive Binary format, 20-50% smaller than JSON
@sylphx/molt-toon βœ… Stable 30-60% token savings πŸ€– LLM-optimized, Table format, Minimal quoting

Meta Package

Package Status Features
@sylphx/molt βœ… Stable All formats in one package

⚑ Quick Start

# Install individual packages
bun add @sylphx/molt-json
bun add @sylphx/molt-yaml
bun add @sylphx/molt-toml
bun add @sylphx/molt-ini
bun add @sylphx/molt-csv
bun add @sylphx/molt-xml
bun add @sylphx/molt-msgpack
bun add @sylphx/molt-toon

# Or install all at once
bun add @sylphx/molt

JSON - Type Preservation

import { molt } from '@sylphx/molt-json'

const data = molt(`{
  user: 'alice',        // βœ… Unquoted keys
  joined: new Date(),   // βœ… Date preserved
  id: 123n,            // βœ… BigInt preserved
}`)

YAML - 415x Faster

import { molt } from '@sylphx/molt-yaml'

const config = molt(`
app: MyApp
database:
  host: localhost
  port: 5432
`)

TOML - 9x Faster

import { molt } from '@sylphx/molt-toml'

const config = molt(`
[database]
host = "localhost"
port = 5432
`)

CSV - Type Conversion

import { parseCSV } from '@sylphx/molt-csv'

const data = parseCSV('name,age,active\nAlice,30,true', {
  parseTypes: true  // Auto-detect types
})

XML - Dirty Support

import { molt } from '@sylphx/molt-xml'

// Handles dirty XML automatically
const data = molt('<user name=alice age=30/>', {
  cleanDirty: true
})

INI - Configuration Files

import { molt } from '@sylphx/molt-ini'

const config = molt(`
[database]
host = localhost
port = 5432
`)

console.log(config.database.port) // 5432

MessagePack - Binary Format

import { encode, decode } from '@sylphx/molt-msgpack'

const data = { user: 'alice', id: 123 }
const binary = encode(data) // 20-50% smaller than JSON
const restored = decode(binary)

TOON - LLM Optimized

import { stringify } from '@sylphx/molt-toon'

const data = {
  users: [
    { id: 1, name: 'Alice', age: 30 },
    { id: 2, name: 'Bob', age: 25 }
  ]
}

// 30-60% fewer tokens for LLM prompts!
const toon = stringify(data)
// users:
//   id | name  | age
//   1  | Alice | 30
//   2  | Bob   | 25

πŸ† Performance

See BENCHMARKS.md for complete results.

Executive Summary

Format Best Performance vs Competitor
YAML 415x faster πŸ”₯ vs yaml (multi-doc)
TOML 9x faster ⚑ vs @iarna/toml (nested)
INI 2-3x faster ⚑ vs ini (npm)
JSON 2.5x faster ⚑ vs superjson (serialize)
CSV 7.6x faster πŸš€ vs papaparse (quoted)
XML Matches fastest vs fast-xml-parser
MessagePack Competitive vs @msgpack/msgpack
TOON 30-60% token savings πŸ€– vs JSON for LLMs

Key Advantages:

  • πŸ₯‡ Fastest YAML parser in the ecosystem
  • πŸ₯‡ Fastest TOML parser available
  • πŸ₯‡ First high-performance TOON implementation
  • πŸ₯ˆ Top-tier JSON serialization performance
  • πŸ₯ˆ Competitive CSV with WASM acceleration
  • πŸ₯ˆ XML performance with unique dirty-cleaning
  • πŸ₯ˆ MessagePack with full type support

🎯 Features

Core Features

  • ⚑ Blazing Fast - Up to 415x faster than alternatives
  • πŸ›‘οΈ Type Safety - Full TypeScript support with strict types
  • πŸ”§ Dirty Input - Handle malformed JSON/XML automatically
  • πŸ¦€ WASM Acceleration - Rust-powered for performance-critical paths
  • πŸ“¦ Zero Dependencies - Minimal bundle size
  • πŸ”„ Streaming API - Process large files efficiently

Format-Specific Features

JSON

  • Dirty JSON parsing (unquoted keys, trailing commas, comments)
  • Type preservation (Date, BigInt, Map, Set, RegExp, etc.)
  • Schema validation (Zod, JSON Schema)
  • Streaming for large files

YAML

  • Full YAML 1.2 spec support
  • Anchors and aliases
  • Multi-document parsing
  • Custom tags
  • 2-415x faster than competitors

TOML

  • Tables and nested tables
  • Array of tables
  • Inline tables
  • Type-safe parsing
  • 2-9x faster than alternatives

INI

  • Section support ([section])
  • Comment support (; and #)
  • Type coercion (numbers, booleans)
  • Git/PHP/Windows INI compatible
  • 2-3x faster than alternatives

CSV

  • Automatic type detection
  • Custom delimiters
  • Header handling
  • WASM acceleration
  • Streaming support

XML

  • DOM and object conversion
  • CDATA support
  • Namespace handling
  • Dirty XML cleaning (unique!)
  • Matches fastest parsers

MessagePack

  • Full MessagePack spec support
  • Binary data handling
  • Date/timestamp encoding
  • BigInt support
  • 20-50% smaller than JSON

TOON

  • 30-60% token savings for LLMs
  • Table format for uniform arrays
  • Minimal quoting
  • YAML-style indentation
  • Perfect for ChatGPT/Claude/GPT-4 prompts

πŸ—οΈ Monorepo Structure

molt/
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ json/          # JSON transformer
β”‚   β”œβ”€β”€ yaml/          # YAML parser/serializer
β”‚   β”œβ”€β”€ toml/          # TOML parser/serializer
β”‚   β”œβ”€β”€ csv/           # CSV parser/serializer
β”‚   β”œβ”€β”€ xml/           # XML parser/serializer
β”‚   └── molt/          # Meta package
β”œβ”€β”€ docs/              # VitePress documentation
β”œβ”€β”€ .github/           # CI/CD workflows
β”œβ”€β”€ .changeset/        # Changesets for versioning
β”œβ”€β”€ turbo.json         # Turborepo configuration
└── BENCHMARKS.md      # Performance benchmarks

πŸ› οΈ Development

Prerequisites

Setup

# Clone the repository
git clone https://github.com/sylphx/molt.git
cd molt

# Install dependencies
bun install

# Build all packages (with Turbo cache)
turbo build

# Run tests for all packages
turbo test

# Run benchmarks
turbo bench

# Lint and format
bun lint
bun format

Working with Changesets

# Create a changeset (for versioning)
bunx changeset

# Version packages
bunx changeset version

# Publish to npm
bunx changeset publish

Documentation

# Start docs dev server
cd docs
bun dev

# Build docs
bun docs:build

# Preview built docs
bun docs:preview

πŸ“š Documentation


🎯 Technology Stack

  • Runtime: Bun - Ultra-fast JavaScript runtime
  • Language: TypeScript with strict mode
  • Monorepo: Turborepo - High-performance build system
  • Versioning: Changesets - Version management
  • Testing: Vitest - Fast unit testing
  • Benchmarking: Vitest benchmark mode
  • Bundling: tsup - TypeScript bundler
  • Linting: Biome - Fast linter and formatter
  • Docs: VitePress - Documentation site
  • Acceleration: Rust + WASM for performance-critical paths

🀝 Contributing

We welcome contributions! Here's how to get started:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/your-feature
  3. Make your changes with tests
  4. Run tests: turbo test
  5. Create a changeset: bunx changeset
  6. Lint: bun lint:fix
  7. Commit: git commit -m "feat(json): add awesome feature"
  8. Push and create a Pull Request

See CONTRIBUTING.md for detailed guidelines.


πŸ“ License

MIT Β© Sylphx

Each package in this monorepo is licensed under the MIT License.


πŸ™ Acknowledgments

Built with inspiration from:

Made faster, more powerful, and production-ready by Sylphx.


🌟 Star History

If you find Molt useful, please consider giving it a star ⭐

Star History Chart


Built with ❀️ by Sylphx | Website | X

About

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •