# Auth hosts

## Providers

Better Auth is the only Auth provider. ViteHub keeps its storage, OAuth providers, and client plugins.

| Concern | Owner |
| --- | --- |
| Sign-in methods, OAuth providers, plugins | Better Auth options in the Auth Definition. |
| User and session storage | `authDatabase()`, which adds the Better Auth tables to the app Database, or a Better Auth database adapter that the callback or `runtime` returns. |
| Route mounting | A generated Nitro handler, also in development. Manual hosts mount `#vitehub/auth/server`. |
| Roles and permissions | Your `authorize` callbacks. ViteHub defines no roles. |

## Provider output

Provider output is the code Auth generates for the host: the Definition module, route handler, access middleware, and ambient types (`.vitehub/types/auth.d.ts`). Your code imports `@vite-hub/auth/server` or Better Auth clients, never these files.

Set `route: false` only when a host integration or your own route mounts the Auth handler.

```ts [server/auth.ts]
import { defineAuth } from '@vite-hub/auth'

export default defineAuth({
  appName: 'Acme',
  route: false,
})
```

The default export of `#vitehub/auth/server` is the Auth route as a Fetchable, `{ fetch(request) }`. Mount it below the same `basePath`:

```ts [server/routes/api/auth/[...].ts]
export { default } from '#vitehub/auth/server'
```

It reads the client address and the Cloudflare bindings from the [Standard Context](https://vitehub.dev/docs/reference/runtime-context#standard-context) of the Request. Nitro sets it on each Request in a ViteHub app.

<!-- vitehub-docs:section-links -->
## In this section

- [Overview](https://vitehub.dev/raw/docs/auth.md)
- [Get started](https://vitehub.dev/raw/docs/auth/get-started.md)
- [Configure](https://vitehub.dev/raw/docs/auth/configure.md)
- [Server API](https://vitehub.dev/raw/docs/auth/server-api.md)
- [Hosts](https://vitehub.dev/raw/docs/auth/hosts.md) (this page)
- [Limits and errors](https://vitehub.dev/raw/docs/auth/limits-and-errors.md)
- [Console](https://vitehub.dev/raw/docs/auth/console.md)
- [Event log](https://vitehub.dev/raw/docs/auth/events.md)

Next: [AUTH_R0004](https://vitehub.dev/raw/docs/auth/diagnostics/auth_r0004.md)

All pages: [llms.txt](https://vitehub.dev/llms.txt)
