bhanuprasadcherukuvada / long-tail-assgn

Home Page:https://long-tail-assgn.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Steps for Execution

  • You need have docker installed on your machine to run the project

  • clone the project using the given command

    git  clone https://github.com/bhanuprasadcherukuvada/long-tail-assgn.git
  •  docker compose up --build -d 
  • To build and run the services

  • The docker compose file runs postgres, hasura-engine, nextjs frontend in detached mode

  • frontend application would be deployed at http://localhost:3000

  • You can check the hasura console at http://localhost:8080



- the application is seeded with initial data which is done with the help of migrations. - I have used ```hasura-cli``` to generate migrations. - i used this [resource](https://hasura.io/blog/moving-from-local-development-staging-production-with-hasura/) for seed migrations

alt alt alt alt

Adding remote Schema

  • I have used 2nd use case in the given blog.
  • Run hasura metadata apply to update the metadata which includes config regarding remote schema after adding remote schema using hasura console.

How it works ?

  • we have a long_tails table in the postgres database
  • long_tails have tail and json_id in the table
  • json_id is used as a join key with a remote schema
  • In backend we run a apollo server which has a post_info type which is added to long_tails table with json_id as join key
  • With this we can fetch title and description with remote join in hasura.
  • We can fetch both json_id and title and description in single fetch corresponding tail
  • The advantage here is that we are avoiding mutiple calls and reducing network time
  • We have json file in backend so that we can make updates to the json file and they will be reflected in the frontend on page reload

Link to the deployement

Alternative deployement

  • we can use ECS service for deploying the docker compose services directly

About

https://long-tail-assgn.vercel.app


Languages

Language:JavaScript 57.0%Language:Dockerfile 24.8%Language:CSS 16.4%Language:Shell 1.8%