graphql-engine/community/sample-apps/realtime-poll
hasura-bot d203ef940b migrate realtime poll sample app to graphql-ws
GITHUB_PR_NUMBER: 8295
GITHUB_PR_URL: https://github.com/hasura/graphql-engine/pull/8295

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/3936
Co-authored-by: Catalin Pit <25515812+catalinpit@users.noreply.github.com>
GitOrigin-RevId: 186bd1729f5b92af030716299c22f61dd7fe0bb5
2022-03-16 08:19:13 +00:00
..
hasura community: fix sample apps metadata for v3 config 2021-08-19 03:46:59 +00:00
public add github workflow to compress new images in PRs 2021-03-10 20:55:02 +00:00
src migrate realtime poll sample app to graphql-ws 2022-03-16 08:19:13 +00:00
.dockerignore refactor community content and folder structure (#1353) 2019-01-17 15:57:28 +05:30
.gitignore refactor community content and folder structure (#1353) 2019-01-17 15:57:28 +05:30
Dockerfile refactor community content and folder structure (#1353) 2019-01-17 15:57:28 +05:30
package.json migrate realtime poll sample app to graphql-ws 2022-03-16 08:19:13 +00:00
README.md community: convert realtime poll sample app to hooks (close #7675) 2021-10-26 08:26:05 +00:00
yarn.lock refresh the sample app realtime-poll (#4337) 2020-04-21 12:24:51 +05:30

hasura-realtime-poll

A demo application to showcase real-time capabilities of Hasura GraphQL Engine.

Edit realtime-poll

The Realtime Poll application is built using React and is powered by Hasura GraphQL Engine over Postgres. It has an interface for users to cast vote on a poll and the results are updated in the on-screen bar chart, in real-time.

The application makes use of Hasura GraphQL Engine's real-time capabilities using subscription. There is no backend code involved. The application is hosted on GitHub pages and the Postgres+GraphQL Engine is running on Postgres.

Running the app yourself

  • Deploy GraphQL Engine on Hasura Cloud and setup PostgreSQL via Heroku:

    Deploy to Hasura Cloud

  • Get the Hasura app URL (say realtime-poll.hasura.app)

  • Clone this repo:

    git clone https://github.com/hasura/graphql-engine
    cd graphql-engine/community/sample-apps/realtime-poll
    
  • Install Hasura CLI

  • Goto hasura/ and edit config.yaml:

    endpoint: https://realtime-poll.hasura.app
    
  • Apply the migrations:

    hasura metadata apply
    hasura migrate apply
    hasura metadata reload
    
  • Edit GRAPHQL_ENDPOINT in src/apollo.js and set it to the Hasura app URL:

    export const GRAPHQL_ENDPOINT = "realtime-poll.hasura.app";
    
  • Run the app (go the root of repo):

    npm install
    npm start