npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mc-sf-template

v1.0.3

Published

Salesforce CLI tool with template processing

Readme

Salesforce Template CLI

A powerful command-line interface (CLI) and web-based tool for querying Salesforce data and processing Handlebars templates with dynamic content. This tool simplifies the process of authenticating with Salesforce, querying records, and generating customized outputs (e.g., emails, reports) using template files. Ideal for developers and Salesforce administrators who need to automate template-based workflows.

Features

  • Salesforce Authentication: Authenticate with Salesforce orgs using the Salesforce CLI.
  • Dynamic SOQL Queries: Query Salesforce objects with customizable field selection (required fields or all fields).
  • Handlebars Templating: Process templates with dynamic Salesforce data using Handlebars syntax.
  • Web Interface: Interactive UI for selecting objects, fields, and records, with real-time template processing.
  • CSV Export: Export queried Salesforce data to CSV for further analysis.
  • Field Selection: Choose specific fields to display in the UI table, with support for horizontal scrolling.
  • Record Details: View all fields of a selected record in a detailed JSON view.
  • Responsive Design: Clean, user-friendly interface built with Tailwind CSS and Monaco Editor.

Salesforce Template Salesforce Template-2

Salesforce Template- query

Installation

npm install -g mc-sf-template 

Ensure you have the Salesforce CLI installed and configured for authentication:

Prerequisites

  • Node.js: Version 18.x or higher.
  • Salesforce CLI: Required for authentication with Salesforce orgs.
  • Salesforce Org: A Salesforce org with API access and valid credentials.
  • Web Browser: For accessing the web interface (e.g., Chrome, Firefox).

Usage

1. Authenticate with Salesforce

Authorize your Salesforce org using the Salesforce CLI:

sf force auth web login -r instanceUrl

Register the org with the CLI tool:

mc-sf-template auth -u <your-username>

Example:

mc-sf-template auth -u username 

2. Start the Server

Launch the web server to access the UI:

mc-sf-template server -p 3001

Open your browser and navigate to http://localhost:3001.

3. Web Interface Workflow

  1. Authenticate: Select or enter a Salesforce username in the UI to authenticate.
  2. Select Object: Choose a Salesforce object (e.g., Contact, Account) from the dropdown.
  3. Choose Fields:
    • Select Required Fields (Template) for predefined fields (e.g., Id, Name, Email, Phone for Contact).
    • Select All Fields to query all non-base64 fields.
  4. Display Fields: Use the multi-select dropdown to choose which fields to show in the data table (up to 20 by default).
  5. Query Records: Click Query Records to fetch up to 200 records.
  6. Process Template:
    • Edit or upload a Handlebars template in the left pane (e.g., contact_email_template.hbs).
    • Select a record and click Process Template to generate output.
  7. Export or Copy:
    • Export queried data to CSV using the Export CSV button.
    • Copy or download the processed template output.

Example Template (contact_email_template.hbs):

Hello {{Contact.Name}},

Your email is: {{Contact.Email}}
Phone: {{Contact.Phone}}
Title: {{Contact.Title}}

Best regards!

4. CLI Commands

  • Authenticate:
    sf-template auth -u <username>
  • Start Server:
    sf-template server -p <port>
  • Help:
    sf-template --help

Configuration

  • Port: Specify a custom port with the -p flag (default: 3000).
  • Templates: Store Handlebars templates in the templates/ directory or upload via the UI.
  • Field Limits: The UI displays up to 20 fields by default, but all queried fields are available for templating and CSV export.

Example

  1. Authenticate:

    sf force auth web loggin -r instance_url 
    sf-template auth -u [email protected]
  2. Start the server:

    sf-template server -p 3001
  3. Open http://localhost:3001, select Contact, choose All Fields, and query records.

  4. Select a record, process a template, and export the data to CSV.

Troubleshooting

  • Authentication Issues:
    • Ensure the Salesforce CLI is configured with sf org login web.
    • Verify the username matches the org alias.
  • Missing Fields:
    • Select All Fields in the UI to include all non-base64 fields.
    • Check the Selected Record Details section for all queried fields.