Project YALA - MongoDB Atlas Hackathon 2022 on DEV submission
Tags: atlashackathon22, mongodb, java
Published: 2022-12-05 07:32:49

## What I built

I built Project YALA (or simply YALA) which is "Yet Another Link-shortener App". 

### Category Submission:

**Think Outside the JS Box** - as it is not-the-JS-stack but still nothing wacky to put in other category ;-)

### App Link

https://project-yala.fly.dev/

App is run in preview mode - no add/delete options provided.

Example links with data (some short link which redirects to dev.to):
* details page: https://project-yala.fly.dev/link/638a74cb82478a464c478282/3d9ae405-ba98-4930-9979-4ec11c7c2454
* details (analitycs) page: https://project-yala.fly.dev/link/638a74cb82478a464c478282/3d9ae405-ba98-4930-9979-4ec11c7c2454/visits
* link to click with preview - to show what URL is going to be opened: https://project-yala.fly.dev/j/3fe3fd2/preview 

### Screenshots

![Index page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6quxsgzlknbu65wwj9cv.png)


![Link info page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/finzjxf9bmehj0rbs123.png)


![Link visits page](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nvdy84a8druems19n8pj.png)

### Description
 
YALA is a simple link shortener that works without logging in - instead it creates "secret key" which allows to view details of created short link and it's statistics.

Generally it is simple app to show that we do not need fancy frameworks to make nice looking, fully working application.

### Link to Source Code

https://github.com/elwin013/project-yala

### Permissive License

MIT, https://github.com/elwin013/project-yala/blob/master/LICENSE.md

## Background

I always wanted to create simple link shortener, just for fun. :-) Additionally this was good moment to look into new [Timeseries](https://www.mongodb.com/docs/manual/core/timeseries-collections/) features from MongoDB.

Instead of using commonly used frameworks (like Spring Framework) I preffered to use something that is small and doesn't have "magic" in it. So I've chosen [Javalin](https://javalin.io) as a simple web framework, added MongoDB client libraries nad [jte](https://jte.gg)  as template engine. To show that simple and clean looking apps doesn't need any big JS libraries I've selected [chota](https://jenil.github.io/chota) - one of micro CSS frameworks.

### How I built it

On the app side I've used:
* [https://javalin.io/](Javalin) - simple web framework, 
* [https://jte.gg/](jte) - template library,
* [https://jenil.github.io/chota](chota) - micro CSS framework,
* MongoDB for database.

On the MongoDB side I've used just two collections - one with data about links and the second one with visits. For the latter I used  timeseries collection to aggregate data into some chunks (in case of example - group visits per hour).

All MongoDB related stuff was done on the code side (except creating cluster, database and user to access). It is pretty great that as long as you have access to database you can work with it freely - e.g. collection is created as soon as first document is saved!

For deployment I've used https://fly.io - mostly because I wanted to check out some Big-Three (AWS,GCP,Azure) alternative for hosting apps!

### Additional Resources/Info

Nothing I can think of! ;-)