Global Constants — Centralize n8n Workflow Variables

Global Constants — Centralize n8n Workflow Variables

Anyone who builds multiple automations in n8n knows how quickly the same constant — an API key, a feature flag, or a shared lookup table — ends up duplicated across workflows. The n8n-nodes-globals package offers a small, focused solution: a community node that stores and exposes global constants to any workflow inside your n8n instance.

This is an n8n community node. It lets you create global constants that can be used in any workflow.

What It Does

n8n-nodes-globals provides a single n8n node, called Global Constants, that reads a credential-managed set of constants and injects them into the data flowing through your n8n workflows. It’s purpose-built to centralize values that should be shared across multiple workflows.

At a glance, the project provides:

  • Credential-backed storage for global constants (so values are managed in n8n’s credentials system).
  • Two input formats for constants: line-based key=value pairs or a JSON object.
  • An option to either merge all constants into a single JSON key or expose each constant as a separate top-level key on items.
  • Simple integration: the node accepts credentials and enriches incoming items (or creates a new item when there are no inputs).

Who It’s For

This package is intended for n8n users who want a centralized way to manage and reuse values across workflows without duplicating them inside every node. Typical audiences include:

  • n8n self-hosters and small teams that rely on repeatable workflow variables.
  • Automation creators who prefer storing global configuration in n8n credentials rather than scattering values through many nodes.
  • Developers building community nodes or extending n8n who want to reference a single source of truth for constants.

Skill-level: basic-to-intermediate n8n familiarity is sufficient. The node is designed to be used inside the n8n editor with standard credential creation and node configuration.

How It Works

Runtime flow (technical overview)

The core runtime behavior (from nodes/GlobalConstants/GlobalConstants.node.ts) is straightforward:

  1. The node requests its required credential (the credential type name is globalConstantsApi).
  2. Credentials store a single text field containing either a JSON document or a multi-line key=value list. The credential type has a Format option: Key-value pairs or JSON.
  3. The helper splitConstants (credentials/CredentialsUtils.ts) is used to parse the credential text. It first attempts to parse the content as JSON; if that fails it falls back to parsing lines of the form name=value. The parser splits only on the first = so values can include equals signs.
  4. Based on the node parameter putAllInOneKey, constants are either placed under a single key (default key name: constants) or expanded as separate top-level keys.
  5. The node then appends or merges the resulting constants object into each incoming item.json. If the node has no input items it creates one item with the constants object.

Important implementation details

  • Credentials type: GlobalConstantsCredentials (defined in credentials/GlobalConstantsCredentials.credentials.ts).
  • Flexible parsing: the splitConstants function accepts a JSON object or the legacy key=value multi-line format.
  • Build pipeline and distribution: TypeScript sources compile to dist/ with gulp copying node and credential icons into the distribution folder.

Getting Started

The repository README points you to the official n8n community nodes installation guide for enabling community nodes. The repository also includes a full build setup so you can build the node locally and publish or install it as a custom node.

<!-- Basic local build steps (repository contains these scripts in package.json) -->
# Clone the repository
git clone https://github.com/umanamente/n8n-nodes-globals.git
cd n8n-nodes-globals

# Install dependencies
npm install

# Build TypeScript and copy icons
npm run build

# (Optional) Run the prepublish checks and linting
npm run prepublishOnly

After building, follow n8n’s community node installation instructions to add the generated dist package into your n8n instance (the package.json included an n8n section pointing to the built credential and node files).

Key Features

  • Two input formats — key=value multi-line strings or a JSON object (v1.1.0 added JSON support).
  • Credential-backed — constants are stored in an n8n credential type so they can be managed through n8n’s credential UI.
  • Safe parsing — the parser attempts JSON first, and for the legacy format it only splits on the first = to allow equals signs in values.
  • Flexible output — either a single object under your chosen key (default constants) or each constant as its own key.
  • Simple integration — the node merges constants into incoming items or creates a new item if none provided.

Why It’s Worth Trying

n8n-nodes-globals is a focused, minimal piece of infrastructure that solves a common pain point: where to keep shared workflow variables. Because it’s credential-backed and supports JSON, it fits well into both simple and structured use-cases. The project includes:

  • A clear changelog (see CHANGELOG.md) that documents bug fixes and feature additions. Notably, JSON format support was added in 1.1.0 (2025-06-20).
  • An automated release workflow (.github/workflows/release.yml) which runs build and tests then publishes with semantic-release. The workflow also runs npm audit signatures to verify provenance of dependencies prior to publishing.
  • Open-source licensing (MIT) and a Contributor Covenant Code of Conduct included in the project.

GitHub Link

The official repository for this node is available here:

https://github.com/umanamente/n8n-nodes-globals

That repository contains the full source, the CHANGELOG.md, build scripts, and the credential and node TypeScript sources used by n8n. If you want to run, modify or contribute to the node, start there.

Community & Metrics

The packaging and CI indicate active maintenance: semantic-release, prepublish lint rules, and a changelog with recent entries. The repository includes contributor contact information in the package.json (author: Vasily Maslyukov) and a Code of Conduct. The provided files do not include explicit GitHub star counts or contributor lists; check the project page for live metrics.

Final Thoughts

If you manage multiple n8n workflows and need a reliable way to share configuration values, this community node gives you a simple, credential-backed solution. It’s lightweight, supports both human-friendly and structured JSON input, and integrates with n8n’s credential system so values can be securely stored and centrally updated.

To explore further, clone the repository, run the build steps above and then follow the n8n community nodes installation guide linked from the README. The codebase is concise — the parsing logic and node execution are easy to understand — which makes this a practical starting point if you plan to extend the functionality or adapt it to your team’s needs.