---
title: "Creating a page"
description: "Add a page to the product or the public website, and decide which package owns it."
canonical_url: "https://nuxtstart.com/docs/getting-started/creating-a-page"
---

> Index of every page on this site: [llms.txt](https://nuxtstart.com/llms.txt)

[Nuxt's file-based routing](https://nuxt.com/docs/4.x/getting-started/routing) turns a file under
`app/pages/` into a route, and the path below `app/pages/` becomes the URL. So
`app/pages/hello.vue` serves `/hello`, and `app/pages/notes/index.vue` serves `/notes`.

The package the file lives in is not part of the URL. A page at
`packages/layer-notes/app/pages/notes/index.vue` still serves `/notes` in any application that
extends that layer.

## Decide which package owns it

Answer this before you create the file, because moving a page later means moving its components,
server routes, and navigation with it:

<table>
<thead>
  <tr>
    <th>
      The page is
    </th>
    
    <th>
      Put it in
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      Product-only, behind sign-in
    </td>
    
    <td>
      <code>
        apps/web/app/pages/
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      A public website page
    </td>
    
    <td>
      <code>
        packages/layer-site/app/pages/
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      A blog post
    </td>
    
    <td>
      The blog layer's content directory
    </td>
  </tr>
  
  <tr>
    <td>
      A documentation page
    </td>
    
    <td>
      The docs layer's content directory
    </td>
  </tr>
  
  <tr>
    <td>
      Part of a feature you'd reuse
    </td>
    
    <td>
      A new <code>
        packages/layer-*
      </code>
    </td>
  </tr>
</tbody>
</table>

The rule behind the table is in
[Technical details](https://nuxtstart.com/docs/getting-started/technical-details#where-should-a-change-live): application
code stays with its application, and reusable code stays in the layer that owns it.

The last two rows are not Vue files. `@app/layer-blog` and `@app/layer-docs` each register a Nuxt
Content collection in their own `content.config.ts` and one catch-all route that renders it, so a
post or a documentation page is a Markdown file under that layer's `content/` directory and its path
below that directory becomes the URL. A `.vue` file dropped into either layer's `app/pages/` becomes
an unrelated route and never appears in the blog or the documentation.

## Add a product page

Create the file:

```vue [apps/web/app/pages/hello.vue]
<template>
  <div>
    <h1>Hello</h1>
    <p>Welcome to your new page.</p>
  </div>
</template>
```

Run the product application and open `http://web.<slug>.localhost/hello`:

```shell
pnpm dev:web
```

A public website page works the same way. Put it in the layer that owns that surface — such as
`packages/layer-site/app/pages/hello.vue` — and open it at `http://site.<slug>.localhost/hello`
with `pnpm dev:site`.

## Add a page in a new layer

When the page belongs to a feature rather than to one application, give the feature its own layer.
Its pages, components, composables, server routes, and configuration then travel together, and
another project can extend it as it stands.

<steps level="3">

### Create the layer

Give it a package name in the workspace scope and declare what it extends:

```json [packages/layer-notes/package.json]
{
  "name": "@app/layer-notes",
  "dependencies": {
    "@app/layer-base": "workspace:*"
  }
}
```

```ts [packages/layer-notes/nuxt.config.ts]
export default defineNuxtConfig({
  extends: ['@app/layer-base'],
})
```

### Add the page

```vue [packages/layer-notes/app/pages/notes/index.vue]
<template>
  <div>
    <h1>Notes</h1>
  </div>
</template>
```

### Depend on the layer

```json [apps/web/package.json]
{
  "dependencies": {
    "@app/layer-notes": "workspace:*"
  }
}
```

### Extend it

```ts [apps/web/nuxt.config.ts]
export default defineNuxtConfig({
  extends: ['@app/layer-payments', '@app/layer-auth', '@app/layer-notes'],
})
```

`layer-payments` already pulls in `layer-base`, so `layer-notes` ranks below it: anything
`layer-notes` shares a name with in `layer-base` (a component, a composable, an `app.config` key)
loses to the `layer-base` one. Give it names of its own.

### Install and run

```shell
pnpm install
pnpm dev:web
```

</steps>

The page is now at `http://web.<slug>.localhost/notes`. The layer's name adds no prefix — only the
directories under `app/pages/` decide the route.

<note>

A layer that needs something from its host should ask for it through a module option,
`runtimeConfig`, or a hook, rather than assuming the host defines a particular key. A missing option
then fails by name instead of surfacing as `undefined` somewhere else.

</note>

## Add it to the navigation

Navigation belongs to whichever package renders it. For a product page, add an entry to the
product's aside navigation:

```ts [apps/web/app/constants/asideNavigation.ts]
import type { NavigationMenuItem } from '@nuxt/ui'

export const navigationItems: NavigationMenuItem[] = [
  // existing items
  {
    label: 'Notes',
    to: '/notes',
    icon: 'i-lucide-notebook',
  },
]
```

The website, blog, and docs each own their own navigation in their own layer. Add the entry next to
the page rather than in an application that doesn't own the route.

## Next steps

- [Customization](https://nuxtstart.com/docs/getting-started/customization) — colors, logo, fonts, and page head
- [Technical details](https://nuxtstart.com/docs/getting-started/technical-details) — what each package owns
- [Deploying development](https://nuxtstart.com/docs/getting-started/deploying-development) — ship what you built

## Sitemap

See the full [sitemap](https://nuxtstart.com/sitemap.md) for all pages.
