In this episode, we're giving our Nuxt application some much-needed structure so we can build out the pages in a clean way. We kick things off by creating a new layouts
directory and setting up a basic default layout component that will wrap all our pages. This layout acts as a template, and we set it up to include the default slot for rendering different page components.
To make things look a bit nicer, we pull in Tailwind CSS. We walk through the setup—installing Tailwind, configuring it with our Nuxt project, setting up the necessary CSS and PostCSS settings, and making sure our styles apply to components, layouts, and pages. We also install the Tailwind CSS Forms plugin for some extra polish on form controls.
Next, we create an assets/css/app.css
file and hook it up in our nuxt.config.js
so Tailwind resets and utilities are available everywhere. After restarting the dev server, we jump into styling our layout container with some basic margin, max-width, and padding to keep everything nicely centered.
With the layout in place, we move on to navigation. We create a basic navigation component inside a new components
directory, add it to our layout, and set up a couple of links for Home and Dashboard pages. As a bonus, we scaffold the Dashboard page itself and make sure navigation links work as expected. Finally, to set up for future authentication features, we add a section in the navbar reserved for auth links and tweak the layout using Tailwind classes so everything aligns and spaces out properly.
By the end of this episode, you'll have a solid base Nuxt app with Tailwind CSS configured, a clean layout, and some core navigation so we're ready for more features in future episodes.