---
title: "Project Structure"
description: "Typical file structure for a @yan-ad/nuxt-shopify application."
canonical_url: "https://shopify.yan.ad/getting-started/project-structure"
---
# Project Structure

> Typical file structure for a @yan-ad/nuxt-shopify application.

## Overview

A `@yan-ad/nuxt-shopify` app is a standard Nuxt application with the `@yan-ad/nuxt-shopify` module enabled. The module auto-registers server utilities, client composables, components, OAuth routes, and App Bridge — so your project stays clean.

## Typical structure

<code-tree default-value="nuxt.config.ts">

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  modules: ['@yan-ad/nuxt-shopify'],

  shopify: {
    apiKey: process.env.SHOPIFY_API_KEY,
    apiSecretKey: process.env.SHOPIFY_API_SECRET_KEY,
    appUrl: process.env.SHOPIFY_APP_URL,
    navLinks: [
      { label: 'Home', href: '/', rel: 'home' },
      { label: 'Products', href: '/products' },
      { label: 'Settings', href: '/settings' }
    ]
  }
})
```

```toml [shopify.app.toml]
# Shopify CLI app configuration
# See https://shopify.dev/docs/apps/tools/cli/configuration
```

```vue [app.vue]
<template>
  <NuxtLayout>
    <NuxtPage />
  </NuxtLayout>
</template>
```

```vue [layouts/default.vue]
<template>
  <ShApp>
    <slot />
  </ShApp>
</template>
```

```vue [pages/index.vue]
<template>
  <sh-page title="Home">
    <!-- App homepage -->
  </sh-page>
</template>
```

```vue [pages/products.vue]
<template>
  <sh-page title="Products">
    <!-- Products page -->
  </sh-page>
</template>
```

```vue [pages/settings.vue]
<template>
  <sh-page title="Settings">
    <!-- Settings page -->
  </sh-page>
</template>
```

```ts [server/plugins/shopify.ts]
import { configureShopify } from '#shopify/server'
import { PrismaSessionStorage } from '@shopify/shopify-app-session-storage-prisma'
import { prisma } from '~/server/utils/prisma'

export default defineNitroPlugin(() => {
  configureShopify({
    sessionStorage: new PrismaSessionStorage(prisma),
    hooks: {
      afterAuth: async ({ session, admin }) => {
        // Register webhooks, seed data, etc.
      }
    }
  })
})
```

```ts [server/api/shop.ts]
export default defineEventHandler(async (event) => {
  const { admin } = await useShopifyAdmin(event)

  const { data } = await admin.graphql(`{
    shop { name currencyCode }
  }`)

  return data
})
```

```ts [server/api/webhooks.ts]
export default defineEventHandler(async (event) => {
  const { topic, shop, payload } = await useShopifyWebhook(event)

  // Handle webhook topic
  switch (topic) {
    case 'APP_UNINSTALLED':
      // Clean up shop data
      break
  }

  return { success: true }
})
```

</code-tree>

## Key files

- **nuxt.config.ts** — Module config: API credentials, scopes, navigation links, and other options. See [Configuration](https://shopify.yan.ad/getting-started/configuration) for the full list.
- **server/plugins/shopify.ts** — Nitro plugin for complex runtime objects: session storage, lifecycle hooks, webhooks, and billing.
- **layouts/default.vue** — Wrap pages with `<ShApp>` to render the App Bridge navigation menu.
- **server/api/*.ts** — Server API routes using auto-imported utilities like `useShopifyAdmin` and `useShopifyWebhook`.

## What the module registers automatically

You don't need to manually set up any of these — the module handles them:

<table>
<thead>
  <tr>
    <th>
      What
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <strong>
        OAuth routes
      </strong>
    </td>
    
    <td>
      <code>
        /_shopify/auth
      </code>
      
      , <code>
        /_shopify/auth/callback
      </code>
      
      , exit-iframe, session-token
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Server utilities
      </strong>
    </td>
    
    <td>
      <code>
        useShopifyAdmin
      </code>
      
      , <code>
        useShopifyWebhook
      </code>
      
      , and more — auto-imported
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Client composables
      </strong>
    </td>
    
    <td>
      <code>
        useAppBridge()
      </code>
      
      , <code>
        useShopifyFetch()
      </code>
      
       — auto-imported
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Components
      </strong>
    </td>
    
    <td>
      <code>
        ShApp
      </code>
      
      , <code>
        ShLoadingIndicator
      </code>
      
      , <code>
        Sh*
      </code>
      
       Polaris wrappers — auto-registered
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        App Bridge
      </strong>
    </td>
    
    <td>
      CDN script + meta tag injected via SSR head
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Polaris
      </strong>
    </td>
    
    <td>
      CDN script + web component types registered
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Auth middleware
      </strong>
    </td>
    
    <td>
      <code>
        shopify-auth
      </code>
      
       route middleware (opt-in, not global)
    </td>
  </tr>
  
  <tr>
    <td>
      <strong>
        Default session storage
      </strong>
    </td>
    
    <td>
      <code>
        MemorySessionStorage
      </code>
      
       (override via <code>
        configureShopify()
      </code>
      
      )
    </td>
  </tr>
</tbody>
</table>


## Sitemap

See the full [sitemap](https://shopify.yan.ad/sitemap.md) for all pages.
