LLM Reference

LLM Reference: VextroConfig & Utilities

This is a dense reference for LLMs. It documents the VextroConfig type, storage system, upload configuration, i18n, and frontend content rendering utilities.

VextroConfig

The main configuration object passed to createVextroClient() and used throughout the admin app.

type VextroConfig = {
  brandName: string;
  logoUrl?: string;
  supportUrl?: string;
  navigation?: Array<VextroNavItem>;
  workspaces?: Array<VextroWorkspaceItem>;
  basePath?: string;
  collectionGroups?: Array<VextroCollectionGroup>;
  ungroupedLabel?: string;
  auth?: VextroAuthConfig;
  inputOverrides?: VextroInputOverrides;
  createBlockEndpoint?: string;
  storage?: VextroStorageConfig;
  upload?: VextroUploadGlobalConfig;
  locale?: VextroLocaleOverrides;
  plugins?: VextroPlugin[];
  richText?: {
    allowRelativeLinks?: boolean;
    toolbar?: RichTextToolbar;
  };
  scope?: {
    types: string[];
    defaultType?: string;
    labels?: Record<string, string>;
    defaultScopeFilter?: boolean;
  };
  accessControlSections?: VextroAccessControlSectionsConfig;
  autoSave?: {
    enabled?: boolean;
    debounceMs?: number;
  };
  presenceLabelFn?: (user: { userId: string; userName: string; userEmail?: string }) => string;
  accessControl?: {
    builtInUI?: boolean;
    labels?: {
      sectionTitle?: string;
      users?: { singular?: string; plural?: string };
      roles?: { singular?: string; plural?: string };
    };
  };
};

VextroConfig Options Table

FieldTypeDefaultDescription
brandNamestringrequiredDisplayed in sidebar header and login page.
logoUrlstring—URL to brand logo image.
supportUrlstring—Link to support/help resources.
navigationVextroNavItem[]—Custom navigation items { label, href }.
workspacesVextroWorkspaceItem[]—Workspace switcher items { label, href }.
basePathstring""URL prefix for admin routes (e.g., "/admin").
collectionGroupsVextroCollectionGroup[]—Sidebar grouping: { label, slugs: string[] }.
ungroupedLabelstring"Collections"Label for ungrouped collections in sidebar.
authVextroAuthConfig—Authentication configuration.
inputOverridesVextroInputOverrides—Custom field input components.
createBlockEndpointstring"/api/admin/blocks/create"API endpoint for block creation.
storageVextroStorageConfig—Storage adapter configuration.
uploadVextroUploadGlobalConfig—Global upload settings.
localeVextroLocaleOverrides—i18n overrides merged with English defaults.
pluginsVextroPlugin[]—Plugins to register.
richText.allowRelativeLinksbooleanfalseAllow relative URLs in rich text link dialog.
richText.toolbarRichTextToolbar—Default toolbar config for all rich text fields.
scope.typesstring[]—Available scope types (e.g., ["region"]).
scope.defaultTypestring—Default scope type when none specified.
scope.labelsRecord<string, string>—Human-readable labels for scope types.
scope.defaultScopeFilterbooleantrueFilter relationships by active scope by default.
accessControlSectionsVextroAccessControlSectionsConfig—Custom sections injected into user/role detail pages. See below.
autoSave.enabledboolean—Enable auto-save on all edit forms.
autoSave.debounceMsnumber—Debounce delay in milliseconds before auto-saving (default: 2000).
presenceLabelFn(user) => string—Custom function deriving the label shown in field-level presence badges. Defaults to initials (e.g., “John Doe” → “JD”).
accessControl.builtInUIbooleantrueWhen false, hides the built-in Access Control section from the sidebar entirely.
accessControl.labels.sectionTitlestring"Access Control"Override the sidebar section heading.
accessControl.labels.users{ singular, plural }—Override user-related link labels (e.g., { singular: "Member", plural: "Members" }).
accessControl.labels.roles{ singular, plural }—Override role-related link labels (e.g., { singular: "Group", plural: "Groups" }).

VextroAuthConfig

type VextroAuthConfig = {
  providerId?: string;
  callbackPath?: string;
  authPath?: string;
  title?: string;
  description?: string;
  buttonLabel?: string;
};
FieldTypeDefaultDescription
providerIdstring—OAuth provider identifier.
callbackPathstring—OAuth callback route path.
authPathstring—Base path for auth API routes.
titlestring—Login page title.
descriptionstring—Login page description text.
buttonLabelstring—Login button text.

VextroInputOverrides

type VextroInputOverrides = {
  components?: Record<string, VextroInputComponent>;
  context?: Record<string, unknown>;
};

Allows replacing built-in field input components with custom implementations keyed by field type name.

VextroAccessControlSectionsConfig

Extension points for injecting custom Svelte components into the built-in Access Control pages.

type VextroAccessControlSectionsConfig = {
  userDetail?: VextroAccessControlSection<VextroUserDetailSectionPosition>[];
  roleDetail?: VextroAccessControlSection<VextroRoleDetailSectionPosition>[];
};

type VextroAccessControlSection<TPosition = string> = {
  slug: string;
  label: string;
  component: unknown;  // Svelte component
  position: TPosition;
  priority?: number;   // lower renders first at the same position (default: 0)
  chrome?: boolean;    // false = render without card wrapper (default: true)
};

// Valid positions for userDetail sections
type VextroUserDetailSectionPosition =
  | "before-info" | "after-info"
  | "before-status" | "after-status"
  | "before-roles" | "after-roles";

// Valid positions for roleDetail sections
type VextroRoleDetailSectionPosition =
  | "before-users" | "after-users"
  | "before-permissions" | "after-permissions"
  | "before-details" | "after-details"
  | "tab";

Section Component Props

Custom section components receive different props depending on the page they are injected into:

// Props received by userDetail section components
type VextroUserDetailSectionProps = {
  userId: string;
  basePath: string;
};

// Props received by roleDetail section components
type VextroRoleDetailSectionProps = {
  roleId: string;
  basePath: string;
};

Example

import MyUserAuditLog from './MyUserAuditLog.svelte';
import MyRoleCapabilities from './MyRoleCapabilities.svelte';

const config: VextroConfig = {
  brandName: 'My Admin',
  accessControlSections: {
    userDetail: [
      {
        slug: 'audit-log',
        label: 'Audit Log',
        component: MyUserAuditLog,
        position: 'after-roles',
        priority: 0,
      },
    ],
    roleDetail: [
      {
        slug: 'capabilities',
        label: 'Capabilities',
        component: MyRoleCapabilities,
        position: 'tab',
      },
    ],
  },
};

VextroStorageConfig

type VextroStorageConfig = {
  default: VextroStorageAdapter;
  adapters?: Record<string, VextroStorageAdapter>;
};
FieldTypeDescription
defaultVextroStorageAdapterDefault adapter used by all upload collections.
adaptersRecord<string, VextroStorageAdapter>Named adapters for per-collection override.

VextroStorageAdapter Interface

Storage adapters must implement:

type VextroStorageAdapter = {
  name: string;
  upload: (file: File, options: UploadOptions) => Promise<UploadResult>;
  delete: (storageRef: string) => Promise<void>;
  getUrl: (storageRef: string) => string | Promise<string>;
};

S3AdapterConfig

type S3AdapterConfig = {
  bucket: string;
  region: string;
  accessKeyId: string;
  secretAccessKey: string;
  endpoint?: string;
  prefix?: string;
  publicUrl?: string;
  forcePathStyle?: boolean;
};

VextroUploadGlobalConfig

type VextroUploadGlobalConfig = {
  maxFileSize?: number;        // bytes, default 10MB
  restrictedMimeTypes?: string[];
};

UploadConfig (per-collection)

type UploadConfig = {
  mimeTypes?: string[];
  maxFileSize?: number;
  imageSizes?: ImageSizeConfig[];
  formatOptions?: FormatOptions;
  storageAdapter?: string;
  prefix?: string;
  disableLocalURL?: boolean;
  adminThumbnail?: string;
  focalPoint?: boolean;
  crop?: boolean | { aspectRatios?: string[] };
};

ImageSizeConfig

type ImageSizeConfig = {
  name: string;
  width?: number;
  height?: number;
  fit?: "cover" | "contain" | "fill" | "inside" | "outside";
  position?: string;
  format?: "webp" | "avif" | "jpeg" | "png" | "original";
  quality?: number;
  withoutEnlargement?: boolean;
};

createVextroClient

function createVextroClient(options: VextroClientOptions): VextroClientOptions;

type VextroClientOptions = {
  convexUrl: string;
  config: VextroConfig;
};

A pass-through factory that validates and returns the config. Used in admin app configuration.

Content Rendering Utilities

Exported from "vextro/content" or "vextro".

renderTipTapToHtml

function renderTipTapToHtml(doc: TipTapDoc | RichTextContent): string;

Converts TipTap JSON content to an HTML string for frontend rendering.

extractPlainText

function extractPlainText(doc: TipTapDoc | RichTextContent): string;

Extracts plain text from TipTap JSON, stripping all formatting.

buildSrcSet

function buildSrcSet(variants: ImageVariant[]): string;

Builds a srcset attribute string from image size variants.

buildImageSizes

function buildImageSizes(variants: ImageVariant[]): string;

Builds a sizes attribute string from image size variants.

focalPointToObjectPosition

function focalPointToObjectPosition(focalX: number, focalY: number): string;

Converts focal point coordinates (0-100) to a CSS object-position value.

Additional Image Utilities

function groupVariantsByFormat(variants: ImageVariant[]): Map<string, ImageVariant[]>;
function hasModernFormat(variants: ImageVariant[]): boolean;
function getLargestVariant(variants: ImageVariant[]): ImageVariant | undefined;
function getSmallestVariant(variants: ImageVariant[]): ImageVariant | undefined;

Version Diff Utilities

Exported from "vextro".

function diffDocuments(a: Record<string, unknown>, b: Record<string, unknown>): FieldDiff[];
function diffRichText(a: TipTapDoc, b: TipTapDoc): RichTextDiff;
function diffJson(a: unknown, b: unknown): JsonDiff;
function diffText(a: string, b: string): TextDiffSegment[];
function isDeepEqual(a: unknown, b: unknown): boolean;

i18n System

createI18n

function createI18n(overrides?: VextroLocaleOverrides): void;

Initializes the i18n system with optional overrides merged into the English defaults.

t (translate)

function t(key: string, params?: Record<string, string | number>): string;

Returns the localized string for a key with optional parameter interpolation.

defineLocale

function defineLocale(locale: VextroLocale): VextroLocale;

Type-safe factory for defining a complete locale. Useful for creating full translations.

getLocale

function getLocale(): VextroLocale;

Returns the current active locale object.

Workflow Types

type WorkflowConfig = {
  enabled: boolean;
  stages: WorkflowStageDefinition[];
};

type WorkflowStageDefinition = {
  name: string;
  label: string;
  color?: string;
  requiredRole?: string;
  autoTransition?: {
    afterApprovals?: number;
  };
};

Workflow stages define multi-editor approval chains for content collections. Each stage can require a specific role and auto-advance after a set number of approvals.

Previous
Hooks System