API reference
Every public export of Silgi has a section in this reference, with its signature and a short example. The examples are real files in landing/samples/api/ that the repository's check compiles, so they match the code.
| Page | Import from | What it holds |
|---|---|---|
silgi | silgi | defineConfig and the config types |
silgi/app | silgi/app | code that runs in pages: loaders, middleware, errors, state, head, $fetch, app plugins |
silgi/server | silgi/server | code that runs on the server: handlers, request and response utilities, sessions, storage, cache, WebSockets |
silgi/kit | silgi/kit | the module author's tools |
silgi/adapter | silgi/adapter, silgi/adapter/dev | what an adapter implements, and its dev-only helpers |
@silgi/<library> | @silgi/react, @silgi/vue, @silgi/preact, @silgi/solid, @silgi/svelte, @silgi/html | the hooks and components of each adapter, one section per name |
@silgi/i18n | @silgi/i18n | the i18n module, its options and useApp().i18n |
@silgi/db | @silgi/db, @silgi/db/server, @silgi/db/cli | the db module, its connections, migrations, useDatabase and runDbCommand |
A name that two entry points export, such as $fetch and createError, is documented on both pages and is the same function.
How the pages are written
- A function has one section with its signature and an example.
- Types that belong to a function are grouped in one section after it, with a table of their fields.
src/directories and internal modules, such as the files insilgi'ssrc/runtime/, are not public and are not listed.
The script scripts/check-api-docs.ts runs in bun run check as check:api-docs. It reads the export statements of each entry point's index file and fails, naming the export, when a page has no heading that contains that name in backticks. It also reads the exports of every package and fails when an entry such as silgi/kit has no heading naming it.