jsonwebtoken

The de facto Node.js library for signing, verifying, and decoding JSON Web Tokens.

Library
npm
v9.0.3
18,196stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
51/100Fair
Development Activity24
Maintenance4
Community76
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
78/100Good
Architecture78
Code Quality85
Innovation72
Learning Curve75

jsonwebtoken is the most widely used Node.js implementation of the JSON Web Token (JWT) standard (RFC 7519), providing simple sign, verify, and decode functions for issuing and validating tokens. It supports HMAC (HS256/384/512), RSA (RS256/384/512), RSA-PSS (PS256/384/512), and ECDSA (ES256/384/512) algorithms, plus claim validation for expiration, audience, issuer, subject, and not-before.

Maintained by Auth0 and used across countless authentication and API-authorization flows, the library exposes both synchronous and callback-based asynchronous APIs, ships built-in protections against algorithm-confusion attacks, and keeps its dependency surface to a handful of small, focused helper packages.

What You Get

  • jwt.sign() for creating tokens synchronously or via callback, with support for HMAC, RSA, RSA-PSS, and ECDSA algorithms
  • jwt.verify() for validating signature, expiration (exp), not-before (nbf), audience, issuer, subject, and JWT ID claims in one call
  • jwt.decode() for reading a token’s payload/header without verifying its signature
  • Built-in algorithm allowlisting to guard against algorithm-confusion/downgrade attacks
  • Typed error classes (JsonWebTokenError, TokenExpiredError, NotBeforeError) for precise failure handling

Common Use Cases

  • Issuing session tokens for stateless API authentication
  • Signing and verifying access/refresh tokens in an OAuth2 or OpenID Connect flow
  • Generating short-lived tokens for password-reset or email-verification links
  • Validating service-to-service tokens signed with RSA/ECDSA key pairs

Under The Hood

Architecture — The package is a thin, function-oriented wrapper rather than a class hierarchy: sign.js (253 lines), verify.js (263 lines), and decode.js (30 lines) sit at the repo root as the three public entry points, each importing shared validators from lib/ (validateAsymmetricKey.js, timespan.js, psSupported.js) and three typed error classes (JsonWebTokenError, NotBeforeError, TokenExpiredError). index.js simply re-exports these five symbols, so the whole module surface is deliberately small and traceable end-to-end from a single file per operation.

Tech Stack — Pure JavaScript (CommonJS, no TypeScript source) targeting Node >=12. Runtime dependencies are minimal and split into single-purpose micro-packages (lodash.includes, lodash.isboolean, lodash.isinteger, lodash.isnumber, lodash.isplainobject, lodash.isstring, lodash.once instead of full lodash), plus jws for the underlying signature format, ms for human-readable time spans, and semver for internal version checks. Node’s built-in crypto module (KeyObject, createSecretKey, createPrivateKey) is used directly for key handling rather than a third-party crypto wrapper.

Code Quality — The project enforces strict coverage via nyc (95% lines/statements/branches, 100% functions) and ships 34 test files under test/ covering claim-by-claim behavior (claim-aud, claim-exp, claim-iat, claim-iss, claim-jti, claim-nbf, plus dedicated encoding, decoding, and async-sign suites) using mocha, chai, and sinon. ESLint and Husky pre-commit hooks are configured, and semantic-release/commitlint enforce conventional commits, indicating a mature, process-driven maintenance workflow for a small codebase.

API Design — The public API is deliberately minimal: three top-level functions (sign, verify, decode) each accepting a plain options object, with every function usable either synchronously (return value or thrown error) or asynchronously (Node-style callback). Options schemas (sign_options_schema, registered_claims_schema) are validated defensively with descriptive error messages before any cryptographic work happens, and verify() requires an explicit algorithms allowlist — a deliberate ergonomic trade-off that adds one required option in exchange for closing a well-known JWT vulnerability class.

Used by 92 apps in this directory

TypeScript
99%
Other

Activepieces

Automation · AI Assistants

24,298

Open-source AI automation platform that converts 280+ workflow integrations into MCP servers for LLMs, with no-code builders and TypeScript extensibility.

View details
92
Repo Health
85
Technical
64
Dependency
Built with
TypeScript99%
Updated today
TypeScript
87%
Other

AFFiNE

Productivity · Project Management · Note Taking

72,238

Write, draw, and plan in one infinite canvas — the open-source alternative to Notion and Miro that keeps your data yours.

View details
91
Repo Health
87
Technical
67
Dependency
Built with
TypeScript87%
Updated yesterday
TypeScript
95%
Apache 2.0

AionUi

AI Agents · Productivity

32,622

Free, open-source Cowork desktop app that unifies Claude Code, Codex, Gemini CLI, and 20+ AI agents into a single platform with multi-agent teams, 24/7 cron automation, and zero-config built-in agent.

View details
87
Repo Health
76
Technical
66
Dependency
Built with
TypeScript95%
Updated 5 days ago
PHP
82%
Other

Akaunting

Invoicing Finance

10,111

Open-source online accounting for small businesses and freelancers — invoices, expenses, and reporting without monthly fees or vendor lock-in.

View details
98
Repo Health
73
Technical
63
Dependency
Built with
PHP82%
Blade13%
Updated yesterday
TypeScript
96%
Other

Amplication

Developer Tools · AI Code Assistants · Automation

16,011

Create production-ready backend services with your organization's standards baked in — generating NestJS, Prisma, and GraphQL code that you own and control.

View details
60
Repo Health
84
Technical
60
Dependency
Built with
TypeScript96%
Updated 2 months ago
JavaScript
95%
MIT

AnythingLLM

Developer Tools · Automation · AI Assistants

65,696

The all-in-one AI platform for private document chat, no-code agents, and local LLMs with zero setup friction.

View details
90
Repo Health
78
Technical
64
Dependency
Built with
JavaScript95%
Updated 3 days ago
TypeScript
49%
MPL 2.0

Artillery

Devops · Developer Tools

9,071

Cloud-scale load testing and functional testing for APIs, WebSockets, gRPC, and headless browsers, distributed across AWS Lambda or Fargate with zero infrastructure to manage.

View details
88
Repo Health
73
Technical
68
Dependency
Built with
TypeScript49%
JavaScript48%
Updated 1 weeks ago
JavaScript
100%
Other

Automatisch

Automation · No Code Platforms

13,964

Self-hosted, no-code workflow automation that keeps your data on your own servers—a privacy-first alternative to Zapier with 90+ integrations.

View details
49
Repo Health
78
Technical
63
Dependency
Built with
JavaScript100%
Updated 6 months ago
TypeScript
92%
GPL 3.0

Blinko

Knowledge Management · Note Taking

10,992

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
80
Repo Health
69
Technical
63
Dependency
Built with
TypeScript92%
Updated 1 weeks 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