Skip to content

mickeymarse/metrak-api

Repository files navigation

Metrak API

The API for my personal media tracker, a.k.a. another Letterboxd clone. Although, with the possibility of tracking media other than movies.
It is a project I chose to build in order to learn and practice my Ruby and Ruby on Rails skills.

It has been deployed using Fly, but the deployed version still present broken UI due to problems with the JavaScript code. I used Flowbite as a UI component, which doesn't seem to be the most deployable library.

Development

The original idea was to create a personal media tracker as I mentioned above by building a full stack app on Rails.
However, I tried too many new things at once (as I do too often), and the result was a mess I was't really willing to refactor.
Hence, I thought of navigating further into Rails docs and learn how to turn my existing app into an API-only one. It worked fine and I'm happy with it. Even if I'm planning to develop it further and improve it somehow.

Anyway, I will discuss the whole process better, as well as what went wrong, on a future blog post. So, add it to your feed reader or whatever you do if you're interested in that or in reading other random ramblings.

API

There is a media table and a thoughts table. A media can be linked to many thoughts. The idea is that I don't want to share full-on reviews. Rather, bubble thoughts that came/come/will come up to my mind before/after/while enjoying the media selected.

GET /media/ [try]

Returns all the media in the db.

GET /media/[id] [try]

Returns a specific media.

GET /media/[id]/thoughts/ [try]

Returns all the thoughts for the selected media.

GET /media/[id]/thoughts/[id] [try]

Returns selected thought for selected media.

The POST, PUT and DELETE requests follow the usual pattern that you can infer from the requests above. However, you need to authenticate to perform them.

Run locally

If you want to try it locally with the unbroken UI, download the repo and run:

$ bundle install
$ rails s

Then, you will need to set up a local PostgreSQL database with its user and password as well as creating user and password for the authentication process (which lets you create, update and delete).

Future plans

  • ☐ Rebuild UI using different component library (not likely)
    or
  • ☑ Turn it into an API-only app (very likely)
  • ☐ Add possibility to upload images.
  • ☐ Improve security