Hasura GraphQL Engine on Heroku
Hasura GraphQL Engine is a blazing-fast GraphQL server that gives you ⚡ instant, realtime GraphQL APIs over Postgres, with webhook triggers on database events for asynchronous business logic.
Hasura helps you build GraphQL apps backed by Postgres or incrementally move to GraphQL for existing applications using Postgres.
Deploy Hasura GraphQL Engine on Heroku and get a GraphQL endpoint in under 30 seconds 🕐
Read more at hasura.io and the docs.
Quickstart
1. Deploy to Heroku
Deploy to Heroku and instantly get a realtime GraphQL API backed by Heroku Postgres:
2. Open Hasura Console
Once the deployment is complete, click on the View
button as marked above.
This will take you to the Hasura Console, where you can create a table and make
your first GraphQL query.
3. Create a table
Navigate to Data -> Create table
on the console and create a table called
profile
with the following columns:
name | type |
---|---|
id |
Integer (auto-increment) |
name |
Text |
Choose id
as the Primary key and click the Create
button.
4. Insert sample data
Once the table is created, go to the Insert Row
tab and insert some sample
rows:
Thor
Iron Man
Hulk
Captain America
Black Widow
5. Try out GraphQL
Switch to the GraphiQL
tab on top and execute the following GraphQL query:
query {
profile {
id
name
}
}
Support & Troubleshooting
Feel free to talk to us on Discord about anything and everything. You can also contact us using one of the following channels:
- Support & feedback: Discord
- Issue & bug tracking: GitHub issues
- Follow product updates: @HasuraHQ
- Talk to us on our website chat.
Next steps
- Using an existing Heroku database
- Securing your GraphQL Endpoint
- Checking GraphQL Engine logs
- Updating to the latest version
Further reading
- Building your schema
- GraphQL Queries
- GraphQL Mutations
- GraphQL Subscriptions
- Event Triggers
- Authentication/Access control
- Database Migrations
- Guides/Tutorials/Resources
heroku login ✗ heroku create rtl-backend --stack=container › Warning: heroku update available from 7.59.0 to 7.59.2. Creating ⬢ rtl-backend... done, stack is container https://rtl-backend.herokuapp.com/ | https://git.heroku.com/rtl-backend.git
✗ heroku addons:create heroku-postgresql:hobby-dev -a rtl-backend
› Warning: heroku update available from 7.59.0 to 7.59.2.
Creating heroku-postgresql:hobby-dev on ⬢ rtl-backend... free
Database has been created and is available
! This database is empty. If upgrading, you can transfer
! data from another database with pg:copy
Created postgresql-cubed-77153 as DATABASE_URL
Use heroku addons:docs heroku-postgresql to view documentation
https://dashboard.heroku.com/apps
then
https://dashboard.heroku.com/apps/rtl-backend
then Resources
will show Heroku Postgres
➜ heroku git:remote -a rtl-backend
➜ git push heroku master
Screenshot 2022-01-13 at 15.16.26.png
Now we van make a database migration
➜ npm i -g hasura-cli
Below is process for data migration
✗ hasura init rm_migrations INFO a new pre-release version is available:
-
v2.1.0-beta.3 (changelog: https://github.com/hasura/graphql-engine/releases/tag/v2.1.0-beta.3) to update cli to this version, execute:
hasura update-cli --version v2.1.0-beta.3
INFO directory created. execute the following commands to continue:
cd rm_migrations hasura console
But need to change 8080 to 8081
endpoint: http://localhost:8080 -> endpoint: http://localhost:8081