superjson

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

Library
npm
v2.2.6
5,280stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
57/100Fair
Development Activity32
Maintenance40
Community56
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
87/100Excellent
Architecture85
Code Quality88
Innovation90
Learning Curve85

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
76%
AGPL 3.0

Abby

Developer Tools · Product Management

167

Statically typed feature flags, remote config, and A/B testing with framework-native SDKs for TypeScript teams.

View details
30
Repo Health
70
Technical
63
Dependency
Built with
TypeScript76%
MDX18%
Updated 1 years ago
TypeScript
84%
MIT

Amical

Note Taking · AI Assistants

1,495

Local-first AI dictation that understands your active app — private, offline, and built for speed.

View details
79
Repo Health
82
Technical
67
Dependency
Built with
TypeScript84%
Updated 3 weeks ago
TypeScript
92%
GPL 3.0

Blinko

Knowledge Management · Note Taking

10,880

A self-hosted, AI-powered card note-taking tool that lets you capture fleeting thoughts instantly and retrieve them with natural language search.

View details
83
Repo Health
69
Technical
65
Dependency
Built with
TypeScript92%
Updated 2 weeks ago
Rust
67%
MIT

Bun

Developer Tools

95,452

An all-in-one JavaScript and TypeScript toolkit — one Rust-and-JavaScriptCore binary that replaces Node.js, npm, a bundler, and a test runner with faster equivalents.

View details
92
Repo Health
91
Technical
66
Dependency
Built with
Rust67%
C++19%
Updated today
TypeScript
96%
Other

Cal.diy

Scheduling

47,796

The 100% MIT-licensed, community-driven scheduling platform — self-host your own booking infrastructure with no enterprise strings attached.

View details
93
Repo Health
86
Technical
66
Dependency
Built with
TypeScript96%
Updated 1 weeks ago
TypeScript
92%
AGPL 3.0

Documenso

Digital Signiture

14,603

Self-hosted, open-source DocuSign alternative with legally binding PDF signatures, multi-party workflows, and a full REST and tRPC API.

View details
93
Repo Health
79
Technical
72
Dependency
Built with
TypeScript92%
Updated today
TypeScript
99%
Other

Dokploy

Devops · Hosting Control Panel · Security

36,702

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

View details
89
Repo Health
76
Technical
65
Dependency
Built with
TypeScript99%
Updated yesterday
MDX
50%
Apache 2.0

Formizee

Forms Surveys

183

An open-source form backend and builder platform — design forms, collect submissions, and get analytics without hosting your own server, positioned as an alternative to Formspree and Typeform.

View details
28
Repo Health
59
Technical
68
Dependency
Built with
MDX50%
TypeScript49%
Updated 1 years ago
TypeScript
67%
MIT

Hoppscotch

Developer Tools

80,055

A lightweight, offline-capable API development ecosystem for testing HTTP, GraphQL, WebSocket, MQTT, and SSE endpoints across web, desktop, and CLI.

View details
91
Repo Health
83
Technical
66
Dependency
Built with
TypeScript67%
Vue23%
Updated 3 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

Search