Fireship · @fireship

Hasura in 100 Seconds

Uploaded June 10, 2021 · Length 2:16

Hasura in 100 Seconds

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.

  1. 0:00

    hasura instantly turn your relational

  2. 0:02

    database into a graphql or rest api

  3. 0:05

    when building a full stack application

  4. 0:07

    the end user likely needs to communicate

  5. 0:09

    with a database

  6. 0:10

    that means you need to build a secure

  7. 0:12

    api in the middle so the client can tell

  8. 0:13

    the server what it needs from the

  9. 0:15

    database but building the perfect api

  10. 0:17

    is easier said than done front-end

  11. 0:19

    developers love using graphql but

  12. 0:21

    back-end developers are faced with the

  13. 0:22

    challenge of writing

  14. 0:23

    efficient sql queries that resolve the

  15. 0:25

    graphql schema the hasura engine

  16. 0:27

    eliminates this problem

  17. 0:29

    by automatically generating the schema

  18. 0:31

    and resolvers for you

  19. 0:32

    just point it to your postgres database

  20. 0:34

    and it will use the existing tables and

  21. 0:36

    views to generate an api that's ready to

  22. 0:38

    roll in your frontend app if you don't

  23. 0:40

    already have a database you can connect

  24. 0:41

    one from anywhere in the cloud

  25. 0:43

    then add tables and rows to it and

  26. 0:44

    manage all of your data directly from

  27. 0:46

    the web ui

  28. 0:47

    and it can even help you configure

  29. 0:48

    relationships between tables

  30. 0:50

    in addition to databases you can also

  31. 0:52

    connect third-party apis to your schema

  32. 0:54

    to create a single source of truth for

  33. 0:56

    all your data in some cases you may want

  34. 0:58

    to extend the schema with your own

  35. 1:00

    custom queries or mutations

  36. 1:02

    actions provide a way to implement

  37. 1:03

    custom business logic in an external

  38. 1:05

    server or serverless function

  39. 1:07

    to read and write data in more complex

  40. 1:09

    ways in addition

  41. 1:10

    you may want to trigger server-side code

  42. 1:12

    when something changes in the database

  43. 1:14

    like you may want to send a

  44. 1:15

    transactional email when a new row is

  45. 1:17

    added to a certain table hassura events

  46. 1:19

    can be triggered based on operations to

  47. 1:21

    a certain table

  48. 1:22

    or scheduled with a cron job in the

  49. 1:23

    background but one thing hysura doesn't

  50. 1:25

    handle

  51. 1:26

    is user authentication although you can

  52. 1:28

    easily connect your favorite

  53. 1:29

    authentication service and provide a

  54. 1:31

    role session variable when the user

  55. 1:32

    makes requests

  56. 1:33

    which can then be used to implement

  57. 1:35

    role-based access control with the click

  58. 1:37

    of a button

  59. 1:37

    now because the api is created with an

  60. 1:39

    industry standard like graphql

  61. 1:41

    you can use any graphql client that

  62. 1:43

    you'd like to access the data on the

  63. 1:45

    front end you might use something like

  64. 1:46

    apollo

  65. 1:47

    to query mutate and set up real-time

  66. 1:49

    subscriptions to your database

  67. 1:51

    in other words hasura is kind of like a

  68. 1:53

    middleman that doesn't care what you use

  69. 1:54

    on the front end or where you host your

  70. 1:56

    actual database

  71. 1:57

    and best of all it's an open source

  72. 1:59

    project that can be self-hosted