A simple todo app built using React and Hasura GraphQL Enginer.
Features:
- Secure Authentication using auth0.
- Create as many todos as you want. Mark them complete or delete them if required.
- Check all your todos created till now.
https://reacthasuratodo.herokuapp.com/
- Clone this repository using
https://github.com/Anupam-dagar/react-Hasura-todo.git - Install the dependencies using
yarn install. - Deploy your Hasura GraphQL Server using One Click Deploy to Heroku.
- In your just created Heroku app, add an environment variable
HASURA_GRAPHQL_ACCESS_KEYwith its value being something you can remember. This key will be required to access your Hasura GraphQL server. - Create a table named
todoswith following fields- todo_id: integer (auto increment)
- todo_text: Text
- todo_mark: Boolean
- todo_user: Text
- Chose todo_id as Primary Key.
- Set the permissions for your table in Hasura GraphQL server as follows:
- Create a new
roleuser. - For
insertchosewith custom checks- Select
todo_useras the field, make it_eqtoX-HASURA-USER-ID
- Select
- For
selectchosewith same checks as ----and select all columns for access. - For
updatechosewith same checks as ----and give access only totodo_markcolumn. - For
deletechosewith same checks as ----.
- Create a new
- Sign up on https://auth0.com and create a new application.
- In the application settings, add
http://localhost:3000/callbackto theAllowed Callback Urls. - Deploy auth0handler using One Click Deploy to Heroku
- Add an environment variable to your just deployed auth handler
AUTH_ZERO_DOMAINwith its value being your auth0 domain address. - Add an environment variable in your Hasura GraphQL server Heroku app .
HASURA_GRAPHQL_AUTH_HOOKand keep its valueyour auth0 handler url/auth0/webhook. - Create a file .env and include write the following data in it.
REACT_APP_CLIENTID=''
REACT_APP_REDIRECTURI='http://localhost:3000/callback'
- Change the
domaininsrc/Auth/Auth.jsto your auth0 domain. - Change the
uriinsrc/Components/Home.jsto your Hasura GraphQL server url endpoint. - Run the local server using yarn start.
MIT
