Exercise for an internship.
It uses Neo4j
, Vue.js
and Express
Run the following commands in the main folder.
For the server:
> cd tag-server
> docker build -t tag-sever .
> docker run -p 8081:8081 tag-server
For the front:
> cd tag-front
> docker build -t tag-front .
> docker run -p 8080:8080 tag-front
The app is then available at http://localhost:8080/#/track or http://0.0.0.0:8080/#/track
While the API listens on port 8081
.
The app can also be used without docker by running npm install
and npm start
in both ./tag-server
and ./tag-front
.
As this is only a demo, I chose to conveniently host the data base (for free) on graphendb which means it is:
- Asleep when inactive so the very first connexion is very slow.
- Hosted in Northern Virginia (US) which leads somewhat slow response time.
- Limited to 1k nodes
- Limited to 10k relations
The db can be visualized here using these credentials
- login:
[email protected]
- password:
dzrtagdemopwd
Log in, then go at the bottom of the page, Tools: Neo4j browser, click Launch
.
DB app credentials
- username:
server-user
- password:
b.TIFIvn8dL3qz.ewj9o7s3m2Xs7iHk
- connexion string (BOLT):
bolt://hobby-ecmbfbmekcnhgbkeephhacal.dbs.graphenedb.com:24786
As there is a lot of N:M relations and high potential for redundancy, the natural choice is graph databases.
This could also facilitate the implementation of more complex request later on.
Relations between artists, albums and tracks are not implemented in this demo.
I chose Neo4j as it the most well known graph DB and seemed to be the easiest to use. However, Orientdb seems to be more suitable for alrge scale projects.
- Add a weight on the
TAGS
relations to quantify how rock a song is. - Implement the missing relations between artists, albums and tracks.
- Server API
- Front that can talk to the server and to deezer's API.
- Add and delete content by ids
- Search for content given a set of tags
- Get more infos on clicked content and edit its tags
- Edited tags will only be sent to the db when
Submit
is clicked
GET
tagged contentPOST
create contentPOST
replace contentDELETE
content
POST /artist/123
or POST /track/456
or POST /album/789
Request body (tag list) ["tag_a", "tag_b", ...]
Replaces the tag list by a new one
/!\ suboptimal implementation
POST /artist/123/replace
or POST /track/456/replace
Request body (tag list) ["tag_a", "tag_b", ...]
GET /artist/123
Response body (list of tags) ["tag_a", "tag_b", ...]
Returns the content that has all the requested tags
GET /album?tags[]=tag_a&tags[]=tag_b
or GET /track?tags[]=...
or GET /artist?tags[]=...
Response body (list of ids and tags)
[
{ id: 123 tags: [tag_a, tag_b, tag_c...] },
{ id: 456 tags: [tag_a, tag_b,...] },
...
]
Returns one json object per line.
GET /export
Response body
{"type":"artist", "id": 123, "tags":["tag_a", "tag_b", ...]}
{"type":"track", "id": 456, "tags":["tag_c", "tag_d", ...]}
{"type":"album", "id": 789, "tags":["tag_e", "tag_f", ...]}
...
DELETE /artist/123/tag
Request body (tag list) ["tag_a", "tag_b", ...]
DELETE /artist/123
Limited to 50 requests per 30s to deezer's server + the current architecture would be very inefficient.