forge

A native, pure-JavaScript implementation of TLS and PKI cryptography for building crypto-based Node.js and browser apps.

Library
npm
v1.4.0
5,331stars
(BSD-3-Clause OR GPL-2.0)

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
49/100Fair
Development Activity8
Maintenance0
Community88
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
63/100Good
Architecture68
Code Quality58
Innovation55
Learning Curve70

node-forge is a native JavaScript implementation of the TLS protocol along with a broad set of cryptographic primitives and PKI tooling, distributed as the node-forge npm package. It runs equally in Node.js and the browser, providing ciphers (AES, DES, RC2), message digests (MD5, SHA-1, SHA-256, SHA-384, SHA-512, HMAC), asymmetric cryptography (RSA, Ed25519, RSA-KEM), and a full ASN.1/X.509 stack for generating certificates, certificate signing requests, and PKCS#5/7/8/10/12 structures.

Beyond cryptography, forge includes higher-level networking tools — an HTTP client, SSH key handling, XHR and raw TCP/TLS socket wrappers, and a Flash-based networking fallback for pre-WebSocket browsers — reflecting its origin as a toolkit for building network-heavy web apps before native browser crypto and WebSocket APIs were universally available. It remains widely used today (tens of millions of weekly npm downloads) primarily for its X.509/PKI utilities: generating self-signed certificates, parsing CSRs, and working with PKCS#12 keystores in pure JavaScript without native bindings.

What You Get

  • A single forge module exposing ciphers, digests, PKI, and networking utilities under one namespace (forge.pki, forge.tls, forge.util, etc.)
  • Full X.509/ASN.1 support for generating and parsing certificates, CSRs, and PKCS#5/7/8/10/12 structures in pure JavaScript
  • A complete set of symmetric ciphers (AES, DES, RC2) and message digests (MD5, SHA-1/256/384/512, HMAC) with no native dependencies
  • Pre-built UMD browser bundles (forge.min.js, forge.all.min.js) via jsDelivr/webpack for drop-in use without a build step
  • A Fortuna-based PRNG with Node crypto-backed seeding when available, falling back to pure JavaScript in restricted environments

Common Use Cases

  • Generating self-signed TLS certificates and CSRs entirely client-side or in a Node script
  • Parsing and validating X.509 certificates and PKCS#12 keystores without shelling out to OpenSSL
  • Implementing custom TLS clients/servers in environments without native TLS support
  • Hashing and HMAC-signing payloads (SHA-256, SHA-512) in browser code where Web Crypto coverage is inconsistent

Under The Hood

Architecture Each module attaches itself onto a single shared forge singleton (lib/forge.js) via forge.<name> = forge.<name> || {}, and lib/index.js requires every module file to populate it — a flat plugin-registration pattern rather than classes or dependency injection. Environment detection is pushed into leaf modules instead of centralized: prng.js checks forge.util.isNodejs and forge.options.usePureJavaScript to decide whether to seed from Node’s native crypto module or fall back to a pure-JS Fortuna implementation. Layering runs bottom-up from bignum/PRNG/util primitives, through ciphers and digests, up to the ASN.1/PKI/TLS stack (pki.js, x509.js, pkcs7.js, pkcs12.js, tls.js), but modules require concrete siblings directly rather than accepting injected implementations, so swapping a backend means monkey-patching forge.random rather than passing an alternative in.

Tech Stack Pure JavaScript targeting ES5 (.eslintrc.js sets ecmaVersion: 5, sourceType: script), dual-published for Node (CommonJS) and the browser via a browser field that remaps buffer/crypto/process, with UMD bundles (forge.min.js, forge.all.min.js, prime.worker.min.js) built by webpack and also supporting Browserify. Tests run through Mocha on Node and Karma in-browser across both bundlers, exercised in CI across a wide Node matrix (6.x through 24.x). Build tooling (webpack ^4, karma ^1-4, mocha ^5) is pinned to older majors, favoring broad runtime compatibility over a modern toolchain.

Code Quality The test suite (tests/unit/*.js) covers each primitive individually — digests, ciphers, RSA, X.509, CSR, PKCS#7/12, TLS, SSH, Ed25519, ASN.1, PEM, KEM — run under both Mocha and Karma, giving genuinely broad functional coverage. ESLint extends eslint-config-digitalbazaar, but the repository’s own lint CI job is commented out, and rules like no-unused-vars, no-var, and prefer-const are relaxed or disabled because the code intentionally targets ES5. There is no static typing and no TypeScript definitions bundled in the package itself; error handling is plain synchronous throw with descriptive messages rather than typed error classes.

API Design A single forge namespace (forge.pki, forge.tls, forge.util, forge.random, …) avoids per-algorithm imports and gives every primitive a consistent .create()-style factory. The tradeoff is an API that predates modern JS idioms: it exposes its own ByteBuffer/binary-string abstractions (forge.util.createBuffer) rather than native Buffer/Uint8Array, and options are passed as plain objects rather than typed configs. A long, example-heavy README (2000+ lines) offsets some of the ramp-up cost this creates for newcomers.

Used by 16 apps in this directory

TypeScript
68%
Apache 2.0

Appsmith

Developer Tools · Automation · No Code Platforms

40,825

Open-source low-code platform to build admin panels, dashboards, and internal tools connected to any database or API.

View details
93
Repo Health
79
Technical
66
Dependency
Built with
TypeScript68%
Java21%
Updated 3 days ago
JavaScript
83%
Other

Countly

Analytics · Marketing

5,896

Privacy-first, self-hosted analytics and customer engagement platform with full data ownership, GDPR compliance, and AI-powered insights across mobile, web, desktop, and IoT.

View details
95
Repo Health
82
Technical
65
Dependency
Built with
JavaScript83%
Updated 3 days ago
TypeScript
49%
AGPL 3.0

Grafana

Monitoring · Analytics

76,643

The open-source observability platform that unifies metrics, logs, and traces from any data source into dynamic, queryable dashboards.

View details
95
Repo Health
91
Technical
63
Dependency
Built with
TypeScript49%
Go45%
Updated today
TypeScript
61%
EPL-2.0

Huly Platform

Project Management · Team Chat · Collaboration

27,586

Open-source all-in-one workspace that replaces Linear, Jira, Slack, and Notion for product and engineering teams.

View details
89
Repo Health
86
Technical
62
Dependency
Built with
TypeScript61%
Svelte34%
Updated 1 weeks ago
TypeScript
97%
Other

Infisical

Security · Devops

29,145

The open-source platform for secrets, certificates, privileged access, and AI agent security — all in one self-hostable system.

View details
91
Repo Health
84
Technical
65
Dependency
Built with
TypeScript97%
Updated yesterday
Vue
50%
GPL 3.0

IT-Tools

Developer Tools

40,498

A unified collection of 88 web-based developer utilities — from JSON formatting to subnet calculation — all self-hostable, keyboard-searchable, and offline-ready.

View details
60
Repo Health
74
Technical
63
Dependency
Built with
Vue50%
TypeScript48%
Updated 4 days ago
TypeScript
57%
MIT

Jitsu

Data Engineering

5,063

Open-source, fully-scriptable data ingestion engine that streams events from web, apps, and APIs to any data warehouse in real time.

View details
88
Repo Health
79
Technical
66
Dependency
Built with
TypeScript57%
Go41%
Updated 3 days ago
TypeScript
98%
Other

Kibana

Analytics · Monitoring

21,284

Your open source window into the Elastic Stack — query, visualize, and act on data stored in Elasticsearch with real-time dashboards, AI-assisted search, and automated alerting.

View details
98
Repo Health
87
Technical
66
Dependency
Built with
TypeScript98%
Updated yesterday
TypeScript
97%
MPL 2.0

Logto

Authentication

14,510

Open-source auth infrastructure for SaaS and AI apps with OIDC, SAML, and RBAC

View details
91
Repo Health
83
Technical
63
Dependency
Built with
TypeScript97%
Updated yesterday

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