Registry / crm / nforce

nforce

JSON →
library1.13.0jsnpmunverified

nforce is a Node.js REST API wrapper for Force.com, Database.com, and Salesforce.com, providing a simple interface for OAuth authentication, CRUD operations on sObjects, querying, and streaming. Version 1.13.0 is the latest stable release; the project has been in maintenance mode since 2018 with no recent updates. It supports both single-user and multi-user OAuth modes and offers intelligent sObjects that track field changes for efficient updates. Compared to alternatives like jsforce, nforce is lighter but lacks support for newer Salesforce APIs (e.g., REST API v50+). Requires Node.js >=8.0.0, CommonJS, and does not include TypeScript definitions natively.

crm
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

nforce is a CommonJS module; ES modules are not supported. Use require() for importing.

const nforce = require('nforce');

createConnection is the correct factory method; Connection is not an export.

const org = nforce.createConnection({...});

createSObject is a factory function; SObject is not a constructor.

const acc = nforce.createSObject('Account');

This snippet shows how to require nforce, create a connection, authenticate using username/password flow, create an Account sObject, and insert it into Salesforce.

const nforce = require('nforce'); const org = nforce.createConnection({ clientId: process.env.SF_CLIENT_ID ?? '', clientSecret: process.env.SF_CLIENT_SECRET ?? '', redirectUri: process.env.SF_REDIRECT_URI ?? 'http://localhost:3000/oauth/_callback', apiVersion: 'v27.0', environment: 'production', mode: 'single' }); org.authenticate({ username: process.env.SFUSER ?? '', password: process.env.SFPASS ?? '' }, (err, resp) => { if (err) { console.error('Auth error:', err); return; } const acc = nforce.createSObject('Account'); acc.set('Name', 'Spiffy Cleaners'); org.insert({ sobject: acc }, (err, resp) => { if (err) { console.error('Insert error:', err); return; } console.log('Inserted record ID:', resp.id); }); });
Debug
Known footguns
breakingnforce v1.9.0 dropped support for callback-only authentication; authenticate() now returns a promise if no callback is provided. This can break code relying on synchronous behavior.
deprecatedNode.js versions <8 are no longer supported as of nforce 1.13.0.
gotchaIn multi-user mode, you must pass the oauth object to each API call; omitting it will use the last authenticated user's token (if any) and cause unexpected behavior.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
0 hits · last 30 days

No traffic data recorded yet.

Resources
packagenforce