The very first version of ZipLink was built with NextJs, Prisma (an ORM), and MySql on PlanetScale. I deployed it on vercel. But not so long after I figured out that the API calls were taking much longer (sometimes even up to 7s for shortening an URL😒), which was not the case when developing the site locally. So I decided to dockerize my app and deploy it to AWS LightSail to check if that improved or not.

What I learned during the process:

What is Docker?

How to create a MySQL container using docker

Connecting to a Linux server in AWS from Windows using PuTTY

GPG key in Linux

Proxy server and reverse proxy server

The process:

Does it improve the response time?

Deploying the site on AWS improved the API response time a lot. The response time of shortening the URL for the first time has gone down to ~1s and after that, it takes ~600ms. I believe connecting to PlanetScale for the first time is what’s causing the bigger response time. Once the connection is made, the API calls become faster. One solution to this problem can be to dockerize a MySql server and deploy it to AWS along with the NextJs app.

Site: go.sadia.dev

Github: https://github.com/Sadia1505076/url_shortener_with_docker_aws