---
title: "Nitro without Nuxt"
description: "Validate runtime config in a standalone Nitro 2 or Nitro 3 app with the Nitro module the Nuxt module is built on."
canonical_url: "https://nuxt-safe-runtime-config.onmax.me/guide/nitro"
---
# Nitro without Nuxt

> Validate runtime config in a standalone Nitro 2 or Nitro 3 app with the Nitro module the Nuxt module is built on.

The Nuxt module wraps a Nitro module that does the validation. A Nitro app without Nuxt can register it directly:

```ts [nitro.config.ts]
import safeRuntimeConfig from 'nuxt-safe-runtime-config/nitro'
import * as v from 'valibot'

export default defineNitroConfig({
  modules: [safeRuntimeConfig],
  runtimeConfig: {
    databaseUrl: '',
  },
  safeRuntimeConfig: {
    $schema: v.object({
      databaseUrl: v.pipe(v.string(), v.url()),
    }),
  },
})
```

It takes the same options as the Nuxt module, with the same defaults, except `envSchema`, which is Nuxt-only. A string `$schema` resolves from the Nitro root.

Two things work differently without Nuxt:

- There is no `useSafeRuntimeConfig()`. With runtime validation on, the validated values are written into `useRuntimeConfig(event)` on Nitro 2 and into `useRuntimeConfig()` on Nitro 3. On Nitro 2 the shared `useRuntimeConfig()` is frozen and keeps the raw values, so pass the event.
- The types go to `<buildDir>/types/safe-runtime-config.d.ts` and declare a global `NuxtSafeRuntimeConfig` interface.

The [Validation](https://nuxt-safe-runtime-config.onmax.me/guide/validation) and [Environment variables](https://nuxt-safe-runtime-config.onmax.me/guide/environment-overrides) pages apply here unchanged.


## Sitemap

See the full [sitemap](https://nuxt-safe-runtime-config.onmax.me/sitemap.md) for all pages.
