Configuration File
This documentation is for the preview version of the Dev Portal. If you are using the legacy developer portal, please refer to the docs.
Dev Portal uses a single file for configuration. It controls the structure, metadata, style, plugins, and routing for your documentation.
You can find the file in the root directory of your project. It will start with zudoku.config
. The file can be in either JavaScript or TypeScript format and use a .js
, .mjs
, .jsx
, .ts
, or .tsx
file extension:
zudoku.config.ts
zudoku.config.tsx
zudoku.config.js
zudoku.config.jsx
zudoku.config.mjs
When you create a project, a default configuration file is generated for you. This file is a good starting point and can be customized to suit your needs.
Security Consideration
The Dev Portal configuration file runs on both client and server at runtime. Avoid including secrets directly in your config as they may be exposed to the client.
Example
Below is an example of the default Dev Portal configuration. You can edit this configuration to suit your own needs.
Code(typescript)
Configuration options
apis
There are multiple options for referencing your OpenAPI document. The example below uses a URL to an OpenAPI document, but you can also use a local file path. For full details on the options available, see the API Reference.
Code(json)
page
Controls global page attributes across the site, including logos and the site title.
Example:
Code(json)
navigation
Defines navigation for both the top bar and the sidebar. Items can be categories, links or custom pages.
Code(json)
theme
Allows you to control the dark and light themes that persist across each MDX page, and the API reference.
You can customize your theme as much as you want using ShadCDN UI theme variables. In the example below only the primary
and primaryForeground
variables are used but you can add any additional variables from ShadCDN UI that you would like to change.
Tip: Use the ShadCDN UI Theme Generator to create a great looking theme based off your primary color.
Example:
Code(json)
metadata
Controls the site metadata for your documentation. All possible options are outlined in the example below.
Example:
Code(json)
docs
Configures where your non API reference documentation can be found in your folder structure. The default is shown in the example below and you don't need to change it unless you want a different structure in place, or to have it match an existing structure that you already have.
Example:
Code(json)
sitemap
Controls the sitemap for your documentation. All possible options are outlined in the example below.
Code(json)
redirects
Implements any page redirects you want to use. This gives you control over the resource names in the URL.
Example:
Code(json)
port
The port on which the development server will run. Defaults to 3000
. This option can also be passed to the CLI as `--port' (which takes precedence).
Code(json)
If the port is already in use, the next available port will be used.
basePath
Sets the base path for your documentation site. This is useful when you want to host your documentation under a specific path.
Code(ts)
canonicalUrlOrigin
Sets the canonical origin URL for your documentation site. This is used for SEO purposes and helps search engines understand the preferred version of a page.
Code(ts)
This is the resulting HTML that will be added to the <head>
of your pages:
Code(html)
cdnUrl
Configures the CDN URL for your documentation site's assets. You can provide either a string for a single CDN URL or an object to specify different URLs for base and media assets.
Code(ts)
https
Enables HTTPS for the dev server. key
and cert
are required and ca
is optional.
Code(json)
enableStatusPages
Enables static generation of status pages for your site. This results in several files (404.html, 500.html, etc.) being generated in the dist
directory. This is useful as many hosting providers will serve these files automatically when a user visits a non-existent page or encounters an error.
This option is enabled by default, but you can disable it if you don't need these pages.
Code(ts)
Multiple Files
The configuration file is a standard JavaScript or TypeScript file, so you can split it into multiple files if you prefer. This can be useful if you have a large configuration or want to keep your code organized.
For example, if you wanted to move your navigation configuration to a separate file, you could create a new file called navigation.ts
and export the navigation configuration from there.
Code(ts)
Then you can import the navigation configuration into your main configuration file.
zudoku.config.ts(ts)