@noxion/core
Config API
import { defineConfig, loadConfig } from "@noxion/core";
defineConfig()
Typed helper for authoring noxion.config.ts. It returns your input unchanged, so editor inference works without runtime side effects.
Signature
function defineConfig(input: NoxionConfigInput): NoxionConfigInput
Parameters
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
rootNotionPageId | string | * | — | Root Notion database page ID. Required unless collections is set. |
name | string | ✅ | — | Site name |
domain | string | ✅ | — | Production domain without protocol |
author | string | ✅ | — | Default author name |
description | string | ✅ | — | Site description |
collections | NoxionCollection[] | — | undefined | Multi-database configuration |
defaultPageType | string | — | "blog" | Default page type for single-database mode |
rootNotionSpaceId | string | — | undefined | Notion workspace ID |
language | string | — | "en" | BCP 47 language tag |
defaultTheme | ThemeMode | — | "system" | Initial color mode |
revalidate | number | — | 3600 | ISR revalidation interval in seconds |
revalidateSecret | string | — | undefined | Secret for on-demand revalidation |
plugins | PluginConfig[] | — | undefined | Plugins to enable |
What defineConfig does
- Provides compile-time type checking for config fields.
- Returns the input object as-is.
- Does not apply defaults or validate required fields at runtime.
Runtime defaulting/validation happens in loadConfig(input).
Single-database mode
export default defineConfig({
rootNotionPageId: process.env.NOTION_PAGE_ID!,
name: "My Blog",
domain: "myblog.com",
author: "Jane Doe",
description: "A blog about web development.",
plugins: [createRSSPlugin({ feedPath: "/feed.xml" })],
});
Multi-database mode
export default defineConfig({
name: "My Site",
domain: "mysite.com",
author: "Jane Doe",
description: "Blog, docs, and portfolio.",
collections: [
{ databaseId: process.env.NOTION_PAGE_ID!, pageType: "blog" },
{ databaseId: process.env.DOCS_NOTION_ID!, pageType: "docs", pathPrefix: "docs" },
{ databaseId: process.env.PORTFOLIO_NOTION_ID!, pageType: "portfolio", pathPrefix: "portfolio" },
],
});
loadConfig()
Validates a NoxionConfigInput object and returns a normalized NoxionConfig with defaults applied.
Signature
function loadConfig(input: NoxionConfigInput): NoxionConfig
Runtime behavior
- Throws if both
rootNotionPageIdandcollectionsare missing. - Throws if required fields like
nameordomainare missing. - Applies defaults:
language,defaultTheme,defaultPageType,revalidate. - If only
rootNotionPageIdis provided, creates a defaultcollectionsentry.
Usage
loadConfig() is called internally by the generated lib/config.ts:
// lib/config.ts (generated by create-noxion)
import { loadConfig } from "@noxion/core";
import noxionConfigInput from "../noxion.config";
export const siteConfig = loadConfig(noxionConfigInput);
NoxionCollection
interface NoxionCollection {
name?: string;
databaseId: string;
pageType: string;
pathPrefix?: string;
schema?: Record<string, string>;
}
| Field | Type | Required | Description |
|---|---|---|---|
name | string | — | Display name for the collection |
databaseId | string | ✅ | Notion database page ID |
pageType | string | ✅ | Page type: "blog", "docs", "portfolio", or custom |
pathPrefix | string | — | URL prefix (e.g. "docs" → /docs/[slug]) |
schema | Record<string, string> | — | Override default property name mapping |
See Types for the complete type reference.