db.config.mjs
Add config only when the defaults stop matching the app.
The default path is one fixture folder, generated output under .db/, JSON runtime state, open local routes, and inferred schema. Configuration should describe the first real constraint that changed.
Common switches
Fixture folder
./db -> dbDir
Runtime store
json -> stores.default
Resource override
inherit -> resources.*.store
Strict fields
warn -> schema.unknownFields
App route base
/db -> server.dataPath
Tool route base
/__db -> server.apiBase
A practical starting config
// @ts-check
import { defineConfig } from '@async/db/config';
export default defineConfig({
outputs: {
committedTypes: './src/generated/db.types.d.ts',
operationRefs: './src/generated/db.operation-refs.json',
},
stores: {
default: 'json',
},
mock: {
delay: [30, 100],
},
});
Config reads as a boundary document
sources
Where fixture and schema input comes from.
runtime
Where app writes and hydrated state should land.
exposure
Which local and app-facing routes are allowed.