# Extension points — withastro/astro

> Canonical page: https://codevetter.com/unpack/astro/extension-points

# Extension points — withastro/astro

Scanned commit 4c1470a7f907fe678ef5e7dceaa972ca83d297da (2026-10-02). Generated by codevetter codevetter 1.15.0 on 2026-10-02.

Source inspection; upstream code and tests were not executed.

Astro extends through named integration hooks, framework renderer registration, route injection, content loader protocols, and replaceable runtime providers. Vite virtual modules bridge generated configuration and bundled runtime code. Composable fetch APIs support alternative host-framework request chains. Several internal hooks are deliberately outside semver guarantees, so agents should distinguish supported public contracts from implementation conveniences.
- Integration objects expose hooks by name; runHookInternal() supplies an integration logger, awaits execution, and reports long-running hooks. — [packages/astro/src/integrations/hooks.ts#L41-97](https://github.com/withastro/astro/blob/4c1470a7f907fe678ef5e7dceaa972ca83d297da/packages/astro/src/integrations/hooks.ts#L41-L97)
- astro:config:setup supplies addRenderer(), requiring a renderer name and serverEntrypoint; React registers its renderer and Vite configuration through this hook. — [packages/astro/src/integrations/hooks.ts#L227-244](https://github.com/withastro/astro/blob/4c1470a7f907fe678ef5e7dceaa972ca83d297da/packages/astro/src/integrations/hooks.ts#L227-L244) [packages/integrations/react/src/index.ts#L185-200](https://github.com/withastro/astro/blob/4c1470a7f907fe678ef5e7dceaa972ca83d297da/packages/integrations/react/src/index.ts#L185-L200)
- Integrations can inject routes and scripts, merge configuration, add watch files, and register dev-toolbar applications. — [packages/astro/src/integrations/hooks.ts#L246-271](https://github.com/withastro/astro/blob/4c1470a7f907fe678ef5e7dceaa972ca83d297da/packages/astro/src/integrations/hooks.ts#L246-L271)
- addClientDirective() rejects duplicate names and builds directive entrypoints; addMiddleware() registers entrypoints before or after application middleware. — [packages/astro/src/integrations/hooks.ts#L273-299](https://github.com/withastro/astro/blob/4c1470a7f907fe678ef5e7dceaa972ca83d297da/packages/astro/src/integrations/hooks.ts#L273-L299)
- Internal addPageExtension(), addContentEntryType(), and addDataEntryType() hooks modify registries but are explicitly documented as outside semver guarantees. — [packages/astro/src/integrations/hooks.ts#L308-325](https://github.com/withastro/astro/blob/4c1470a7f907fe678ef5e7dceaa972ca83d297da/packages/astro/src/integrations/hooks.ts#L308-L325)
- Adapters are integrations placed first in the setup list; Cloudflare uses setAdapter() to declare output features, preview entrypoint, and supported capabilities. — [packages/astro/src/integrations/hooks.ts#L183-186](https://github.com/withastro/astro/blob/4c1470a7f907fe678ef5e7dceaa972ca83d297da/packages/astro/src/integrations/hooks.ts#L183-L186) [packages/integrations/cloudflare/src/index.ts#L532-555](https://github.com/withastro/astro/blob/4c1470a7f907fe678ef5e7dceaa972ca83d297da/packages/integrations/cloudflare/src/index.ts#L532-L555)
- Content collections can supply function loaders or object loaders with load(), schema, and createSchema(); the loader context scopes data and metadata access to the collection. — [packages/astro/src/content/content-layer.ts#L120-146](https://github.com/withastro/astro/blob/4c1470a7f907fe678ef5e7dceaa972ca83d297da/packages/astro/src/content/content-layer.ts#L120-L146) [packages/astro/src/content/content-layer.ts#L297-346](https://github.com/withastro/astro/blob/4c1470a7f907fe678ef5e7dceaa972ca83d297da/packages/astro/src/content/content-layer.ts#L297-L346)
- DataStoreWriter separates persistence from mutable storage, while DataStoreSource separates async-capable runtime queries from the default in-memory implementation. — [packages/astro/src/content/data-store-writer.ts#L10-27](https://github.com/withastro/astro/blob/4c1470a7f907fe678ef5e7dceaa972ca83d297da/packages/astro/src/content/data-store-writer.ts#L10-L27) [packages/astro/src/content/data-store-source.ts#L13-35](https://github.com/withastro/astro/blob/4c1470a7f907fe678ef5e7dceaa972ca83d297da/packages/astro/src/content/data-store-source.ts#L13-L35)
- astro/fetch exposes independently composable middleware, pages, actions, sessions, i18n, and cache functions; logic belongs in handler modules rather than the public wrapper file. — [packages/astro/src/core/fetch/index.ts#L1-20](https://github.com/withastro/astro/blob/4c1470a7f907fe678ef5e7dceaa972ca83d297da/packages/astro/src/core/fetch/index.ts#L1-L20) [packages/astro/src/core/fetch/index.ts#L56-83](https://github.com/withastro/astro/blob/4c1470a7f907fe678ef5e7dceaa972ca83d297da/packages/astro/src/core/fetch/index.ts#L56-L83) [packages/astro/src/core/fetch/index.ts#L105-128](https://github.com/withastro/astro/blob/4c1470a7f907fe678ef5e7dceaa972ca83d297da/packages/astro/src/core/fetch/index.ts#L105-L128)
- FetchState context providers support lazy creation and finalization; the session provider registers AstroSession and persists it through PERSIST_SYMBOL. — [packages/astro/src/core/session/handler.ts#L19-49](https://github.com/withastro/astro/blob/4c1470a7f907fe678ef5e7dceaa972ca83d297da/packages/astro/src/core/session/handler.ts#L19-L49)
- Vite SSR plugins can expose api.buildPostHook for extracted chunk mutation after environment builds; React's options plugin demonstrates resolveId/load generation of a virtual module. — [packages/astro/src/core/build/static-build.ts#L268-274](https://github.com/withastro/astro/blob/4c1470a7f907fe678ef5e7dceaa972ca83d297da/packages/astro/src/core/build/static-build.ts#L268-L274) [packages/integrations/react/src/index.ts#L42-69](https://github.com/withastro/astro/blob/4c1470a7f907fe678ef5e7dceaa972ca83d297da/packages/integrations/react/src/index.ts#L42-L69)

Every claim links to its cited files at the pinned commit. Citations identify source evidence; they do not establish runtime correctness. Independent CodeVetter scan — not reviewed by upstream maintainers.

## Public product links

- [CodeVetter](https://codevetter.com/)
- [Download](https://codevetter.com/download)
- [Documentation](https://codevetter.com/docs/)
- [Source](https://github.com/Codevetter/codevetter)
