defineServerConfig
defineServerConfig(
props):VexConfig
Defined in: packages/core/src/config/config.ts:250
Layers server-only settings onto an already-resolved VexClientConfig,
producing the full VexConfig every server-side and Convex reader
consumes.
Validates that every mediaCollection.meta.storageAdapter resolves to a
registered adapter instance, and — when an auth adapter is registered —
that the auth collections the client config declares match the ones the
live adapter produces from the real auth options. The client config builds
its authCollections from a schema description it can safely import into
the browser; only this function holds the live adapter, so this is where a
mismatch becomes an error instead of an admin panel quietly missing a
column. Registering the adapter is optional: a project with no auth, or
one that prefers to skip the check, simply omits server.auth.
Parameters
Section titled “Parameters”config and the server-only settings to layer on.
config
Section titled “config”The resolved VexClientConfig, typically the
default export of vex.config.ts.
server?
Section titled “server?”Server-only settings: the auth adapter and the storage adapter instances. Nothing else belongs here.
Returns
Section titled “Returns”The resolved VexConfig, structurally containing every field of props.config.
Throws
Section titled “Throws”When a media collection names an unregistered storage adapter.
Throws
Section titled “Throws”When config.authCollections disagrees with the
registered auth adapter’s collections.
Example
Section titled “Example”import config from "./vex.config";import { betterAuthAdapter } from "@vexcms/better-auth";
export default defineServerConfig({ config, server: { auth: { adapter: betterAuthAdapter({ config: authOptions }) }, storage: { adapters: [convexFileStorage()] }, },});- VexServerConfigInput for the user-facing server input type
- VexConfig for the resolved return type
- diffAuthCollections for the comparison