Nuxt 4 is the latest version of the popular Vue.js framework for building full-stack web applications. It provides a powerful foundation for creating modern web experiences with server-side rendering, static generation, and more.
Nuxt is an intuitive framework built on top of Vue.js that makes web development enjoyable and powerful. It provides:
useFetch and useAsyncData for data managementTo create a new Nuxt project, run:
npx nuxi@latest init my-app
cd my-app
npm install
npm run dev
Your application will be available at http://localhost:3000.
Create files in the pages/ directory and Nuxt automatically generates routes:
pages/
index.vue → /
about.vue → /about
blog/
[slug].vue → /blog/:slug
Define API endpoints in server/api/:
// server/api/hello.ts
export default defineEventHandler((event) => {
return { message: 'Hello from Nuxt!' }
})
Create middleware in server/middleware/:
// server/middleware/logging.ts
export default defineEventHandler((event) => {
console.log('Request:', event.node.req.url)
})
Start with a simple landing page and gradually add features:
pages/index.vue filecomponents/server/api/Happy coding!