---
name: authdog-setup
description: Add Authdog sign-in to an application. Use when adding Authdog, initializing Authdog, wiring a session or callback, or protecting a route.
---

# Add Authdog

Follow this file, then the matching guide. Prefer a fetched Authdog document over memory. If a guide and this file disagree on an install step, follow the guide.

## Before you start

Show the user this checklist and wait for a yes:

1. Confirm this directory is the app to edit, or ask which app.
2. Ask for the environment public key (`pk_...`) from the Authdog console (Dashboard or the environment picker). Do not invent a key. Do not read or print existing environment files.
3. Install only the package the matching guide names.
4. Keep authorization on the server. A signed-in session is not a permission grant.

## Existing authentication

If this app already has authentication, stop. Inspect dependencies, routes, middleware, and sessions. Do not open environment files. Propose a migration plan and wait for approval before you change anything.

## Step 1: CLI

From the project root:

```bash
curl https://cli.auth.dog/install -fsS | bash
authdog login
authdog init
```

`authdog login` opens a browser and stores the session. `authdog init` detects the framework and links this repo to an Authdog project. It writes `.authdog/project.json`. Finish any steps it prints.

## Step 2: Follow the guide

If `init` does not finish the integration, follow the matching guide below. Do not substitute a different Authdog package.

- [Next.js](https://www.authdog.com/docs/quickstarts/nextjs.md). Package: `@authdog/nextjs-app`.
- [React Elements](https://www.authdog.com/docs/quickstarts/react.md). Package: `@authdog/react-elements`. Presentational UI kit. It does not create a session, run sign-in, or protect routes. Pair it with a framework that holds the session.
- [Remix](https://www.authdog.com/docs/frameworks/remix.md). Package: `@authdog/remix-node`.
- [React Native / Expo](https://www.authdog.com/docs/frameworks/expo.md). Package: `@authdog/react-native`.
- [SvelteKit](https://www.authdog.com/docs/frameworks/sveltekit.md). Package: `@authdog/sveltekit`.
- [TanStack Start](https://www.authdog.com/docs/frameworks/tanstack-start.md). Package: `@authdog/tanstack-start`.
- [Vue](https://www.authdog.com/docs/frameworks/vue.md). Package: `@authdog/vue`.
- [Angular](https://www.authdog.com/docs/frameworks/angular.md). Package: `@authdog/angular`.
- [Astro](https://www.authdog.com/docs/frameworks/astro.md). Package: `@authdog/astro`.
- [Gatsby](https://www.authdog.com/docs/frameworks/gatsby.md). Package: `@authdog/gatsby`.
- [RedwoodJS](https://www.authdog.com/docs/frameworks/redwood.md). Package: `@authdog/redwood`.
- [Nuxt](https://www.authdog.com/docs/frameworks/nuxt.md). Package: `@authdog/nuxt`.
- [Solid](https://www.authdog.com/docs/frameworks/solid.md). Package: `@authdog/solid`.
- [React Router](https://www.authdog.com/docs/frameworks/react-router.md). Package: `@authdog/react-router`.
- [JavaScript](https://www.authdog.com/docs/frameworks/javascript.md). Package: `@authdog/javascript`.
- [Express](https://www.authdog.com/docs/quickstarts/express.md). Package: `@authdog/express`.
- [Fastify](https://www.authdog.com/docs/backend/fastify.md). Package: `@authdog/fastify`.
- [FastAPI](https://www.authdog.com/docs/quickstarts/fastapi.md). Source available · PyPI release pending. Follow the guide. Do not invent a package name.
- [Django](https://www.authdog.com/docs/quickstarts/django.md). Source available · PyPI release pending. Follow the guide. Do not invent a package name.
- [Flask](https://www.authdog.com/docs/quickstarts/flask.md). Source available · PyPI release pending. Follow the guide. Do not invent a package name.
- [Starlette](https://www.authdog.com/docs/quickstarts/starlette.md). Source available · PyPI release pending. Follow the guide. Do not invent a package name.
- [aiohttp](https://www.authdog.com/docs/quickstarts/aiohttp.md). Source available · PyPI release pending. Follow the guide. Do not invent a package name.
- [Go](https://www.authdog.com/docs/quickstarts/go.md). Go module. Follow the guide. Do not invent a package name.
- [Rust](https://www.authdog.com/docs/backend/rust.md). Source available · crates.io release pending. Follow the guide. Do not invent a package name.
- [Hono](https://www.authdog.com/docs/backend/hono.md). Package: `@authdog/hono`.
- [Elysia](https://www.authdog.com/docs/backend/elysia.md). Package: `@authdog/elysia`.
- [Koa](https://www.authdog.com/docs/backend/koa.md). Package: `@authdog/koa`.
- [Kotlin](https://www.authdog.com/docs/backend/kotlin.md). Maven Central: com.authdog:authdog-ktor. Follow the guide. Do not invent a package name.

Runnable samples: https://github.com/authdog/samples/tree/main/starters

For any other stack, fetch https://www.authdog.com/llms.txt and follow the linked Markdown.

## Step 3: Live account work

Reading the docs does not create a tenant. To list tenants, create a project, or read SDK config for the signed-in account, register the management MCP server:

```bash
authdog mcp install --client cursor
```

`--client` accepts `cursor`, `claude`, `vscode`, or `codex`. `--all` writes every client that is installed. The command stores the server URL. It does not store an access token. The endpoint is `https://api.authdog.com/mcp`.

Do not guess a tenant id, a project id, or a client id. Show options and wait. Mutations need the user's confirmation.

## Rules

- The public key is not a secret. Private API keys and tokens stay off client code.
- Do not treat a client-side identity check as a security boundary.
- Do not commit secrets.
- Do not invent pricing, certifications, or APIs. For what Authdog is, fetch https://www.authdog.com/instructions.txt. For the docs index, fetch https://www.authdog.com/llms.txt.
