I wanted to show case my problem solving abilities by using optimal algorithms for large scale and distributed applications, in this case a URL shortener app.
The code also showcases:
- SOLID principles ✔️
- Code best practices ✔️
- Database indexes ✔️
- Caching ✔️
- Automated tests with Rspec ✔️
- API only mode provided by Rails for fast responses ✔️
Follow this link to see the most relevant code.
See the system design here
- Postgres 15.x
- Redis 7.x
bin/setup
rspec
rails s
Short a URL:
curl --location 'localhost:3000/url' --form 'long="https://gorails.com/setup/macos/13-ventura"'
{
"id": 1,
"short": "99hcey2kh",
"long": "https://gorails.com/setup/macos/13-ventura",
"created_at": "2023-10-06T17:16:53.044Z",
"updated_at": "2023-10-06T17:16:53.044Z"
}
View the long URL:
curl --location 'localhost:3000/v/99hcey2kh'
{
"long": "https://gorails.com/setup/macos/13-ventura"
}
Short a URL:
curl --location 'snnol.co/url' --form 'long="https://gorails.com/setup/macos/13-ventura"'
{
"id": 10,
"short": "9v28s18FX",
"long": "https://gorails.com/setup/macos/13-ventura",
"created_at": "2023-10-06T17:22:44.873Z",
"updated_at": "2023-10-06T17:22:44.873Z"
}
View the long URL:
curl --location 'snnol.co/v/9v28s18FX
{
"long": "https://gorails.com/setup/macos/13-ventura"
}