Lnk
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:
- Download and start the database Docker image for Postgres
- Fetch & compile elixir dependencies
- Create & migrate the database
- Stop the Docker container
Start the Server
From the project root, run make server
to:
- Start the Docker container
- Start the backend server
- Start the frontend web application
- Go to http://localhost:8080 to use the web application
Stop the Server
From the project root, run make stop
to:
- Stop the backend server
- Stop the frontend server
- 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 :)