Extract, transform, and export Salesforce data to JSON using Node.js.
This is a simple ETL tool that connects to Salesforce, retrieves data from objects like Account, applies custom transformations, and outputs the results as JSON files. It’s designed to be lightweight and easy to extend.
- Extracts Salesforce records using SOQL
- Transforms data with customizable mapping functions
- Outputs JSON files for use in other systems or workflows
-
Clone the repo:
git clone https://github.com/<yourusername>/salesforce-etl-json.git cd salesforce-etl-json
-
Install dependencies:
npm install
-
Configure your Salesforce credentials:
Update the
aliasproperty inconfig/org.jsonto match your org's alias. -
Configure a query and field mapping in
config/querries.json:{ "queryName": { "query": "SELECT Id, Name, Phone, CreatedDate FROM Account LIMIT 100", "fieldMap": { "id": "Id", "name": "Name", "phone": "Phone", "createdDate": "CreatedDate" } } }
Run the ETL process with:
npm start <queryName>This will:
-
Execute the defined query in
config/queries.json -
Transform the returned records according to your mapping logic
-
Write the output to
output/<queryName>.json
salesforce-etl-json/
├── output/ # JSON output files
├── config/ # Config
│ ├── org.json # Org Config
│ ├── queries.json # Queries Config
├── src/
│ ├── index.js # Entry point
│ ├── etl.js # ETL orchestration
│ ├── sfdxExtract.js # Salesforce query logic
│ └── transform.js # Data transformation functions
├── package.json
├── README.md
└── .gitignore
- Support other output formats (CSV, databases, APIs)
MIT
Feel free to reach out if you want help adding features!