Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Let's build a URL shortener in Go
Search
Hanji Chung
December 18, 2023
Technology
0
270
Let's build a URL shortener in Go
Hanji_DevFest2023
Hanji Chung
December 18, 2023
Tweet
Share
More Decks by Hanji Chung
See All by Hanji Chung
PGO (Profile-Guided Optimization)_ The Secret Weapon for Accelerating Golang Programs
msc7wc91w
0
220
Other Decks in Technology
See All in Technology
SQLだけでマイグレーションしたい!
makki_d
0
1.2k
障害対応訓練、その前に
coconala_engineer
0
200
AWS re:Invent 2025~初参加の成果と学び~
kubomasataka
0
190
ハッカソンから社内プロダクトへ AIエージェント「ko☆shi」開発で学んだ4つの重要要素
sonoda_mj
6
1.7k
日本の AI 開発と世界の潮流 / GenAI Development in Japan
hariby
1
450
モダンデータスタックの理想と現実の間で~1.3億人Vポイントデータ基盤の現在地とこれから~
taromatsui_cccmkhd
2
270
ESXi のAIOps だ!2025冬
unnowataru
0
360
Strands AgentsとNova 2 SonicでS2Sを実践してみた
yama3133
1
1.9k
AWSの新機能をフル活用した「re:Inventエージェント」開発秘話
minorun365
2
450
202512_AIoT.pdf
iotcomjpadmin
0
140
AI駆動開発ライフサイクル(AI-DLC)の始め方
ryansbcho79
0
180
[2025-12-12]あの日僕が見た胡蝶の夢 〜人の夢は終わらねェ AIによるパフォーマンスチューニングのすゝめ〜
tosite
0
180
Featured
See All Featured
Abbi's Birthday
coloredviolet
0
3.8k
Noah Learner - AI + Me: how we built a GSC Bulk Export data pipeline
techseoconnect
PRO
0
74
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
0
1.8k
What does AI have to do with Human Rights?
axbom
PRO
0
1.9k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
300
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
110
The Cult of Friendly URLs
andyhume
79
6.7k
Automating Front-end Workflow
addyosmani
1371
200k
Docker and Python
trallard
47
3.7k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.6k
GraphQLとの向き合い方2022年版
quramy
50
14k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
9.1k
Transcript
Let's build a URL shortener in Go 韓吉 (Hanji)
About me • Freelancer, but open to work • 3+
backend work experience • Only using Golang in toy projects My LinkedIn
Slides
Github repo
Summary • Project Setup 🛠 • Igniting The Web Server
☄ • Store Service Setup 🛠 • Storage API Design • Shortener Generator Algorithm • Handlers & Endpoints
Project Setup 🛠 • Initialize the go project, using go
mod $ go mod init your-projectname • Create main.go file and add the code • Installing project dependencies $ go get github.com/go-redis/redis/v8 $ go get -u github.com/gin-gonic/gin
Download Redis • https://redis.io/docs/install/install-redis/
Igniting The Web Server ☄
Igniting The Web Server ☄ • Launching the web server
for first time • Run again the main.go file and go to http://localhost:9808/ in the browser or any rest client tool
Store Service Setup 🛠
Create a sub-directory
Setting up our wrappers around Redis
Storage API design and Implementation
func SaveUrlMapping
func RetrieveInitialUrl
Testing 🧪
Install the testing tools $ go get github.com/stretchr/testify
Setting up the the tests shell
Test the store service initialization
Test the storage APIs
Shortener Generator Algorithm
Create a sub-directory
SHA256
Base58 Encoded
Generate algorithm
Testing
Handlers & Endpoints
Create a sub-directory
Define handlers stubs
Setting endpoints
Request model definition
func CreateShortUrl
func HandleShortUrlRedirect
Demo time!!!
Demo curl --request POST --data '{ "long_url": "https://www.google.com/", "user_id" :
"123456789" }' http://localhost:9808/create-short-url
Reference • https://www.eddywm.com/lets-build-a-url-shortener-in-go/