Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/dvlkit/nuxe/llms.txt

Use this file to discover all available pages before exploring further.

nuxe.config.ts is optional. Create it at the project root and export defineConfig({ ... }) to customize Nuxe’s behavior. When the file is absent, Nuxe runs with sensible defaults — a dev server on port 3000, an API prefix of /api, and an empty runtime config.

Full example

The following is the playground nuxe.config.ts that exercises the most common options:
nuxe.config.ts
import { defineConfig } from '@dvlkit/nuxe/config'
import tailwindcss from '@tailwindcss/vite'

export default defineConfig({
  runtimeConfig: {
    apiSecret: 'default-secret',
    public: {
      apiBase: '/api',
    },
  },
  vite: {
    plugins: [
      tailwindcss(),
    ],
  },
})

Options

server

server
object
Server configuration options. All sub-fields are optional; omitting the entire server key is the same as passing an empty object.
server.port
number
Port the dev server (and production server) listens on. Must be an integer between 1 and 65535, inclusive. The final port is resolved in order: the PORT environment variable, then this config value, then the hardcoded fallback of 3000.
nuxe.config.ts
import { defineConfig } from '@dvlkit/nuxe/config'

export default defineConfig({
  server: {
    port: 4000,
  },
})
server.apiPrefix
string
URL prefix under which all server API routes are mounted. Must start with / followed by at least one additional character — the value / alone is rejected. Trailing slashes are stripped automatically. Defaults to /api.
nuxe.config.ts
import { defineConfig } from '@dvlkit/nuxe/config'

export default defineConfig({
  server: {
    apiPrefix: '/v1',
  },
})
The regex that validates apiPrefix is ^\\/(?!\\/) — it must begin with a single / and the next character must not also be /. Values like //api or api are invalid.

vite

vite
UserConfig
Any valid Vite UserConfig. This object is deeply merged with Nuxe’s internal Vite configuration, so you can extend plugins, resolve aliases, or adjust build options without overriding Nuxe’s required setup.
The playground adds Tailwind CSS v4’s Vite plugin:
nuxe.config.ts
import { defineConfig } from '@dvlkit/nuxe/config'
import tailwindcss from '@tailwindcss/vite'

export default defineConfig({
  vite: {
    plugins: [
      tailwindcss(),
    ],
  },
})
You can reference import.meta.env inside Vite plugin configuration just as you would in any Vite project. Environment variables are available to the Vite config layer at build time.

runtimeConfig

runtimeConfig
object
Static runtime values available to server-side code. Any key nested under the public sub-object is also exposed to the client. Keys at the top level are server-only. Values can be strings, numbers, booleans, null, or nested objects — arrays are not supported.
nuxe.config.ts
import { defineConfig } from '@dvlkit/nuxe/config'

export default defineConfig({
  runtimeConfig: {
    apiSecret: 'default-secret', // server-only
    public: {
      apiBase: '/api',           // exposed to client
    },
  },
})
All runtime config values can be overridden at startup via NUXE_* environment variables without a rebuild. See the Runtime Config reference for the full override convention.

baseUrl

baseUrl
string
Base URL used by useFetch when resolving relative request URLs on the server. When this field is omitted, Nuxe falls back to the NUXE_BASE_URL environment variable (which the CLI sets automatically at startup), and ultimately to http://localhost:PORT if neither is set.
nuxe.config.ts
import { defineConfig } from '@dvlkit/nuxe/config'

export default defineConfig({
  baseUrl: 'https://myapp.example.com',
})

Notes

nuxe.config.ts is loaded with c12, so standard TypeScript and ESM syntax is supported out of the box — no extra build step required.
You can access Vite-injected import.meta.env values inside your config file. This is useful for setting baseUrl or Vite plugin options conditionally based on the current environment.

Build docs developers (and LLMs) love