Skip to main content
View as Markdown

Type Reference

Beyond AppConfig, Sovrium exports a type per config section. Each is the element type of its array — PageConfig is what goes in AppConfig['pages'] — so you can build a section in one module and assemble it in another with no casts.

import type { PageConfig, TableConfig, ThemeConfig } from 'sovrium'

SimpleServer

Returned by start(). A two-property handle on the running server.

Property Description
url Server URL including protocol and port (e.g. "http://localhost:3000").
stop() Gracefully stop the server. Resolves when shutdown is complete.
import { start } from 'sovrium'
import type { SimpleServer } from 'sovrium'

const server: SimpleServer = await start({ name: 'my-app' })
console.log(server.url)
await server.stop()

Read the port back from url rather than from the options you passed — with port: 0, or when the requested port was taken, they differ.

PageConfig

One page: its route, metadata and component tree. Element of AppConfig['pages']. Only name and path are required.

const page: PageConfig = {
  name: 'Home',
  path: '/',
  components: [
    { type: 'hero', content: 'Build apps from config' },
    { type: 'text', content: 'Get started in minutes.' },
  ],
}

TableConfig

One data table and its fields. Element of AppConfig['tables'].

const table: TableConfig = {
  id: 1,
  name: 'tasks',
  fields: [{ id: 1, name: 'title', type: 'single-line-text', required: true }],
}

ComponentConfig

A reusable component template with $-prefixed variable placeholders, filled in at each use site. Element of AppConfig['components'].

const sectionHeader: ComponentConfig = {
  name: 'section-header',
  type: 'container',
  props: { className: 'text-center mb-12' },
  children: [
    { type: 'text', props: { level: 'h2' }, content: '$title' },
    { type: 'text', props: { level: 'p' }, content: '$subtitle' },
  ],
}

ThemeConfig

Design tokens — colors, typography, spacing, shadows, radii, breakpoints, animations. These compile to CSS variables, so a token defined here is usable anywhere in the config.

const theme: ThemeConfig = {
  colors: { primary: '#3b82f6' },
  fonts: { sans: 'Inter, sans-serif' },
}

AuthConfig

Sign-in strategies, roles, and the plugins they enable.

const auth: AuthConfig = {
  strategies: [{ type: 'emailAndPassword' }],
  roles: [{ name: 'admin' }, { name: 'member' }],
}

LanguageConfig

Supported languages, the default, and translations. Unlike the others this is an object, not an array element — it maps to AppConfig['languages'] whole. Each entry in supported is an object, not a bare code: the short code drives URLs and translation keys, while locale fills the HTML lang attribute.

const languages: LanguageConfig = {
  default: 'en',
  supported: [
    { code: 'en', locale: 'en-US', label: 'English', direction: 'ltr' },
    { code: 'fr', locale: 'fr-FR', label: 'Français', direction: 'ltr' },
  ],
}

AnalyticsConfig

Built-in privacy-friendly analytics. A union: true takes the defaults, an object customises them.

const analytics: AnalyticsConfig = true

const custom: AnalyticsConfig = { retentionDays: 90, excludedPaths: ['/admin'] }

Last updated July 27, 2026

This documentation was written with AI, so errors or outdated content are possible. Sovrium is in beta — contributions and corrections are welcome.

Built with Sovrium