NuxtJS Crash Course
NuxtJS is a framework on top of Vue that allows your application to be server-side rendered via Node.js. This allows for better SEO, but still has all the benefits of a fully interactive JavaScript application.
In this series, we'll take a look at using Nuxt 3 and all the features it has to offer including automatic routing, better TypeScript support, Vite support, the Nitro server and more. We'll pair it together with an API powered by Laravel on the backend to build out the obligatory blog application. This will allow us to learn how to communicate between the front-end and the back-end.
Progress
Series Info
- Episodes
- 11
- Run Time
- 2h 33m
- Difficulty
- Intermediate
- Last Updated
- Mar 1, 2022
- Version
- Latest
Series Episodes
- Nuxt Features (4)
Intro and Demo
To start off, we discuss some of the pros and cons of building your application using Nuxt. We also take a look at the demo blog application we'll be creating throughout this series.Nuxt Features and Folder Structure
Let's review the different folders we can create to utilize the features of Nuxt 3. We'll explore automatic page routing, layouts, meta tags, components, and composables.Data Fetching
We take a look at a few different ways we can fetch data using Nuxt 3. We can do it the traditional way and fetch data from the client, or we have a few options we can utilize to fetch data on the server.Nitro Server
Nuxt 3 comes with a lightweight server engine, named Nitro. Nitro allows you to easily create API routes that execute on the server. We take a look at an example of calling an external API using Nitro in order to hide our API key on the client.
- Build a Blog App (7)
Setting up the Frontend
We start setting up the frontend for our blog application. We do some styling with Tailwind, add layouts and pages, and set up some reusable components.Setting up the Backend
For our backend, we start a new Laravel application and setup our models, migrations, factories and routes.Communication with Backend
Now that our backend is in place, we can start wiring it up to our Nuxt frontend. We work on making the index page and the single post page dynamic. We also work on creating posts and handling errors with form validation.Authentication with Sanctum
Let's work on getting authentication in place. We'll take a look at setting up Nuxt to ensure all of the cookies and headers are being sent correctly to the backend. We'll also look at protected routes and logging out.Middleware
We want to be able to protect our routes if the user is either logged in or not. We can make use of middleware in Nuxt to achieve this. We also take a look at making use of `localstorage` as a way to keep track of the user's logged in status.Authorization
We add the ability to edit and delete posts but also make sure that proper authorization is in place for those actions. We utlize polices in Laravel to do this, and wire it up to our Nuxt frontend.The Deployment Process
In this final video, we take a look at two ways of deploying Nuxt apps to real servers. We start off by making use of Netlify, where most of the configuration happens automatically. We then deploy our blog application using Laravel Forge, which requires more configuration and setting up modern tools like Node and PM2. Thanks for coming along!
