Skip to main content
Docs

Clerk CLI

The Clerk CLI is a command-line tool for you and your agents to set up and manage Clerk authentication directly from the terminal. It supports 10+ frameworks.

Installation

Install the CLI globally, or run it directly without installing using npx clerk or bunx clerk.

terminal
npm install -g clerk
terminal
pnpm install -g clerk
terminal
yarn global add clerk
terminal
bun add -g clerk
terminal
brew install clerk/stable/clerk
terminal
curl -fsSL https://clerk.com/install | bash

Get started

Run clerk init in your project directory to get started:

terminal
clerk init

This command auto-detects your framework, installs the appropriate Clerk SDK, and applies framework-specific setup such as auth pages, middleware, and providers. If you're authenticated with clerk auth login, it also links your project to a Clerk application and pulls your environment variables automatically.

You can also use clerk init --starter to bootstrap a brand new project from a starter template, or run clerk init without an account to get started immediately with temporary development keys.

Note

clerk init doesn't currently support scaffolding for this SDK. You can still use the CLI for app and environment management.

  • Set up authenticationclerk init detects your framework, installs the SDK, and scaffolds your project with Clerk's authentication setup.
  • Manage environment variablesclerk env pull pulls your Clerk API keys into your project's env file.
  • Configure your instanceclerk config pull and clerk config patch let you manage your Clerk instance's auth settings as code.
  • Access the Clerk APIclerk api is an authenticated client for Clerk's Backend API. Run clerk api ls to explore available endpoints.
  • Run diagnosticsclerk doctor validates your project's Clerk integration and flags common issues.
  • Manage applicationsclerk apps list and clerk apps create let you view and create Clerk applications from the terminal.
  • Open the Dashboardclerk open launches the Clerk Dashboard in your browser from the terminal.
  • Update the CLIclerk update updates the CLI to the latest version.

Run clerk --help for a full list of commands.

AI agent integration

The CLI is designed to work seamlessly with AI coding agents:

  • Automatic agent detection — The CLI auto-detects agent vs. human mode. Non-TTY environments default to agent mode, or you can set it explicitly with --mode agent.
  • Agent-friendly setupclerk init --prompt outputs framework-specific integration instructions for your AI agent and exits without modifying the project.
  • Clerk Skills — Run clerk skill install or accept the prompt during clerk init to install Clerk Skills, giving your AI agent deeper knowledge about Clerk's SDKs and patterns.

Frequently asked questions (FAQ)

What can't the CLI do?

The CLI handles project setup, configuration, and API access. For user management, analytics, and other advanced features, use the Clerk Dashboard directly.

Which frameworks are supported?

The CLI supports frameworks such as Next.js, React, Vue, Nuxt, Astro, React Router, TanStack Start, and more. Some frameworks like Expo, Express, and Fastify are supported for SDK installation but don't yet include full scaffolding. Run clerk init --help for the current list.

Is it open source?

Yes. The CLI is open source and available on GitHub.

How do I report a bug?

Open an issue on the GitHub repo or contact support.

How do I request a feature?

Submit feature requests on Clerk's public roadmap.

Feedback

What did you think of this content?

Last updated on