Skip to content

defineConfig

defineConfig(config?): VexConfig

Defined in: packages/core/src/config/config.ts:48

Resolves a raw Vex config input into a fully-populated VexConfig.

Applies defaults for any omitted properties — an absent collections array is replaced with an empty array so downstream consumers can always iterate without null-checking.

When an auth adapter is provided, its collections are merged with user-defined collections via mergeAuthCollections. Protected auth collections cannot be overridden, and locked fields are preserved.

VexConfigInput

The raw Vex configuration supplied by the caller.

VexConfig

The resolved VexConfig with all defaults applied.

// Basic config with user-defined collections only
defineConfig({
collections: [
defineCollection({ slug: "posts", fields: { title: text() } }),
],
});
// Config with Better Auth integration
import { betterAuthAdapter } from "@vexcms/better-auth";
defineConfig({
auth: betterAuthAdapter(authOptions),
collections: [posts, authors],
});