---
title: "Configuration"
description: "All module options and runtime configuration for @yan-ad/nuxt-shopify."
canonical_url: "https://shopify.yan.ad/getting-started/configuration"
---
# Configuration

> All module options and runtime configuration for @yan-ad/nuxt-shopify.

## Module Options

Configure `@yan-ad/nuxt-shopify` in your `nuxt.config.ts` under the `shopify` key:

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

  shopify: {
    apiKey: '',
    apiSecretKey: '',
    appUrl: '',
    scopes: [],
    apiVersion: 'January26',
    authPathPrefix: '/_shopify/auth',
    distribution: 'app_store',
    useOnlineTokens: false,
    authPage: undefined,
    navLinks: [],
    codegen: false
  }
})
```

### Options reference

<table>
<thead>
  <tr>
    <th>
      Option
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Default
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        apiKey
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Your Shopify API key from the Partners dashboard
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        apiSecretKey
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Your Shopify API secret key
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        scopes
      </code>
    </td>
    
    <td>
      <code>
        string[]
      </code>
    </td>
    
    <td>
      <code>
        []
      </code>
    </td>
    
    <td>
      OAuth scopes (optional — Shopify reads from <code>
        shopify.app.toml
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        appUrl
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      —
    </td>
    
    <td>
      Your app's public URL (tunnel URL in development)
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        apiVersion
      </code>
    </td>
    
    <td>
      <code>
        ApiVersion
      </code>
    </td>
    
    <td>
      Latest stable
    </td>
    
    <td>
      The Shopify API version to use
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        authPathPrefix
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        /_shopify/auth
      </code>
    </td>
    
    <td>
      URL prefix for OAuth endpoints
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        distribution
      </code>
    </td>
    
    <td>
      <code>
        AppDistribution
      </code>
    </td>
    
    <td>
      <code>
        app_store
      </code>
    </td>
    
    <td>
      App distribution type (<code>
        app_store
      </code>
      
      , <code>
        single_merchant
      </code>
      
      , <code>
        shopify_admin
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        useOnlineTokens
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      <code>
        false
      </code>
    </td>
    
    <td>
      Use online (per-user) tokens in addition to offline (per-shop) tokens
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        authPage
      </code>
    </td>
    
    <td>
      <code>
        string | false
      </code>
    </td>
    
    <td>
      built-in page
    </td>
    
    <td>
      Custom auth page component path, or <code>
        false
      </code>
      
       to disable
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        navLinks
      </code>
    </td>
    
    <td>
      <code>
        NavLink[]
      </code>
    </td>
    
    <td>
      <code>
        []
      </code>
    </td>
    
    <td>
      Navigation links for the app sidebar (used by <code>
        <ShApp>
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        codegen
      </code>
    </td>
    
    <td>
      <code>
        boolean | string[]
      </code>
    </td>
    
    <td>
      <code>
        false
      </code>
    </td>
    
    <td>
      Enable GraphQL codegen — <code>
        true
      </code>
      
       for default version, or array of versions
    </td>
  </tr>
</tbody>
</table>

### Environment variables

All credential options can be set via environment variables instead of hardcoding them:

<table>
<thead>
  <tr>
    <th>
      Option
    </th>
    
    <th>
      Env Variable
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        apiKey
      </code>
    </td>
    
    <td>
      <code>
        NUXT_SHOPIFY_API_KEY
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        apiSecretKey
      </code>
    </td>
    
    <td>
      <code>
        NUXT_SHOPIFY_API_SECRET_KEY
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        appUrl
      </code>
    </td>
    
    <td>
      <code>
        NUXT_SHOPIFY_APP_URL
      </code>
    </td>
  </tr>
</tbody>
</table>

#### Codegen environment variables

When `codegen` is enabled, the module fetches schemas via introspection. Provide store credentials:

<table>
<thead>
  <tr>
    <th>
      Env Variable
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        SHOPIFY_CODEGEN_STORE_DOMAIN
      </code>
    </td>
    
    <td>
      Your Shopify store domain (e.g. <code>
        store.myshopify.com
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        SHOPIFY_CODEGEN_ADMIN_ACCESS_TOKEN
      </code>
    </td>
    
    <td>
      Admin API access token for schema introspection
    </td>
  </tr>
</tbody>
</table>

Alternatively, you can use `SHOPIFY_STORE_DOMAIN` and `SHOPIFY_ADMIN_ACCESS_TOKEN`.

## Runtime Configuration (`configureShopify`)

Simple values go in `nuxt.config.ts`. Complex runtime objects (session storage, hooks, billing) go in a **Nitro plugin** using `configureShopify()`:

```ts [server/plugins/shopify.ts]
import { configureShopify } from '#shopify/server'
import { MemorySessionStorage } from '@shopify/shopify-app-session-storage-memory'

export default defineNitroPlugin(() => {
  configureShopify({
    sessionStorage: new MemorySessionStorage(),
    hooks: {
      afterAuth: async ({ session, admin }) => {
        // post-auth logic
      }
    }
  })
})
```

### Runtime config options

<table>
<thead>
  <tr>
    <th>
      Option
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        sessionStorage
      </code>
    </td>
    
    <td>
      <code>
        SessionStorage
      </code>
    </td>
    
    <td>
      Session storage adapter (default: <code>
        MemorySessionStorage
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        webhooks
      </code>
    </td>
    
    <td>
      <code>
        Record<string, WebhookHandler | WebhookHandler[]>
      </code>
    </td>
    
    <td>
      Webhook handler configuration
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        hooks
      </code>
    </td>
    
    <td>
      <code>
        { afterAuth?: (opts) => void | Promise<void> }
      </code>
    </td>
    
    <td>
      Lifecycle hooks
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        billing
      </code>
    </td>
    
    <td>
      <code>
        Record<string, any>
      </code>
    </td>
    
    <td>
      Billing configuration for subscriptions
    </td>
  </tr>
</tbody>
</table>

### Session storage adapters

For production, replace the default `MemorySessionStorage` with a persistent adapter:

<table>
<thead>
  <tr>
    <th>
      Adapter
    </th>
    
    <th>
      Package
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      Prisma
    </td>
    
    <td>
      <code>
        @shopify/shopify-app-session-storage-prisma
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      Drizzle
    </td>
    
    <td>
      <code>
        @shopify/shopify-app-session-storage-drizzle
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      Redis
    </td>
    
    <td>
      <code>
        @shopify/shopify-app-session-storage-redis
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      MongoDB
    </td>
    
    <td>
      <code>
        @shopify/shopify-app-session-storage-mongodb
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      Memory (default, <strong>
        not for production
      </strong>
      
      )
    </td>
    
    <td>
      <code>
        @shopify/shopify-app-session-storage-memory
      </code>
    </td>
  </tr>
</tbody>
</table>

## Navigation Links

Configure sidebar navigation via the `navLinks` option. These are rendered by `<ShApp>` as the [App Bridge nav menu](https://shopify.dev/docs/api/app-home/app-bridge-web-components/app-nav):

```ts [nuxt.config.ts]
export default defineNuxtConfig({
  shopify: {
    navLinks: [
      { label: 'Home', href: '/', rel: 'home' },
      { label: 'Products', href: '/products' },
      { label: 'Settings', href: '/settings' }
    ]
  }
})
```

Each link has:

<table>
<thead>
  <tr>
    <th>
      Property
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        label
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The visible label text
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        href
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The URL path (e.g., <code>
        /products
      </code>
      
      )
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        rel
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      Optional — set to <code>
        'home'
      </code>
      
       to designate as the default landing page
    </td>
  </tr>
</tbody>
</table>

## Runtime Config Types

The module augments Nuxt's `RuntimeConfig` types for full autocomplete:

```ts
// Server — all Shopify config fields are typed
const config = useRuntimeConfig()
config.shopify.apiKey // string
config.shopify.apiSecretKey // string
config.shopify.scopes // string[]
config.shopify.appUrl // string
config.shopify.apiVersion // string
config.shopify.authPathPrefix // string
config.shopify.distribution // string
config.shopify.useOnlineTokens // boolean

// Client — only public fields
const publicConfig = useRuntimeConfig().public
publicConfig.shopify.apiKey // string
publicConfig.shopify.authPagePath // string
publicConfig.shopify.authPathPrefix // string
publicConfig.shopify.navLinks // NavLink[]
```

## App handle for login redirects

The login page opens `https://admin.shopify.com/store/{store}/apps/{appHandle}`.
The module reads `handle` from `shopify.app.toml` or `shopify.app.<name>.toml`
in the Nuxt app root at build time. When `shopify.apiKey` is configured, only
configs whose `client_id` matches that key are considered. Ambiguous or mismatched
configs produce a warning rather than selecting another app.

Set `shopify.appHandle` explicitly to override discovery, especially when TOML
files are excluded from deployment. The playground optionally uses
`SHOPIFY_APP_HANDLE` for this override. Restart Nuxt after changing the TOML.
Only the selected handle is exposed publicly, not the complete TOML configuration.


## Sitemap

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