Generated types
spky generate turns your .surql schema into typed TypeScript or Dart clients. Run it after every schema edit.
That reads your schema and writes a typed client for every entry under clientTypes in
sp00ky.yml. Tables become types, record<...> fields become typed relations, and the query
builder starts autocompleting your table and column names.
Configure the outputs
Each clientTypes entry is a format plus an output path, resolved relative to sp00ky.yml.
List as many as you need: a Flutter app and a web app can generate from one schema.
| Field | Notes |
|---|---|
format | typescript or dart. |
output | Destination file. Overwritten on every run; never hand-edit it. |
workdir | dart only. Directory to run the Dart generator from; must be a package depending on spooky_core. Defaults to the nearest ancestor pubspec.yaml of output. |
typescript uses the built-in generator. dart shells out to spooky_core’s generator
(dart run spooky_core:spooky_gen). See the Flutter guide.
Generating without a config
For one-off runs, or a schema that isn’t part of a project yet, point the CLI at a file directly.
Keep it fresh
Generated types drift the moment you edit .surql and forget to regenerate. Two guards:
spky devregenerates on schema changes while it’s running.spky doctorfails whenschema.gen.tsis older than the schema, and tells you to runspky generate. This is the check to wire into CI and into agent loops.
Commit the generated file. It keeps type errors visible in review, and CI doesn’t need a database to typecheck.