Deployment & Operations

What is n8n? Automate work with AI and self-host it on your own server

Máy chủ mini trên bàn làm việc lúc bình minh, cạnh tách cà phê và sổ tay vẽ sơ đồ workflow bằng các ô nối với nhau
In this article

    Suppose every morning you open the signup form on your website, copy each new customer line into Google Sheets, then message the team on Telegram. None of the three jobs is hard, but together they eat half an hour a day, and one mistyped line means the whole team works from wrong data.

    n8n exists to connect those scattered jobs into a chain that runs by itself. This article explains what n8n is, how it works, how to self-host it on your own server with Docker, and a first workflow that puts AI into a real process.

    Quick summary

    • n8n is a workflow automation tool: it connects apps into chains of steps that run automatically, by dragging nodes on a canvas, with no code required.
    • The self-hosted Community Edition is free, with no limit on runs; your data stays on your server.
    • The sample workflow in this article: a customer fills in a form, AI summarises the request, the result goes into Google Sheets, then Telegram alerts the team.

    What is n8n?

    n8n, pronounced “n-eight-n”, short for nodemation, is a workflow automation platform. You draw a diagram of boxes called nodes, each node is an app or an action, and you connect them. When the workflow runs, data flows from node to node as JSON, and each node transforms or forwards it.

    The project was started by Jan Oberhauser in Berlin and launched publicly in October 2019. The company behind it is n8n GmbH, also based in Berlin. The platform is built on Node.js and TypeScript, with more than 400 ready-made integrations for familiar apps such as Google Sheets, Telegram, Slack, Gmail and GitHub. When a ready-made node is not enough, you can drop in a Code node and run JavaScript or Python.

    What sets n8n apart from Zapier and Make is its licence and the way it runs. n8n uses the Sustainable Use License since March 2022, usually called fair-code: the source is public on GitHub, you may self-host and modify it for internal use, but you may not resell n8n as a competing hosted service. Because of that use restriction, n8n does not count as open source under the Open Source Initiative definition, even though the source stays readable.

    From 2024 onward, n8n pushed into AI with the AI Agent node, built on LangChain. The node connects a chat model such as OpenAI or Anthropic with memory and tools, then decides by itself which tool to call to finish the job. So the same workflow can run fixed steps and also leave a step for the model to reason through.

    n8n vs Zapier vs Make

    n8nZapierMake
    Entry price (annual billing)Cloud 20 euros/month; self-hosted freeStarter 19.99 dollars/monthCore 9 dollars/month
    Billed byEach completed workflow run (execution)Each step inside a Zap (task)Each time a module runs (operation)
    Self-host on your own serverYes, freeNoNo
    Insert your own codeYes, JavaScript/PythonLimitedYes, more limited

    Prices in the table were checked on 30 November 2026 on each vendor’s pricing page and may change. The billing unit is the part worth reading carefully: a workflow with four steps costs Zapier three to four tasks and Make four operations, while n8n Cloud counts one execution. Comparing prices without comparing how they count will mislead you.

    How does n8n work?

    An n8n workflow has three kinds of nodes. The question of what n8n is usually comes with another one: how does data flow through a workflow. A trigger node starts the workflow when something happens: a customer fills in a form, a webhook receives a request, a scheduled time arrives, or a new email lands. A processing node transforms the data: filter it, split it, ask AI to summarise it, run a calculation. An action node writes the result somewhere else: add a row to Sheets, send a message, open an issue on GitHub.

    Take a small shop that takes consultation requests through a form on its website. The workflow runs like this: the customer submits the form and the Form Trigger node receives the data; the AI Agent node reads the text and summarises what the customer needs in one sentence; the Google Sheets node writes a new row with the name, the summary and the time; the Telegram node messages the team. From the moment the customer hits submit to the moment the team gets the message takes a few seconds, and nobody has to sit copying data.

    You press Execute workflow to test a run and watch the data pass through each node, so a mistake shows up at the exact node that made it. When everything runs correctly, flip the Active switch and the workflow runs by itself whenever the trigger fires. Each full run like that is one execution, and n8n Cloud bills by the number of executions.

    Self-hosting n8n on your own server with Docker

    Self-hosting is why many people pick n8n over Zapier or Make: no limit on executions, data stays on your server, and the cost is fixed at the price of the VPS. The trade-off is that updates and security become your job. The official n8n docs say it plainly: self-hosting is for people who are comfortable managing servers, and mistakes can lead to data loss or leaked information. If that does not describe you yet, n8n Cloud is the lighter choice.

    The steps below follow the official n8n documentation, checked on 30 November 2026, on a VPS running Ubuntu 24.04 with Docker Engine and the Docker Compose plugin installed. You also need a subdomain, for example n8n.example.com, pointing at the server IP. If Docker is new to you, read What is Docker first.

    Step 1: create a folder for n8n.

    mkdir -p ~/n8n/local-files && cd ~/n8n

    The local-files folder lets nodes read and write files on disk when needed, for example to store form attachments.

    Create the compose.yml file

    Step 2: create a file named compose.yml with the contents below. Replace n8n.example.com with your subdomain and Asia/Bangkok with the timezone you want for scheduled nodes.

    services:
      n8n:
        image: n8nio/n8n:2.49.8
        restart: unless-stopped
        ports:
          - "127.0.0.1:5678:5678"
        environment:
          - N8N_HOST=n8n.example.com
          - N8N_PORT=5678
          - N8N_PROTOCOL=https
          - NODE_ENV=production
          - WEBHOOK_URL=https://n8n.example.com/
          - N8N_PROXY_HOPS=1
          - GENERIC_TIMEZONE=Asia/Bangkok
          - TZ=Asia/Bangkok
          - N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true
          - N8N_RESTRICT_FILE_ACCESS_TO=/files
        volumes:
          - n8n_data:/home/node/.n8n
          - ./local-files:/files
    
    volumes:
      n8n_data:

    A few lines in this file deserve a closer look. 127.0.0.1:5678:5678 opens port 5678 on the server itself only, not to the internet; the outside world reaches n8n through a reverse proxy in front of it. WEBHOOK_URL is the public address other apps call to trigger workflows, so it must match the domain you use, and N8N_PROXY_HOPS=1 tells n8n a proxy sits in front of it. The n8n_data volume holds the SQLite database, the encryption key and all your workflows, so your data survives container restarts. The number 2.49.8 is the stable release checked on 30 November 2026; the latest stable is listed on n8n’s GitHub releases page.

    Start n8n and check it

    Step 3: start n8n and check it.

    docker compose up -d
    docker compose ps
    curl -sf http://localhost:5678/healthz

    The last command returns {"status":"ok"} when n8n is ready. If the container stops right after starting, read the log with docker compose logs n8n to see the error.

    Step 4: put a reverse proxy in front and open the interface. n8n runs behind a reverse proxy such as nginx or Caddy, which issues the HTTPS certificate with Let’s Encrypt and forwards requests to http://127.0.0.1:5678. Remember to enable WebSocket support on the proxy, or the editor will behave erratically. Open https://n8n.example.com in a browser; the first time, n8n asks you to create an admin account with an email and a password. That account exists only on your instance.

    Warning: Do not expose port 5678 directly to the internet, and do not run n8n without HTTPS. The API keys for the apps you connect live inside the n8n_data volume, so back that volume up, and update n8n with docker compose pull followed by docker compose up -d. If you only want access from your own machines, Tailscale is simpler than opening a proxy to the outside.

    One note on the official documentation: the full Docker Compose guide from n8n also adds a sandbox cluster for n8n Assistant, which needs at least 4 GB of RAM, 2 vCPUs and a privileged container. The minimal file above runs n8n only, which is enough for ordinary workflows and far lighter. When you need n8n Assistant, go back and follow the full guide.

    Your first workflow: connecting AI to n8n

    Once n8n is running, your first workflow should be a job you already do by hand every day, not the most complex one you can think of. Take the consultation form example from above: the workflow is four nodes in a row on the canvas.

    The first node is Form Trigger. n8n gives you a ready-made form: set a title, add fields for name, email and request details. When a customer submits the form, their data flows to the next node.

    The second node is AI Agent, where AI does the part that needs reading comprehension. Attach a chat model to it, for example the OpenAI Chat Model or the Anthropic Chat Model, then write a short system message: summarise the customer’s request in one sentence, keeping numbers and product names intact. The model reads the form content, returns the summary, and n8n passes it on. How AI agents fit into the wider software process is the subject of What is ADLC.

    Connect Google Sheets and Telegram

    The third node is Google Sheets. Create the Google credential once inside n8n, pick the spreadsheet, and map which column takes the customer name, which takes the summary, and which takes the time of submission. Each workflow run appends a new row at the bottom of the sheet.

    The last node is Telegram. Create a bot with BotFather, take the token to create a credential in n8n, then set the message text to the customer name and the summary. Your team gets notified as soon as a new customer arrives, without anyone watching the form.

    The only part of this workflow that costs money is the model API key, billed by tokens used. A short summary uses very few tokens, so the cost per run is usually negligible next to the server rent. You can watch the exact figure in the model provider’s usage page instead of guessing and getting surprised at the end of the month.

    Before you switch the workflow Active, test it with the Execute workflow button and fill in the form yourself. Open each node and check the data going in and out matches what you expected. A workflow should only run for real after you have seen one test run travel from the form to Telegram without errors.

    For anything involving money, such as sending invoices or making transfers, do not let AI run the action node on its own. Add a step that waits for a person to approve before that node runs, so a human still presses the final button.

    When to use n8n, and when not to

    Use n8n when a job repeats in the same shape, when data has to travel across several separate apps, or when you want the data to stay on your server instead of passing through a vendor’s machines. It also fits when you want to plug AI into a process you already have, because the AI Agent node lets the model decide which tool to call instead of you drawing every branch in advance. Whether AI will replace programmers outright is a separate question, covered in Will AI replace programmers?.

    Do not use n8n when you have only one or two simple jobs, because the automation features built into each app are usually enough and leave less to look after. Do not self-host either when you are not ready to look after a server: updates, backups and patching are all yours, and a workflow that breaks at midnight will sit there waiting for you to wake up. In that case n8n Cloud or another hosted tool makes more sense, even though you pay per execution.

    The irony is that the strongest point of n8n is also the easiest way to get into trouble: the freedom to self-host comes with full responsibility for running it. A workflow that misfires can send hundreds of wrong messages before you notice, so any workflow that touches customers should first run on real data at a small scale before you switch it Active.

    Frequently asked questions

    Is n8n free?

    Yes. The self-hosted Community Edition is free with no limit on workflow runs; you only pay for the server. The Cloud Starter plan costs 20 euros a month for 2,500 executions, checked on 30 November 2026.

    Do I need to know how to code to use n8n?

    No. Most ordinary workflows only need dragging nodes and filling in forms. Knowing JavaScript or Python helps for cases the ready-made nodes cannot handle, through the Code node.

    Where does my data live when I self-host?

    On your server, inside the Docker n8n_data volume. Your workflows and data stay on your server and do not pass through the vendor’s machines while a workflow runs.

    How is n8n different from Zapier and Make?

    Three main points, as in the comparison table above: n8n can be self-hosted and is free when self-hosted, n8n Cloud bills per completed workflow run instead of per step, and n8n lets you insert JavaScript or Python directly into a workflow.


    Sources

    Assistant Gnurt

    Full-stack developer

    Discuss your project

    Comments

    No comments yet. Be the first!