<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/building-an-url-shortener-with-bun-oadcdpc9b" -->

---
title: Building an URL Shortener with Bun | daily.dev
description: Learn how to build a URL shortener using Bun, Elysia, and MySQL. Understand the process of converting long URLs into shorter URLs and how to implement features...
canonical: https://daily.dev/posts/building-an-url-shortener-with-bun-oadcdpc9b
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Building an URL Shortener with Bun | daily.dev
og:description: Learn how to build a URL shortener using Bun, Elysia, and MySQL. Understand the process of converting long URLs into shorter URLs and how to implement features...
og:url: https://daily.dev/posts/building-an-url-shortener-with-bun-oadcdpc9b
og:image: https://api.daily.dev/og/posts/OAdcdPC9B.png
og:image:alt: Building an URL Shortener with Bun
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Building an URL Shortener with Bun

**[asayer](https://daily.dev/sources/asayer)** · 10 min read · 39 upvotes · 0 comments

## Summary

Learn how to build a URL shortener using Bun, Elysia, and MySQL. Understand the process of converting long URLs into shorter URLs and how to implement features like analytics. Set up your development environment, create data models, and implement the URL-shortening logic.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.openreplay.com/building-an-url-shortener-with-bun/>

---

Tags: [#webdev](https://daily.dev/tags/webdev), [#javascript](https://daily.dev/tags/javascript), [#mysql](https://daily.dev/tags/mysql), [#bun](https://daily.dev/tags/bun)

[View this post on daily.dev](https://daily.dev/posts/building-an-url-shortener-with-bun-oadcdpc9b)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Building an URL Shortener with Bun","url":"https://daily.dev/posts/building-an-url-shortener-with-bun-oadcdpc9b","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/building-an-url-shortener-with-bun-oadcdpc9b"},"datePublished":"2024-04-14T21:53:42.108Z","dateModified":"2024-05-09T08:43:33.910Z","description":"Learn how to build a URL shortener using Bun, Elysia, and MySQL. Understand the process of converting long URLs into shorter URLs and how to implement features...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ab0e1b0baf0847abfcf0793ddc7ec19c?_a=AQAEufR","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/ab0e1b0baf0847abfcf0793ddc7ec19c?_a=AQAEufR","isAccessibleForFree":true,"articleSection":"asayer","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"asayer","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/be8d9d38650943c8a1718ba79f23e9ac","url":"https://daily.dev/sources/asayer"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/building-an-url-shortener-with-bun-oadcdpc9b","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":39},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"webdev,javascript,mysql,bun","timeRequired":"PT10M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"asayer","item":"https://daily.dev/sources/asayer"},{"@type":"ListItem","position":3,"name":"Building an URL Shortener with Bun"}]}
```

