Backend-as-a-service
Many dApps need more than just decentralised tools to build an end-to-end solution. Maybe you need to save KYC information, or store metadata related to NFT's or other smart contracts you do not want to put on IPFS. This is where the backend-as-a-service solution comes in, based on Hasura.
Add Hasura
Navigate to the application where you want to add Hasura. Click Integration tools in the left navigation, and then click Add an integration tool. This opens a form.
Follow these steps to add the Hasura:
- Select Hasura, and click Continue.
- Choose a name for your own backend-as-a-service. Choose one that will be easily recognizable in your dashboards.
- Choose a deployment plan. Select the type, cloud provider, region and resource pack. More about deployment plans.
- You see the resource cost for your backend-as-a-service displayed at the bottom of the form. Click Confirm to add it.
When Hasura is deployed, you can build and manage your database in the Interface tab.
Some basic features
- Under the data subtab you can create an arbitrary number of schema's. A schema is a collection of tables.
- In a schema you can create tables, choose which columns you want and define relations and indexes.
- You can add, edit and delete data in these columns as well. Learn more here
Any table you make is instantly visible in the API subtab. Note that by using the REST and Derive Action buttons you can convert queries into REST endpoints if that fits your application better. Using the Code Exporter button you can get the actual code snippets you can use in your application or the integration studio.
A bit more advanced are actions. Actions are custom queries or mutations that are resolved via HTTP handlers. Actions can be used to carry out complex data validations, data enrichment from external sources or execute just about any custom business logic. Actions can be kickstarted by using the Derive Action button in the API subtab. Learn more here.
If you need to execute tasks based on changes to your database you can leverage Events. An Event Trigger atomically captures events (insert, update, delete) on a specified table and then reliably calls a HTTP webhook to run some custom business logic. Learn more here.
Cron Triggers can be used to reliably trigger HTTP endpoints to run some custom business logic periodically based on a cron schedule.
One-off Scheduled Events are individual events that can be scheduled to reliably trigger a HTTP webhook to run some custom business logic at a particular timestamp.
Access to your database can be handled all the way to the row level by using the authentication and authorisation options available in Hasura. Learn more here.
This is of course on top of the API keys in the platform you can use to close of access to the entire API.