kinson / LnK

A URL Shortener

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lnk

Github Actions

Yet another URL shortener.

Getting Started

Before getting started, the following software needs to be installed:

Setup

From the project root, run make setup to:

  1. Download and start the database Docker image for Postgres
  2. Fetch & compile elixir dependencies
  3. Create & migrate the database
  4. Stop the Docker container

Start the Server

From the project root, run make server to:

  1. Start the Docker container
  2. Start the backend server
  3. Start the frontend web application
  4. Go to http://localhost:8080 to use the web application

Stop the Server

From the project root, run make stop to:

  1. Stop the backend server
  2. Stop the frontend server
  3. Stop the Docker container

Notes on Approach

Dark Mode Toggle

Full disclosure, I took these icons from a project I contributed them to previously, you can find that code here.

Using Next.js

I opted to use Next.js on the frontend because I have found it makes the spin up process for a new react app even quicker (at least for me) than create-react-app.

Using TypeScript

I have not used TypeScript on the frontend before (aside from React Native), but I opted to for this project because it feels like a safer choice than JavaScript in general and it provided piece of mind while rapidly developing this website.

Next Steps

I did not want to overengineer this project at the risk of making it too time consuming to reason about, but some things I would add in the future are:

  • A caching mechanism on the backend (possibly using this library) to avoid a round trip to the database when querying a url
  • Continuous deployment to a free-tier service from a web hosting service
  • Better API response validation and typing using TypeScript
  • A feature to let people choose custom shortened URLs

If you have made it this far, thanks for reading :)

About

A URL Shortener


Languages

Language:Elixir 50.2%Language:TypeScript 42.6%Language:Dockerfile 4.2%Language:Makefile 1.6%Language:JavaScript 0.8%Language:Shell 0.4%Language:CSS 0.3%