Skip to content

Latest commit

 

History

History
 
 

realtime-poll

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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