Fireship · @fireship

Astro just Launched.... Could it be the ultimate web framework?

Uploaded August 18, 2022 · Length 3:17

Astro just Launched.... Could it be the ultimate web framework?

Summary

Astro web framework review: pros, cons, and use cases for building fast and interactive multi-page applications.

  • astro web framework
  • static site generator
  • server-side rendering
  • client-side routing
  • javascript framework wars

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:01

    it is august 18 2022 and you're watching

  2. 0:04

    the code report one of the most

  3. 0:05

    difficult decisions of a front-end

  4. 0:07

    developer's life is choosing between

  5. 0:09

    front-end ui frameworks because once you

  6. 0:10

    get jumped into a gang it's really hard

  7. 0:12

    to get out but what if there is a way

  8. 0:14

    you could be a part of multiple gangs at

  9. 0:15

    one time without causing a bunch of

  10. 0:17

    complex drama well that's just one of

  11. 0:19

    the amazing things that astro does which

  12. 0:20

    is a tool for building multi-page

  13. 0:22

    applications that just hit version 1.0 a

  14. 0:24

    few days ago i made 100 second video

  15. 0:26

    about it a while ago but it has some

  16. 0:28

    really interesting new features and

  17. 0:29

    deserves a second look at a very high

  18. 0:31

    level it's kind of like a static site

  19. 0:33

    generator that allows you to write

  20. 0:34

    content and markdown using the file

  21. 0:36

    system for routing then renders it all

  22. 0:38

    as a static multi-page application for

  23. 0:40

    templating it has its own language

  24. 0:42

    called astro components which feel very

  25. 0:44

    nice and familiar to the modern front

  26. 0:45

    end developer what's really interesting

  27. 0:47

    though is that you can bring in your

  28. 0:48

    favorite front-end framework like react

  29. 0:50

    spelt vue and so on and it will render

  30. 0:52

    the ui on the server while shipping zero

  31. 0:54

    javascript to the browser javascript is

  32. 0:56

    the main bottleneck for performance

  33. 0:58

    which means with astro you get really

  34. 0:59

    fast page loads while using your

  35. 1:01

    favorite javascript framework or

  36. 1:02

    multiple frameworks at the same time but

  37. 1:04

    you might be wondering how does a

  38. 1:05

    component work if it doesn't have its

  39. 1:07

    javascript with it the answer is it

  40. 1:09

    doesn't it's just static html by default

  41. 1:11

    however if you do need interactivity and

  42. 1:13

    state you can opt into javascript as

  43. 1:15

    needed to add islands of interactivity

  44. 1:17

    to your website from a developer's

  45. 1:19

    perspective astro provides a variety of

  46. 1:21

    directives that determine when to

  47. 1:22

    hydrate or load the javascript for a

  48. 1:24

    component if you want to load it right

  49. 1:26

    away like normal use client load but if

  50. 1:28

    you don't need the component to be

  51. 1:29

    interactive right away you can also use

  52. 1:31

    idle to wait until the browser is just

  53. 1:33

    chilling or visible to wait until the

  54. 1:34

    component comes into the viewport under

  55. 1:36

    the hood astro is using a technique

  56. 1:38

    called partial or selective hydration to

  57. 1:40

    render components in place as opposed to

  58. 1:42

    taking over the entire dom that's a huge

  59. 1:44

    deal when it comes to performance less

  60. 1:46

    javascript to run means faster page

  61. 1:48

    loads and better time to interactive

  62. 1:50

    scores that's awesome but astro can do

  63. 1:52

    many things beyond the typical static

  64. 1:54

    site generator like next.js it can

  65. 1:56

    statically generate dynamic routes by

  66. 1:58

    allowing you to define a git static