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

n8n-nodes-text-templater-jinja2

v1.0.3

Published

n8n node for text templating using Jinja2-like syntax

Downloads

10

Readme

n8n-nodes-text-templater-jinja2

An n8n community node for text templating using Jinja2-like syntax. Perfect for rendering dynamic prompts for LLMs and other text generation tasks.

Features

  • Jinja2-compatible templating: Uses Nunjucks (a JavaScript implementation of Jinja2) for powerful templating
  • Dynamic context: Supports JSON context variables and automatic access to input item data
  • Error handling: Graceful error handling with detailed error messages
  • n8n integration: Fully compatible with n8n workflows

Installation

Option 1: Install from npm (Recommended)

npm install n8n-nodes-text-templater-jinja2

Option 2: Manual Installation

  1. Clone or download this repository
  2. Navigate to the project directory
  3. Install dependencies:
    npm install
  4. Build the project:
    npm run build
  5. Copy the dist folder to your n8n custom nodes directory

Option 3: Docker Installation

For local development and testing with Docker, you can install the node in an n8n Docker container.

Method A: Using npm in Docker

  1. Create a custom Dockerfile:

    FROM n8nio/n8n:latest
    
    USER root
    
    # Install the custom node
    RUN npm install -g n8n-nodes-text-templater-jinja2
    
    USER node
  2. Build and run:

    docker build -t n8n-with-templater .
    docker run -it --rm \
      --name n8n-templater \
      -p 5678:5678 \
      -e N8N_BASIC_AUTH_ACTIVE=true \
      -e N8N_BASIC_AUTH_USER=user \
      -e N8N_BASIC_AUTH_PASSWORD=password \
      n8n-with-templater

Method B: Manual Installation in Docker

  1. Create a custom nodes directory:

    mkdir -p ./custom-nodes
  2. Clone and build the node:

    cd custom-nodes
    git clone https://github.com/potnoddle/n8n-nodes-text-templater-jinja2.git
    cd n8n-nodes-text-templater-jinja2
    npm install
    npm run build
    cd ../..
  3. Run n8n with volume mount:

    docker run -it --rm \
      --name n8n-templater \
      -p 5678:5678 \
      -v $(pwd)/custom-nodes:/home/node/.n8n/custom \
      -e N8N_CUSTOM_EXTENSIONS=/home/node/.n8n/custom \
      n8nio/n8n:latest

Method C: Using Docker Compose

Create a docker-compose.yml file:

version: '3.8'
services:
  n8n:
    image: n8nio/n8n:latest
    ports:
      - "5678:5678"
    environment:
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER=user
      - N8N_BASIC_AUTH_PASSWORD=password
      - N8N_CUSTOM_EXTENSIONS=/home/node/.n8n/custom
    volumes:
      - ./custom-nodes:/home/node/.n8n/custom
      - n8n_data:/home/node/.n8n
    command: n8n start
    restart: unless-stopped

volumes:
  n8n_data:

Then run:

docker-compose up -d

Accessing Your Node

Once n8n is running with the custom node installed:

  1. Open your browser to http://localhost:5678
  2. Log in with the credentials you set
  3. In the workflow editor, search for "Text Templater (Jinja2)" in the nodes panel
  4. Drag and drop it into your workflow

Usage

Basic Example

  1. Add the "Text Templater (Jinja2)" node to your workflow
  2. Configure the node:
    • Template: Hello {{ name }}! Welcome to {{ location }}.
    • Context: {"name": "John", "location": "n8n"}
  3. Connect input data and run the workflow

Output: Hello John! Welcome to n8n.

Advanced Example with Input Data

Template:

Generate a summary for the following task:

Task: {{ $item.title }}
Description: {{ $item.description }}
Priority: {{ $item.priority }}

Please provide a concise summary in 2-3 sentences.

Context: {"model": "gpt-4", "temperature": 0.7}

Input Item:

{
  "title": "Implement user authentication",
  "description": "Add OAuth2 login system with Google and GitHub providers",
  "priority": "high"
}

Rendered Output:

Generate a summary for the following task:

Task: Implement user authentication
Description: Add OAuth2 login system with Google and GitHub providers
Priority: high

Please provide a concise summary in 2-3 sentences.

Node Properties

Template

  • Type: String (multiline)
  • Required: Yes
  • Description: The Jinja2 template to render. Supports all Nunjucks/Jinja2 syntax including variables, filters, conditionals, and loops.

Context

  • Type: JSON
  • Required: Yes
  • Description: JSON object containing variables available in the template. These are merged with the input item data.

Template Syntax

The node uses Nunjucks templating syntax, which is compatible with Jinja2:

Variables

{{ variable_name }}
{{ object.property }}
{{ array[0] }}

Conditionals

{% if condition %}
  Content if true
{% else %}
  Content if false
{% endif %}

Loops

{% for item in items %}
  - {{ item.name }}
{% endfor %}

Filters

{{ text | upper }}
{{ number | round(2) }}
{{ date | date('YYYY-MM-DD') }}

Special Variables

  • $item: Contains the current input item's JSON data
  • All variables from the Context JSON are available at root level

Error Handling

If template rendering fails, the node will output:

  • error: The error message
  • All original input item data

Development

Prerequisites

  • Node.js 16+
  • npm or yarn

Setup

git clone <repository-url>
cd n8n-nodes-text-templater-jinja2
npm install

Build

npm run build

Development Mode

npm run dev

Testing

npm test

Deployment to n8n Community

1. Prepare for Publishing

  1. Ensure your package.json has the correct metadata:

    {
      "name": "n8n-nodes-text-templater-jinja2",
      "version": "1.0.0",
      "description": "n8n node for text templating using Jinja2 syntax",
      "main": "dist/index.js",
      "keywords": ["n8n", "node", "templating", "jinja2"],
      "author": "Your Name",
      "license": "MIT"
    }
  2. Build the project:

    npm run build
  3. Test the built package locally

2. Publish to npm

npm login
npm publish

3. Submit to n8n Community

  1. Go to the n8n Community Nodes page
  2. Click "Submit a Node"
  3. Fill out the submission form:
    • Node Name: Text Templater (Jinja2)
    • Package Name: n8n-nodes-text-templater-jinja2
    • Description: n8n node for text templating using Jinja2-like syntax
    • Tags: templating, text, jinja2, nunjucks
    • Repository URL: Your GitHub repository URL
    • Documentation URL: Link to this README

4. Community Guidelines

  • Follow n8n's node development guidelines
  • Ensure proper error handling
  • Provide comprehensive documentation
  • Test thoroughly before submission
  • Use semantic versioning

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

MIT License - see LICENSE file for details

Support

  • Create an issue on GitHub
  • Check the n8n community forums
  • Review the n8n documentation

Changelog

v1.0.0

  • Initial release
  • Basic Jinja2 templating functionality
  • JSON context support
  • Error handling