← Back to directory
Software Development Involved to set up Automation Orchestrate/Approve

Self-Hosted URL Shortener With Dashboard

Source reviewed Updated 2026-07-07

Turns long URLs into short links via n8n and Airtable, tracking clicks for a custom dashboard.

What it does

Turn your long URLs into short links that track clicks in real time via n8n and Airtable. You get a custom dashboard showing statistics as users visit your shortened links, all without needing complex hosting setup. Customize the solution with basic JavaScript to fit your specific needs.

Step by step

  1. Configure an HTTP webhook in n8n to accept POST requests with a JSON body containing the 'longUrl' field.
  2. Use the Set node to extract the URL and pass it to a Code node for SHA-256 hashing using Node.js crypto module.
  3. Connect the hashed ID to an Airtable Create Record node, mapping the hash as the primary key and the original URL as a separate field.

Where the LLM does the work

  • Generate JavaScript code snippets that handle collision detection by checking if a hash already exists in Airtable before saving.
  • Draft the logic for the redirect endpoint to ensure it returns a proper HTTP 301 status with the correct Location header.
  • Create a SQL-like query or Airtable formula to aggregate click counts per short code for the dashboard statistics view.

Watch out for

Hash collisions can occur if multiple URLs produce the same ID, so implement a retry loop that appends a random suffix until a unique key is found.
The dashboard will show stale data if Airtable records are not updated atomically on every redirect, use Airtable's update record endpoint inside the same workflow as the redirect check.
Security headers might be missing from the webhook response allowing XSS attacks, add a Set node to inject Content-Security-Policy and X-Frame-Options headers before sending the redirect.

Tools that fit

n8n Service Workflow orchestration and hosting
Airtable Service Storing short URLs and click statistics
Crypto API Generating SHA256 hashes for IDs

The agent brief

Everything your agent needs, including the gotchas. Copy it and go.
agent-brief.md
You are helping me build the following AI agent workflow.

## Goal
Self-Hosted URL Shortener With Dashboard: Turns long URLs into short links via n8n and Airtable, tracking clicks for a custom dashboard.

## Specification
- What it does: Turn your long URLs into short links that track clicks in real time via n8n and Airtable. You get a custom dashboard showing statistics as users visit your shortened links, all without needing complex hosting setup. Customize the solution with basic JavaScript to fit your specific needs.
- Trigger: Triggered by an event (Event · on webhook call)
- Autonomy: Fully hands-off
- Expected setup effort: a few focused days
- Tools/services involved:
  - n8n: Workflow orchestration and hosting
  - Airtable: Storing short URLs and click statistics
  - Crypto: Generating SHA256 hashes for IDs

## Known pitfalls, handle each one explicitly in your implementation
1. Hash collisions can occur if multiple URLs produce the same ID, so implement a retry loop that appends a random suffix until a unique key is found.
2. The dashboard will show stale data if Airtable records are not updated atomically on every redirect, use Airtable's update record endpoint inside the same workflow as the redirect check.
3. Security headers might be missing from the webhook response allowing XSS attacks, add a Set node to inject Content-Security-Policy and X-Frame-Options headers before sending the redirect.

## Reference implementation
https://n8n.io/workflows/1093 (workflow template)
Fetch and inspect this before building. If it matches my stack, adapt it;
if not, rebuild the pattern with my tools.

## Process requirements
1. Before building: ask me which of the listed tools I actually use and
   what my platform is (n8n / Make / code / other). Do not assume.
2. Adapt the pattern to my answers; do not force the reference stack.
3. Address every pitfall above; tell me how you handled each.
4. Provide a test plan I can run before letting this touch real data.
5. Ask before any step that sends messages, modifies data, or spends money.

Source: https://usecasesforagents.com/use-case/self-hosted-url-shortener-with-dashboard/ via usecasesforagents.com

Frequently asked questions

Can I use a different Automation Platform than n8n?

Yes. n8n is only the example automation platform in this recipe. The same flow works with Home Assistant. Swap the automation platform connection and keep the rest of the setup as written.

Want this running in your business?

This is what I do. I design and build AI agents like this one, and keep them running. If you want it set up for your team instead of doing it yourself, get in touch.
Get in touch →

Who it's for

Built for developers who want the busywork around code automated, not the code itself.

Seen in the wild

← Back to directory