Skip to main content

Build a self-hosted URL shortener with a dashboard

Workflow preview

Workflow preview
100%
Build a self-hosted URL shortener with a dashboard preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

This workflow creates an automatic self hosted URL shortener. It consists of three sub workflows: 1. Short URL creation for extracting the provided long URL, generating an ID, and saving the record...

Best for

  • Miscellaneous automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.webhook, n8n-nodes-base.set, n8n-nodes-base.if, n8n-nodes-base.crypto, n8n-nodes-base.airtable, n8n-nodes-base.function

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by mohamed ali.

Original n8n.io source

1.1 Workflow description

Title
Build a self-hosted URL shortener with a dashboard
Workflow name
Build a self-hosted URL shortener with a dashboard

This workflow creates an automatic self-hosted URL shortener. It consists of three sub-workflows:

  1. Short URL creation for extracting the provided long URL, generating an ID, and saving the record in the database. It returns a short link as a result.
  2. Redirection for extracting the ID value, validating the existence of its correspondent record in the database, and returning a redirection page after updating the visits (click) count.
  3. Dashboard for calculating simple statistics about the saved record and displaying them on a dashboard.

Read more about this use case and how to set up the workflow in the blog post How to build a low-code, self-hosted URL shortener in 3 steps.

Prerequisites

  • A local proxy set up that redirects the n8n.ly domain to your n8n instance
  • An Airtable account and credentials
  • Basic knowledge of JavaScript, HTML, and CSS

Nodes

  • Webhook nodes trigger the sub-workflows on calls to a specified link.
  • IF nodes route the workflows based on specified query parameters.
  • Set nodes set the required values returned by the previous nodes (id, longUrl, and shortUrl).
  • Airtable nodes retrieve records (values) from or append records to the database.
  • Function node calculates statistics on link clicks to be displayed on the dashboard, as well as its design.
  • Crypto node generates a SHA256 hash.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Webhook

Type / Role
n8n-nodes-base.webhook - webhook
Config choices
Version 1

Block 2 - Extract URL

Type / Role
n8n-nodes-base.set - set
Config choices
Version 1

Block 3 - Check URL

Type / Role
n8n-nodes-base.if - if
Config choices
Version 1

Block 4 - Crypto

Type / Role
n8n-nodes-base.crypto - crypto
Config choices
Version 1

Block 5 - Airtable

Type / Role
n8n-nodes-base.airtable - airtable
Config choices
Version 1

Block 6 - Set ID,shortUrl,longUrl

Type / Role
n8n-nodes-base.set - set
Config choices
Version 1

Block 7 - Find by ID

Type / Role
n8n-nodes-base.airtable - airtable
Config choices
Version 1

Block 8 - Already exists ?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 1

Block 9 - Set Output

Type / Role
n8n-nodes-base.set - set
Config choices
Version 1

Block 10 - Set Error output

Type / Role
n8n-nodes-base.set - set
Config choices
Version 1

Block 11 - Set Output1

Type / Role
n8n-nodes-base.set - set
Config choices
Version 1

Block 12 - Set input

Type / Role
n8n-nodes-base.set - set
Config choices
Version 1

Block 13 - Webhook1

Type / Role
n8n-nodes-base.webhook - webhook
Config choices
Version 1

Block 14 - Set Error output1

Type / Role
n8n-nodes-base.set - set
Config choices
Version 1

Block 15 - Check Id

Type / Role
n8n-nodes-base.if - if
Config choices
Version 1

Block 16 - Find by ID1

Type / Role
n8n-nodes-base.airtable - airtable
Config choices
Version 1

Block 17 - Already exists ?1

Type / Role
n8n-nodes-base.if - if
Config choices
Version 1

Block 18 - Set Output2

Type / Role
n8n-nodes-base.set - set
Config choices
Version 1

Block 19 - Extract Id

Type / Role
n8n-nodes-base.set - set
Config choices
Version 1

Block 20 - 404 Error

Type / Role
n8n-nodes-base.set - set
Config choices
Version 1

Block 21 - Update clicks

Type / Role
n8n-nodes-base.airtable - airtable
Config choices
Version 1

Block 22 - Prepare clicks count

Type / Role
n8n-nodes-base.set - set
Config choices
Version 1

Block 23 - Webhook2

Type / Role
n8n-nodes-base.webhook - webhook
Config choices
Version 1

Block 24 - Find by ID2

Type / Role
n8n-nodes-base.airtable - airtable
Config choices
Version 1

Showing the first 24 of 26 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Build a self-hosted URL shortener with a dashboard
Complexity advanced
Nodes 26
Categories Miscellaneous
Author mohamed ali
Published 24 May 2021

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/1093/1093.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Build a self-hosted URL shortener with a dashboard do?

This workflow creates an automatic self hosted URL shortener. It consists of three sub workflows: 1. Short URL creation for extracting the provided long URL, generating an ID, and saving the record...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Miscellaneous use case.