Configuration
The CLI reads schemic.config.ts from your project root. Author it with defineConfig for full type-checking. schemic init scaffolds one for you.
import { defineConfig } from "@schemic/core/config";
export default defineConfig({
db: {
url: process.env.SURREAL_URL ?? "ws://localhost:8000",
namespace: "app",
database: "app",
username: process.env.SURREAL_USER,
password: process.env.SURREAL_PASS,
authLevel: "root",
},
});Top-level options
| Option | Type | Default | Description |
|---|---|---|---|
db | connection | — | The database connection. Required. |
schema | string | ./database/schema | Directory (or file) of schema modules, loaded recursively. |
migrations | string | ./database/migrations | Directory of .surql migrations and their meta/ snapshot. |
migrationsTable | string | _migrations | Table that records applied migrations. |
seed | string | ./database/seed.ts | Seed script run by schemic seed. |
check | object | — | Overrides for the schemic check replay (see below). |
Connection (db)
| Field | Type | Description |
|---|---|---|
url | string | Endpoint, e.g. ws://localhost:8000 or http://localhost:8000. |
namespace | string | Target namespace. |
database | string | Target database. |
username | string | Auth username. |
password | string | Auth password. |
authLevel | "root" | "namespace" | "database" | Level to sign in at. Default root. |
Resolution order
Each connection field resolves in this order, first match wins:
- A CLI flag (
--url,--namespace, …). - The value in
schemic.config.ts. - An environment variable:
SURREAL_URL,SURREAL_NAMESPACE,SURREAL_DATABASE,SURREAL_USER,SURREAL_PASS.
This lets you commit a config with env-backed secrets and override the target per command.
Check replay (check)
schemic check replays migrations in a throwaway engine. Configure which engine with check.engine:
engine | Behaviour |
|---|---|
"auto" (default) | Use the local surreal CLI for an ephemeral in-memory instance if present; otherwise fall back to the server. |
"binary" | Require the local surreal CLI; error if missing. |
"remote" | Always use a server, creating and dropping throwaway scratch databases. |
{ backend, ... } | Run in-process via the optional @surrealdb/node package. |
// Always replay against a scratch server, never production:
check: { engine: "remote", db: { url: "ws://localhost:8000", namespace: "scratch" } },
// Or fully in-process (npm i -D @surrealdb/node):
check: { engine: { backend: "memory" } },Where to go next
- CLI commands — the flags that override these values.
- Generate & run migrations —
schemic checkin the workflow. - Quickstart — the scaffolded config in context.