
# Type Reference

Beyond [`AppConfig`](/en/docs/typescript#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.

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

## `SimpleServer`

Returned by [`start()`](/en/docs/typescript-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.          |

```typescript
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.

```typescript
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']`.

```typescript
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']`.

```typescript
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.

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

## `AuthConfig`

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

```typescript
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.

```typescript
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.

```typescript
const analytics: AnalyticsConfig = true

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

## Related Pages

- [TypeScript API Overview](/en/docs/typescript) — `AppConfig` and the exported functions.
- [`start()`](/en/docs/typescript-start) — where `SimpleServer` comes from.
- [Schema Overview](/en/docs/schema-overview) — the same sections in YAML terms.
