### Install http-server using npm Source: https://github.com/kds2000a/n8n/blob/master/packages/@n8n/nodes-langchain/nodes/trigger/ChatTrigger/README.md Installs the http-server package globally using npm, which is required for serving local files over HTTP. ```bash npm install -g http-server ``` -------------------------------- ### Start HTTPS Server with http-server Source: https://github.com/kds2000a/n8n/blob/master/packages/@n8n/nodes-langchain/nodes/trigger/ChatTrigger/README.md Starts a local HTTPS server using http-server to serve the built chat bundle files from the specified directory. It uses the generated certificate and key, enables CORS, and listens on port 8443. ```bash http-server packages/frontend/@n8n/chat/dist -g -S -C cert.pem -K key.pem --port 8443 --cors ``` -------------------------------- ### Install Dependencies and Build n8n Source: https://github.com/kds2000a/n8n/blob/master/CONTRIBUTING.md Commands to install all project dependencies using pnpm and build the n8n code. ```bash pnpm install pnpm build ``` -------------------------------- ### Install project dependencies with pnpm Source: https://github.com/kds2000a/n8n/blob/master/packages/frontend/@n8n/design-system/README.md Installs all the necessary dependencies for the project using the pnpm package manager. This is typically the first step before running any other commands. ```shell pnpm install ``` -------------------------------- ### Start n8n Development and Production Source: https://github.com/kds2000a/n8n/blob/master/CONTRIBUTING.md Commands to start n8n for regular use and for development mode with automatic reloading. ```bash pnpm start ./packages/cli/bin/n8n start --tunnel pnpm dev ``` -------------------------------- ### Install Build Tools (Windows) Source: https://github.com/kds2000a/n8n/blob/master/CONTRIBUTING.md Installs Windows build tools globally using npm, a requirement for n8n development on Windows. ```bash npm add -g windows-build-tools ``` -------------------------------- ### Install Build Tools (CentOS) Source: https://github.com/kds2000a/n8n/blob/master/CONTRIBUTING.md Installs necessary build tools for CentOS systems, required for n8n development. ```bash yum install gcc gcc-c++ make ``` -------------------------------- ### Install Build Tools (Debian/Ubuntu) Source: https://github.com/kds2000a/n8n/blob/master/CONTRIBUTING.md Installs necessary build tools for Debian/Ubuntu systems, required for n8n development. ```bash apt-get install -y build-essential python ``` -------------------------------- ### Install json-schema-to-zod Source: https://github.com/kds2000a/n8n/blob/master/packages/@n8n/json-schema-to-zod/README.md Installs the 'json-schema-to-zod' package using npm. ```sh npm install @n8n/json-schema-to-zod ``` -------------------------------- ### Install n8n-node-dev CLI Source: https://github.com/kds2000a/n8n/blob/master/packages/node-dev/README.md Installs the n8n-node-dev command-line interface globally using npm. This tool is essential for developing n8n nodes and credentials. ```bash npm install n8n-node-dev -g ``` -------------------------------- ### Build Chat Bundle with pnpm Source: https://github.com/kds2000a/n8n/blob/master/packages/@n8n/nodes-langchain/nodes/trigger/ChatTrigger/README.md Navigates to the chat package directory and builds the chat bundle using the 'build' script defined in its package.json, typically managed with pnpm. ```bash cd packages/frontend/@n8n/chat && pnpm run build ``` -------------------------------- ### Start Storybook for development and hot-reloading Source: https://github.com/kds2000a/n8n/blob/master/packages/frontend/@n8n/design-system/README.md Compiles and hot-reloads the Storybook environment for component development. This command allows for live preview and instant updates as code changes. ```shell pnpm storybook ``` -------------------------------- ### Install and Embed n8n Chat via npm Source: https://github.com/kds2000a/n8n/blob/master/packages/frontend/@n8n/chat/README.md Installs the n8n Chat package using npm and embeds it into a JavaScript application. This involves importing the necessary CSS and the createChat function, then initializing the chat with the webhook URL. ```sh npm install @n8n/chat ``` ```ts import '@n8n/chat/style.css'; import { createChat } from '@n8n/chat'; createChat({ webhookUrl: 'YOUR_PRODUCTION_WEBHOOK_URL' }); ``` -------------------------------- ### Run Benchmark with Custom Scenarios via Docker Source: https://github.com/kds2000a/n8n/blob/master/packages/@n8n/benchmark/README.md Load custom benchmark scenarios using the n8n-benchmark Docker image. This example mounts a local 'scenarios' directory into the container and runs benchmarks using those custom scenarios. ```sh # Assuming your scenarios are located in "./scenarios", mount them into "/scenarios" in the container docker run -v ./scenarios:/scenarios ghcr.io/n8n-io/n8n-benchmark:latest run \ --n8nBaseUrl=https://instance.url \ --n8nUserEmail=InstanceOwner@email.com \ --n8nUserPassword=InstanceOwnerPassword \ --vus=5 \ --duration=1m \ --testScenariosPath=/scenarios ``` -------------------------------- ### Run n8n with npx Source: https://github.com/kds2000a/n8n/blob/master/README.md Instantly try n8n using npx, which requires Node.js to be installed. This command initiates the n8n editor. ```shell npx n8n ``` -------------------------------- ### Node Parameter Translation Example Source: https://github.com/kds2000a/n8n/blob/master/packages/frontend/@n8n/i18n/docs/README.md This example shows how to translate 'displayName', 'placeholder', and 'description' for a string parameter named 'owner'. ```json { "nodeView.owner.displayName": "πŸ‡©πŸ‡ͺ Repository Owner", "nodeView.owner.placeholder": "πŸ‡©πŸ‡ͺ n8n-io", "nodeView.owner.description": "πŸ‡©πŸ‡ͺ Owner of the repository" } ``` -------------------------------- ### Start n8n with Tunnel for Webhooks Source: https://github.com/kds2000a/n8n/blob/master/docker/images/n8n/README.md This snippet shows how to start n8n with a tunnel enabled, which is necessary for webhooks to trigger workflows from external services. It's intended for local development and testing only. The command includes creating a Docker volume and running the n8n container with the `--tunnel` argument. ```bash docker volume create n8n_data docker run -it --rm \ --name n8n \ -p 5678:5678 \ -v n8n_data:/home/node/.n8n \ docker.n8n.io/n8nio/n8n \ start --tunnel ``` -------------------------------- ### Start n8n in Docker Source: https://github.com/kds2000a/n8n/blob/master/docker/images/n8n/README.md This snippet demonstrates how to start the n8n service using Docker. It creates a Docker volume for persistent data storage and maps the container's port 5678 to the host machine. The workflow data, including webhook URLs and encryption keys, is saved in an SQLite database within the mounted volume. ```bash docker volume create n8n_data docker run -it --rm \ --name n8n \ -p 5678:5678 \ -v n8n_data:/home/node/.n8n \ docker.n8n.io/n8nio/n8n ``` -------------------------------- ### Run Benchmark CLI Locally without Docker Source: https://github.com/kds2000a/n8n/blob/master/packages/@n8n/benchmark/README.md Execute the n8n-benchmark CLI locally without Docker. This requires building the project and having k6 and Node.js installed. The command runs tests against a local n8n instance using specified credentials. ```sh pnpm build # Run tests against http://localhost:5678 with specified email and password N8N_USER_EMAIL=user@n8n.io N8N_USER_PASSWORD=password ./bin/n8n-benchmark run ``` -------------------------------- ### Basic Resolvable Expression Source: https://github.com/kds2000a/n8n/blob/master/packages/@n8n/codemirror-lang/test/expressions/cases.txt This snippet shows a simple arithmetic operation within a resolvable block. It demonstrates the basic syntax for evaluating expressions in n8n. ```n8n {{ 1 + 1 }} ``` -------------------------------- ### Run n8n E2E Tests (PNPM) Source: https://github.com/kds2000a/n8n/blob/master/CONTRIBUTING.md Commands to install Cypress dependencies and run E2E tests in different modes: interactive UI, development mode with hot reloading, and headless mode. ```bash pnpm cypress:install pnpm test:e2e:ui pnpm test:e2e:dev pnpm test:e2e:all ``` -------------------------------- ### Resolvable with Nested and Escaped Brackets Source: https://github.com/kds2000a/n8n/blob/master/packages/@n8n/codemirror-lang/test/expressions/cases.txt This example shows how n8n handles resolvable expressions with nested and escaped square brackets, including single, double, and triple bracket scenarios. ```n8n {{ he [ abc ] llo }} ``` ```n8n {{ he [[ abc ]] llo }} ``` ```n8n {{ he [[[ abc ]]] llo }} ``` -------------------------------- ### Set Default Locale and Start n8n Source: https://github.com/kds2000a/n8n/blob/master/packages/frontend/@n8n/i18n/docs/README.md This snippet demonstrates how to set the default locale for n8n using an environment variable and then start the n8n process. It shows the expected output indicating the locale being used. ```bash export N8N_DEFAULT_LOCALE=de pnpm start ``` -------------------------------- ### Resolvable with Special Characters Source: https://github.com/kds2000a/n8n/blob/master/packages/@n8n/codemirror-lang/test/expressions/cases.txt This example illustrates how n8n handles resolvable expressions containing a wide array of special characters. It includes various symbols and punctuation marks within the expression. ```n8n {{ he ()[]{<>~`!@#$%^&*-_+=|\;':",./?{ llo }} ``` -------------------------------- ### String Parameter Translation Example Source: https://github.com/kds2000a/n8n/blob/master/packages/frontend/@n8n/i18n/docs/README.md Shows the translation keys for a string parameter, including 'displayName', 'placeholder', and 'description'. ```typescript { displayName: 'Repository Owner', name: 'owner', // key to use in translation type: 'string', required: true, placeholder: 'n8n-io', description: 'Owner of the repository.', }, ``` -------------------------------- ### Basic Dependency Injection with @n8n/di Source: https://github.com/kds2000a/n8n/blob/master/packages/@n8n/di/README.md Demonstrates how to use the @n8n/di container to inject services. It shows how to define services using the @Service() decorator and how to retrieve and use them via the Container.get() method. This example requires experimental decorators and emitDecoratorMetadata to be enabled in tsconfig.json. ```typescript import { Container, Service } from 'typedi'; @Service() class ExampleInjectedService { printMessage() { console.log('I am alive!'); } } @Service() class ExampleService { constructor( public injectedService: ExampleInjectedService ) {} } const serviceInstance = Container.get(ExampleService); serviceInstance.injectedService.printMessage(); ``` -------------------------------- ### Mixed Plaintext and Resolvable Sequences Source: https://github.com/kds2000a/n8n/blob/master/packages/@n8n/codemirror-lang/test/expressions/cases.txt These snippets demonstrate various combinations of plaintext and resolvable expressions, showing how n8n parses sequences of plain text interspersed with evaluable expressions. ```n8n text {{ 1 + 1 }} ``` ```n8n {{ 1 + 1 }} Plaintext ``` ```n8n text {{ 1 + 1 }} text ``` ```n8n {{ 1 + 1 }} text {{ 1 + 1 }} ``` ```n8n text {{ 1 + 1 }} text {{ 1 + 1 }} ``` ```n8n {{ 1 + 1 }} text {{ 1 + 1 }} text ``` -------------------------------- ### Base Text Translation Example (JSON) Source: https://github.com/kds2000a/n8n/blob/master/packages/frontend/@n8n/i18n/docs/README.md An example of a JSON file containing translated base UI text for n8n. The keys represent UI elements (e.g., category names), and the values are the translated strings, prefixed with 'πŸ‡©πŸ‡ͺ' to indicate German translation. ```json { "nodeCreator.categoryNames.analytics": "πŸ‡©πŸ‡ͺ Analytics", "nodeCreator.categoryNames.communication": "πŸ‡©πŸ‡ͺ Communication", "nodeCreator.categoryNames.coreNodes": "πŸ‡©πŸ‡ͺ Core Nodes" } ``` -------------------------------- ### Plaintext Handling Source: https://github.com/kds2000a/n8n/blob/master/packages/@n8n/codemirror-lang/test/expressions/cases.txt This snippet demonstrates how n8n processes plain text, including cases with single braces or combinations of braces that do not form valid resolvable expressions. ```n8n text ``` ```n8n {text} ``` ```n8n ``` ```n8n ``` ```n8n { ``` ```n8n { }} ``` -------------------------------- ### Update Import Paths for Local Chat Bundle Source: https://github.com/kds2000a/n8n/blob/master/packages/@n8n/nodes-langchain/nodes/trigger/ChatTrigger/README.md Modifies the script and link tags in 'templates.ts' to use the locally served chat bundle and CSS file from the HTTPS server running on localhost:8443. This ensures the application loads the local development version. ```html