jsforce

Isomorphic JavaScript SDK for the Salesforce Platform, covering REST, Bulk, SOAP, Metadata, and Streaming APIs.

SDK
npm
v3.10.25
1,468stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
87/100Excellent
Development Activity84
Maintenance88
Community88
Maturity60
Momentum28

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
71/100Good
Architecture80
Code Quality78
Innovation74
Learning Curve50

JSforce (formerly Node-Salesforce) is an isomorphic JavaScript library that gives Node.js and browser applications a single, typed interface to the Salesforce Platform. A Connection object multiplexes access to REST, SOAP, Bulk, Bulk v2, Metadata, Streaming, Tooling, Analytics, and Chatter APIs, plus a fluent SOQL/SOSL query builder with automatic pagination and CSV bulk-load helpers.

Beyond the client library, JSforce ships a command-line REPL for exploring an org’s data interactively, first-class OAuth2 support (including refresh-token session handling), and full TypeScript definitions so developers can generate typed sObject schemas and get compile-time checking on field access and DML calls.

What You Get

  • A unified Connection client covering REST, SOAP, Bulk, Bulk v2, Metadata, Streaming, Tooling, Analytics, and Chatter APIs
  • A fluent SOQL/SOSL query builder with automatic queryMore pagination and streaming record results
  • Built-in OAuth2 flows (web server, refresh token, username-password) with automatic session/token refresh
  • A CLI REPL (bin/jsforce) for interactively exploring an org’s schema and data before writing code
  • Full TypeScript typings, including generated schema types for compile-time-checked sObject field access

Common Use Cases

  • Salesforce integration middleware - backend teams use jsforce inside Node services to sync records between Salesforce and internal systems via REST/Bulk APIs
  • Bulk data migration - data engineers use the Bulk/Bulk v2 API wrapper to load or export millions of records via CSV without hitting REST call limits
  • Browser-based Salesforce tools - front-end developers embed jsforce in browser apps (via Canvas or signed-request auth) to build custom Salesforce UI extensions
  • Real-time org monitoring - developers subscribe to PushTopic/CometD events through the Streaming API wrapper to react to record changes as they happen
  • Metadata-driven tooling - platform teams use the Metadata/Tooling API wrappers to programmatically deploy or inspect org configuration (objects, fields, Apex)

Under The Hood

Architecture Connection.ts is the central facade (~1,700 lines), composing OAuth2, HttpApi, Transport, Cache, and SessionRefreshDelegate with per-domain API clients (Analytics, Apex, Bulk, BulkV2, Chatter, Metadata, SoapApi, Streaming, Tooling) attached as sub-objects. HttpApi extends EventEmitter and wraps Transport with content-type-aware parsing (JSON/XML/text) plus session-refresh interception on expired tokens. Query.ts implements a stream-based SOQL query/execute path with automatic queryMore pagination, and SObject wraps CRUD for a named object. The CLI (src/cli) is a thin layer over the same Connection API. Because every API module and the CLI depend on Connection’s transport/request plumbing, changes to that core ripple across the whole surface — a deliberate but tightly coupled facade pattern.

Tech Stack TypeScript compiled to CommonJS for Node (tsc, target es2022) and to a separate Babel/Webpack browser bundle, orchestrated through Google’s wireit for incremental, cache-aware builds. Core runtime dependencies include undici for HTTP, xml2js for SOAP/Metadata XML, csv-parse/csv-stringify for Bulk CSV, faye for CometD streaming, and commander/inquirer for the CLI. Type declarations ship alongside the library, and API docs are generated with TypeDoc and published via a GitHub Actions workflow. CI runs through GitHub Actions with conventional-changelog-driven releases and Dependabot auto-merge.

Code Quality Twenty-four test files (roughly 6,800 lines) exercise nearly every API surface — bulk, bulk2, metadata, streaming, chatter, oauth2, connection CRUD/session handling — using Jest for Node and Karma+Jasmine for real browser execution. Some integration tests run against a live-ish org via a dedicated setup script, and flows retired by Salesforce platform changes (SOAP login deprecation, device-activation IP restrictions) are explicitly skip()‘d with dated explanatory comments rather than left silently broken. ESLint is configured with @typescript-eslint’s type-checked rule set plus eslint-config-prettier, and tsconfig enables strict mode. Internal fields use an underscore-prefixed convention (_conn, _transport) applied consistently throughout.

What Makes It Unique A single Connection instance multiplexes seven-plus distinct Salesforce API surfaces with typed generics threading through, so schema-aware projects get compile-time-checked field access and DML — unusual next to Salesforce clients that are either thin REST wrappers or WSDL-generated. The bundled CLI REPL doubles as an interactive learning tool for exploring an org before writing code, and the isomorphic build ships dedicated Canvas/XdProxy/HttpProxy browser transports specifically to work around cross-origin auth constraints that most server-only SDKs never have to solve.

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