---
name: build-nuxt-vue-app
description: Builds a Nuxt 3 app with Vue 3 and TypeScript - script setup components, file-based pages and layouts, composables, server routes, and runtime config for secrets. Use when the user wants a Nuxt app, a Vue 3 app with server routes, or asks how Nuxt pages and composables fit together.
license: CC0-1.0
metadata:
  category: frontend
  tags: "nuxt,vue,typescript"
  author: johnny-bravo
  version: "1.0"
  updated: "2026-11-11"
  status: published
  aliases: "nuxt 3, vue 3, nuxt pages, composables"
  source_url: "https://github.com/PatrickJS/awesome-cursorrules/blob/b044f956f021b6e8877f16781bcfc466a6a120e9/rules/vue-3-nuxt-3-typescript-cursorrules-prompt-file.mdc"
  source_license: CC0-1.0
  copyright: "Public domain (CC0 1.0) - rules contributed to PatrickJS/awesome-cursorrules"
  original_author: "awesome-cursorrules contributors (vue-3-nuxt-3-typescript rules)"
  modified: "Adapted by TheSkillVault: turned a short rules file into a build order with an original example; kept script setup, Nuxt folders, composables, server routes and runtime config; dropped editor and commit rules; added safety notes, gotchas, portability and done-when."
  imported_on: "2026-11-11"
---

# Build a Nuxt and Vue app

Nuxt is the full-stack framework for Vue. Pages, server routes and composables live in one project.

## When to use
- You are starting a Vue 3 app and want file-based pages.
- You want server routes and a browser UI in the same repo.
- You are moving a Vue app onto Nuxt conventions.

## When not to use
- You want a mostly static content site. build-astro-site fits that better.
- You already chose SvelteKit. Use build-sveltekit-app.

## Steps
1. Create the app with `npx nuxi@latest init my-app`. Pick TypeScript. Then `npm install` and `npm run dev`.
2. Add pages as Vue files in `pages`. `pages/about.vue` becomes `/about`. Use `<script setup lang="ts">`.
3. Share the chrome with `layouts/default.vue`. Put reusable pieces in `components`.
4. Keep shared types next to the feature that owns them. Prefer an interface for an object shape.
5. Put reusable reactive helpers in `composables`. Use VueUse only when it makes a state change easier to see.
6. Load secrets through runtime config. Private keys stay off `public`. Read them in server code only.
7. Add JSON routes under `server/api`. Validate input there. Do not trust the browser.
8. Lazy-load a heavy component with a dynamic import. Check the bundle before you ship.
9. Build with `npm run build`. Pick the Nuxt preset for your host.

```vue
<script setup lang="ts">
const { data: projects } = await useFetch("/api/projects");
const query = ref("");
const shown = computed(() => (projects.value ?? []).filter((p) => p.name.includes(query.value)));
</script>

<input v-model="query" placeholder="Filter" />
<ul>
  <li v-for="p in shown" :key="p.id">{{ p.name }}</li>
</ul>
```

## Gotchas
- A value under `runtimeConfig.public` is sent to the browser. Keep API keys and passwords on the private side.
- `pages` and `server` are conventions. A component in the wrong folder does not become a route.
- Setup code runs on the server during SSR. Guard `window` and other browser-only APIs.
- Tailwind is optional. Add it only when the project already uses it.

## Portability
Works on Node, or on Vercel, Netlify, Cloudflare or similar with a Nuxt preset. If you use Vue 3 with Vite and no Nuxt, the script setup and composable parts are the same. Another framework such as SvelteKit uses the same idea of file routes and server code.

## Example prompt
"Build a Nuxt 3 app with Vue 3 and TypeScript that lists projects from a server route and filters them in a composable."

## Done when
- Pages use script setup and TypeScript.
- Secrets stay in private runtime config, not in client code.
- `npm run build` passes.

---
Based on the Vue 3 Nuxt 3 TypeScript rules file in PatrickJS/awesome-cursorrules (CC0 1.0, public domain). See LICENSE.txt.
