Fireship · @fireship
Hasura in 100 Seconds
Uploaded June 10, 2021 · Length 2:16
Summary
hasura instantly turns relational databases into graphql or rest api for full stack applications
- hasura
- graphql api
- full stack development
- relational databases
- api generation
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
hasura instantly turn your relational
- 0:02
database into a graphql or rest api
- 0:05
when building a full stack application
- 0:07
the end user likely needs to communicate
- 0:09
with a database
- 0:10
that means you need to build a secure
- 0:12
api in the middle so the client can tell
- 0:13
the server what it needs from the
- 0:15
database but building the perfect api
- 0:17
is easier said than done front-end
- 0:19
developers love using graphql but
- 0:21
back-end developers are faced with the
- 0:22
challenge of writing
- 0:23
efficient sql queries that resolve the
- 0:25
graphql schema the hasura engine
- 0:27
eliminates this problem
- 0:29
by automatically generating the schema
- 0:31
and resolvers for you
- 0:32
just point it to your postgres database
- 0:34
and it will use the existing tables and
- 0:36
views to generate an api that's ready to
- 0:38
roll in your frontend app if you don't
- 0:40
already have a database you can connect
- 0:41
one from anywhere in the cloud
- 0:43
then add tables and rows to it and
- 0:44
manage all of your data directly from
- 0:46
the web ui
- 0:47
and it can even help you configure
- 0:48
relationships between tables
- 0:50
in addition to databases you can also
- 0:52
connect third-party apis to your schema
- 0:54
to create a single source of truth for
- 0:56
all your data in some cases you may want
- 0:58
to extend the schema with your own
- 1:00
custom queries or mutations
- 1:02
actions provide a way to implement
- 1:03
custom business logic in an external
- 1:05
server or serverless function
- 1:07
to read and write data in more complex
- 1:09
ways in addition
- 1:10
you may want to trigger server-side code
- 1:12
when something changes in the database
- 1:14
like you may want to send a
- 1:15
transactional email when a new row is
- 1:17
added to a certain table hassura events
- 1:19
can be triggered based on operations to
- 1:21
a certain table
- 1:22
or scheduled with a cron job in the
- 1:23
background but one thing hysura doesn't
- 1:25
handle
- 1:26
is user authentication although you can
- 1:28
easily connect your favorite
- 1:29
authentication service and provide a
- 1:31
role session variable when the user
- 1:32
makes requests
- 1:33
which can then be used to implement
- 1:35
role-based access control with the click
- 1:37
of a button
- 1:37
now because the api is created with an
- 1:39
industry standard like graphql
- 1:41
you can use any graphql client that
- 1:43
you'd like to access the data on the
- 1:45
front end you might use something like
- 1:46
apollo
- 1:47
to query mutate and set up real-time
- 1:49
subscriptions to your database
- 1:51
in other words hasura is kind of like a
- 1:53
middleman that doesn't care what you use
- 1:54
on the front end or where you host your
- 1:56
actual database
- 1:57
and best of all it's an open source
- 1:59
project that can be self-hosted


