API reference
Every public export of Hamur 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 |
|---|---|---|
hamur | hamur | defineConfig and the config types |
hamur/app | hamur/app | code that runs in pages: loaders, middleware, errors, state, head, $fetch, app plugins |
hamur/server | hamur/server | code that runs on the server: handlers, request and response utilities, sessions, storage, cache, WebSockets |
hamur/kit | hamur/kit | the module author's tools |
hamur/adapter | hamur/adapter, hamur/adapter/dev | what an adapter implements, and its dev-only helpers |
@hamur/adapter-<library> | @hamur/adapter-react, @hamur/adapter-vue, @hamur/adapter-preact, @hamur/adapter-solid, @hamur/adapter-svelte, @hamur/adapter-html | the hooks and components of each adapter, one section per name |
@hamur/i18n | @hamur/i18n | the i18n module, its options and useApp().i18n |
@hamur/db | @hamur/db, @hamur/db/server, @hamur/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 inhamur'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 hamur/kit has no heading naming it.