-
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
- 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.
- we have a
long_tails
table in the postgres database long_tails
havetail
andjson_id
in the tablejson_id
is used as a join key with a remote schema- In
backend
we run aapollo server
which has apost_info
type which is added tolong_tails
table withjson_id
as join key - With this we can fetch
title
anddescription
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
-
For the purpose of deployement, I used vercel platform for deploying nextjs
-
For hasura graphql engine,I used hasura cloud
-
For remote Schema I deployed it on glitch
- we can use ECS service for deploying the docker compose services directly