Fireship · @fireship

Nuxt in 100 Seconds

Uploaded June 13, 2023 · Length 2:50

Nuxt in 100 Seconds

Summary

nuxt.js framework for building web applications with vue.js, including routing, data fetching, caching, and deployment.

  • nuxt.js
  • vue.js
  • full-stack
  • web development
  • javascript
  • framework

Transcript preview

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

  1. 0:00

    next A batteries included framework for

  2. 0:02

    building any type of web application you

  3. 0:04

    can imagine with vue.js the purpose of

  4. 0:07

    VJs is to build front-end user

  5. 0:08

    interfaces with JavaScript but a true

  6. 0:10

    full stack web application also needs to

  7. 0:12

    deal with routing data fetching caching

  8. 0:14

    deployment and more that's where nux

  9. 0:16

    comes in it works by strapping its Nitro

  10. 0:19

    server engine to view enabling multiple

  11. 0:21

    rendering modes from a single

  12. 0:22

    application by default it does Universal

  13. 0:24

    rendering where the initial page view is

  14. 0:26

    rendered on the server then JavaScript

  15. 0:28

    takes over to handle all subsequent

  16. 0:30

    navigation client-side however if that's

  17. 0:31

    not ideal developers can set different

  18. 0:33

    rendering and caching rules for every

  19. 0:35

    route and it's capable of running on

  20. 0:37

    edge networks like cloudflare its

  21. 0:39

    built-in Dev tools are incredible and

  22. 0:40

    may trigger jealousy if you use a

  23. 0:42

    different framework beyond that it has a

  24. 0:44

    huge ecosystem of modules that can

  25. 0:46

    handle requirements like image

  26. 0:47

    optimization content management database

  27. 0:49

    Integrations e-commerce and countless

  28. 0:51

    others to get started generate a new

  29. 0:53

    project with the CLI then you'll find

  30. 0:55

    the main entry point in the app.view

  31. 0:57

    file and notice how it's configured with

  32. 0:59

    typescript out of the box to an ensure

  33. 1:00

    your own safety to build an application

  34. 1:02

    you write view components in the Pages

  35. 1:04

    directory the structure of the file

  36. 1:06

    system determines the routes and URLs in

  37. 1:08

    the browser what's unique about nux

  38. 1:09

    though is that reusable components and

  39. 1:11

    composables have their own dedicated

  40. 1:13

    directories any code defined here can be

  41. 1:15

    automatically imported in your pages and

  42. 1:17

    that means you don't need a massive list

  43. 1:18

    of import statements in every single

  44. 1:20

    page and under the hood it will

  45. 1:22

    automatically handle code splitting so

  46. 1:23

    only the JavaScript needed for the

  47. 1:25

    components in this file will be sent

  48. 1:26

    Downstream to the browser next up we

  49. 1:28

    have the layouts directory here we

  50. 1:30

    Define view components that have a slot

  51. 1:32

    in the middle allowing the outer UI like

  52. 1:34

    a nav bar and footer to be shared across

  53. 1:36

    multiple Pages now if you're building a

  54. 1:37

    Blog you'll really like the content

  55. 1:39

    directory because here you can write

  56. 1:40

    content and markdown and use it

  57. 1:42

    throughout the application with minimal

  58. 1:43

    friction then we have the middleware

  59. 1:45

    directory which is capable of running

  60. 1:46

    code before you navigate to a route like

  61. 1:48

    for collecting analytics or checking the

  62. 1:50

    user authentication state next has many

  63. 1:52

    other special directories to offer but

  64. 1:54

    everything in the framework is

  65. 1:55

    progressively enhanced which means you

  66. 1:57

    can opt into these features as needed

  67. 1:58

    now when it comes to data fetching it