superjson

Serialize JavaScript to a superset of JSON that keeps Dates, Maps, Sets, BigInts, and more intact.

Library
npm
v2.2.6
5,287 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
50 /100 Fair
Development Activity 12
Maintenance 32
Community 56
Maturity 60
Momentum 40

Technical Analysis

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

Superjson is a thin, framework-agnostic wrapper around JSON.stringify and JSON.parse that safely round-trips JavaScript values plain JSON cannot represent — Date, Map, Set, BigInt, RegExp, Error, URL, undefined, and NaN — without any manual pre- or post-processing.

It works by emitting a standard JSON payload alongside a small meta annotation describing which values need special reconstruction, so output stays fully JSON-compatible for any consumer while superjson-aware clients get the original types back. Widely adopted through tRPC and Next.js data hooks, it adds type safety with autocompletion and a negligible runtime footprint.

What You Get

  • Drop-in stringify/parse functions that mirror the native JSON API
  • Lower-level serialize/deserialize that expose the json and meta parts separately
  • Faithful round-tripping of Date, Map, Set, BigInt, RegExp, Error, URL, undefined, and NaN
  • Full TypeScript typings with generic inference on parse/deserialize
  • Extensibility hooks: registerClass, registerSymbol, and registerCustom for your own types

Common Use Cases

  • Passing Dates and other rich types through Next.js getServerSideProps/getStaticProps
  • End-to-end type-safe payloads in tRPC APIs
  • Persisting Maps, Sets, and BigInts to storage or caches and reading them back intact
  • Serializing Prisma.Decimal or other custom domain types via a registered transformer

Under The Hood

Architecture — The public surface in src/index.ts is a single SuperJSON class whose serialize walks the input via walker in src/plainer.ts, splitting each value into a plain transformedValue (the json) and annotations (the meta.values) while a Map of identities feeds generateReferentialEqualityAnnotations for optional dedupe; deserialize reverses this by applying value and referential-equality annotations, and stringify/parse simply wrap these with native JSON. Type handling flows through src/transformer.ts, backed by three pluggable registries — ClassRegistry, symbol Registry, and CustomTransformerRegistry. Tech Stack — Written in TypeScript (tsc build, ESM type: module) targeting Node >=16, with exactly one runtime dependency, copy-anything, used for safe deep copies during out-of-place deserialization. Dev tooling is Vitest for tests and tsdx/prettier for build and formatting. Code Quality — Testing is thorough: a 34KB index.test.ts plus focused suites for is, plainer, transformer, registry, pathstringifier, and accessDeep. Code is small, cohesive, and strongly typed — src/is.ts is a comprehensive set of typed guard functions (isDate, isMap, isBigint, isTypedArray, etc.) with narrowing predicates, and modules are cleanly separated by responsibility. API Design — Ergonomics are a headline feature: stringify/parse are exact analogues of the native JSON methods, both static (SuperJSON.parse) and instance forms are provided, generics infer the restored type, and extension is a one-call registerCustom/registerClass. Getting started requires no configuration, and the README documents the full type-support matrix and framework recipes.

Used by 32 apps in this directory

TypeScript
96%
AGPL 3.0

Kan

Project Management

5,825

An open-source, self-hostable Kanban board built as a modern Trello alternative with team workspaces, board permissions, and Trello import.

View details
86
Repo Health
78
Technical
67
Dependency
Built with
TypeScript 96%
Updated 1 weeks ago
TypeScript
98%
AGPL 3.0

Karakeep

Bookmarks Archiving

29,926

Self-hosted bookmark manager that captures links, notes, images, and PDFs with AI tagging, full-text search, and automatic archiving.

View details
88
Repo Health
76
Technical
66
Dependency
Built with
TypeScript 98%
Updated 1 weeks ago
TypeScript
96%
Other

Langfuse

AI Development · Monitoring

36,276

Open source AI engineering platform for LLM observability, prompt management, evaluation, and debugging — self-host in minutes or use Langfuse Cloud.

View details
92
Repo Health
81
Technical
65
Dependency
Built with
TypeScript 96%
Updated 5 days ago
TypeScript
96%
AGPL 3.0

Libra AI

AI Development · No Code Platforms

1,695

Open-source AI-powered platform that generates and deploys full-stack web applications from natural language prompts, built natively for Cloudflare Workers.

View details
31
Repo Health
71
Technical
68
Dependency
Built with
TypeScript 96%
Updated 1 years ago
TypeScript
96%
MIT

likec4

Developer Tools · Devops

5,954

Define your software architecture as code and get always up-to-date, interactive C4 diagrams generated automatically from a DSL.

View details
89
Repo Health
83
Technical
78
Dependency
Built with
TypeScript 96%
Updated 5 days ago
TypeScript
98%
Other

LobeHub

AI Assistants · Automation · Productivity

83,455

Your Chief Agent Operator — build, schedule, and collaborate with an entire AI team in one self-hostable workspace.

View details
92
Repo Health
81
Technical
65
Dependency
Built with
TypeScript 98%
Updated 5 days ago
TypeScript
99%
AGPL 3.0

Manage

Collaboration · Project Management

71

Self-hosted, open-source project management with tasks, calendars, docs, and real-time team collaboration.

View details
33
Repo Health
57
Technical
71
Dependency
Built with
TypeScript 99%
Updated 2 months ago
TypeScript
99%
Apache 2.0

Mastra Code

AI Code Assistants

29,041

"A coding agent that never compacts" — a terminal-based AI coding agent built on the Mastra framework, with Observational Memory instead of context compaction, multi-model support, and OAuth login for Claude Max or ChatGPT Plus.

View details
90
Repo Health
73
Technical
65
Dependency
Built with
TypeScript 99%
Updated 5 days ago
TypeScript
96%
AGPL 3.0

Midday

Invoicing Finance · Productivity

15,091

All-in-one AI-powered business operations platform for freelancers and solo entrepreneurs to manage invoicing, time tracking, banking, and financial intelligence.

View details
51
Repo Health
78
Technical
67
Dependency
Built with
TypeScript 96%
Updated 4 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