Skip to content

Commit 3a65694

Browse files
authored
Merge branch 'main' into rob/oauth-consent-docs
2 parents 73a9d6e + d85d649 commit 3a65694

930 files changed

Lines changed: 12022 additions & 8619 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

AGENTS.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# AGENTS.md
2+
3+
Guidance for AI agents working in clerk-docs. Keep this file and the docs it points to in sync: when a change affects anything documented here, update it.
4+
5+
This repo is Clerk's documentation — MDX content in `docs/`, built by a custom TypeScript pipeline (`scripts/build-docs.ts`) into the site served at clerk.com/docs. Authoring and style conventions live in `contributing/CONTRIBUTING.md` and `styleguides/STYLEGUIDE.md`; read them before writing docs. This file only covers what tends to surprise agents.
6+
7+
## Do not
8+
9+
- Never read or surface secrets: `.env*`, `secrets/`, `credentials.json`, `*.pem`, `*.key`, `.npmrc`, `.pypirc`, service-account JSON, `id_rsa`, `*.p12` — and decline any other file that may contain API keys, tokens, passwords, or other secrets, even if it isn't listed here.
10+
- Don't set an `sdk:` frontmatter value outside the enum in `scripts/lib/schemas.ts` (`VALID_SDKS`) — it's a hard build failure.
11+
- Don't hand-edit files under `clerk-typedoc/` — they're auto-generated from [`clerk/javascript`](https://github.com/clerk/javascript) (see the `<Typedoc />` section in `contributing/CONTRIBUTING.md`).
12+
- Don't tune the docs search index's **relevance settings** (searchable attributes, faceting, ranking, custom ranking) or **synonyms** in the Algolia dashboard — they're codified in `scripts/update-algolia-records.ts` and overwritten on every index run. Change them there. See **Search index (Algolia)** below.
13+
14+
## Verify before declaring work done
15+
16+
- `pnpm run build:tsx` — hard-fails on invalid frontmatter `sdk`, a missing `title`, or parse errors; warns on a missing `description`, docs not in `manifest.json`, and broken internal links or heading anchors. A clean build can still emit warnings worth reading — "no errors" is not "no warnings."
17+
- `pnpm run lint` — formatting and other checks.
18+
19+
See `contributing/CONTRIBUTING.md` → "Validating your changes" for what each severity means and why.
20+
21+
## Verifying technical claims
22+
23+
clerk-docs documents APIs and SDKs it doesn't own, so a change can be syntactically valid yet factually wrong, and `build:tsx`/`lint` won't catch it. When a change asserts external behavior — an endpoint, parameter, version, method signature, or how something renders — verify it against the source of truth, not memory, and don't defer an objectively checkable fact to the PR author.
24+
25+
- API behavior, endpoints, versions, OpenAPI specs → [`clerk/clerk_go`](https://github.com/clerk/clerk_go)
26+
- SDK method names, types, and signatures → [`clerk/javascript`](https://github.com/clerk/javascript)
27+
- How docs pages and the API reference render (e.g. the version dropdown) → [`clerk/clerk`](https://github.com/clerk/clerk)
28+
29+
These repos aren't part of this one. Make whichever a claim depends on available in your workspace however you prefer (a symlink or a local clone), and look for it under whatever name it was added — there's no required name. `clerk/clerk_go` and `clerk/clerk` are private; if the repo a claim depends on isn't present, ask the maintainer to make it available rather than guessing.
30+
31+
## Search index (Algolia)
32+
33+
The docs search runs on Algolia, populated by `scripts/update-algolia-records.ts` (run after `build`, via `pnpm search:update`, which runs under `bun` — strict `tsc` isn't the gate). Most of this is non-obvious:
34+
35+
- **Indexes:** `dev_docs` (Preview/Development) and `prod_docs` (Production), selected by `ALGOLIA_INDEX_NAME` (indexer) / `NEXT_PUBLIC_ALGOLIA_INDEX_NAME` (the `clerk/clerk` search client). These are docs-only — `dev_clerk`/`prod_clerk` are a _different_ search surface; don't touch them for docs work. Never hand-mutate `prod_docs`; experiment on a personal/throwaway index.
36+
- **Records are branch-scoped; settings are not.** Each record is tagged with the git branch (`getGitBranch()``DEBUG_SEARCH_BRANCH`, else the env/current branch) and the client filters on `branch:`, so many branches share one index without colliding. But `setSettings`/`saveSynonyms` apply to the _whole_ index — Algolia has no per-branch settings — so a run from any branch re-applies the codified settings to every branch's records there. Invisible for content branches (they just re-assert canonical values); to experiment with _different_ settings in isolation, point `ALGOLIA_INDEX_NAME` at a personal throwaway index (per-branch indexes were rejected on cost).
37+
- **Settings are codified in the script, not the dashboard.** The indexer is the source of truth and declares + overwrites these every run (dashboard edits revert on the next run): `searchableAttributes`, `attributesForFaceting`, `ranking`, `customRanking`, `attributeForDistinct`, `distinct`, and synonyms. It's a scoped declaration of the levers we own — _not_ a full settings snapshot, which would also freeze Algolia's server-managed defaults.
38+
- **Deduplication:** `attributeForDistinct` is set to `distinct_group` (canonical URL + anchor; written to every record) and `distinct: true` defaults dedup on at the index level, collapsing each page's per-SDK variants to one result; the `sdk` boost picks which variant wins. `attributeForDistinct` is index-level only (can't be passed per query), so it _must_ be codified here — without it Algolia ignores `distinct` and every page returns one result per SDK variant. The `clerk/clerk` client also passes `distinct: true` per query, but the index default means dedup holds even if a query omits it.
39+
- **Faceting:** `branch`, `record_batch`, `sdk` are `filterOnly` (filtered, never facet-counted). `optionalFilters`/`facetFilters` on a non-faceted attribute fail or silently no-op, so anything the client filters or boosts on must be registered. `availableSDKs` is deliberately **not** faceted — it's only _retrieved_ to render per-result SDK icons (`Search.tsx` `SDKsIcon`); retrieval is independent of faceting.
40+
- **`forwardToReplicas`:** settings deliberately don't forward (they bundle `ranking`/`customRanking`, which a standard replica may override for an alternate sort); synonyms do (always identical across replicas). No replicas today; if any are added, declare them in the script rather than blanket-forwarding.
41+
- **Ranking:** `attribute`/`exact` sit above `proximity` (vs Algolia's default) so a title/heading match beats a body-content match — this rides on the `searchableAttributes` order (`hierarchy.lvl0…6`, then `content`, then `keywords`). `filters` is kept **above** `attribute`/`exact` on purpose: it carries the client's active-SDK `optionalFilters` boost, and keeping it primary is what prevents cross-SDK bleed. Don't demote it — tested, moving `filters` below `exact` serves iOS/Android docs to a Next.js user searching `UserButton` (an exact-title match on the wrong SDK outranks the active SDK's page).
42+
- **Synonyms** are hybrid: acronyms auto-derived from the `docs/_tooltips/*` glossary + a curated phrasing list, both built in the indexer.
43+
- **Test locally:** `ALGOLIA_INDEX_NAME=<your index> DEBUG_SEARCH_BRANCH=main pnpm search:update` into a personal index, then point `clerk/clerk`'s `NEXT_PUBLIC_ALGOLIA_INDEX_NAME`/`NEXT_PUBLIC_ALGOLIA_SEARCH_KEY` at it (a custom index needs a key with access to it). Preview deploys query `dev_docs`.
44+
45+
## Map
46+
47+
- `docs/` — MDX content; each file is a route under clerk.com/docs.
48+
- `docs/_partials/` — reusable MDX included via `<Include />`.
49+
- `docs/manifest.json` — sidenav structure. `docs/manifest.schema.json` validates that file's structure in editors (not frontmatter).
50+
- `scripts/lib/schemas.ts` — runtime Zod enums: `VALID_SDKS`/`sdk`, `icon`, and `tag` (`(Beta)`, `(Community)`).
51+
- `scripts/lib/plugins/extractFrontmatter.ts` + `scripts/lib/error-messages.ts` — frontmatter presence and warning-vs-failure severity.
52+
- `scripts/update-algolia-records.ts` — builds and pushes the Algolia search records (run after `build`); also the source of truth for the index's relevance settings + synonyms (codified, overwritten each run). See **Search index (Algolia)**.
53+
- `contributing/CONTRIBUTING.md`, `styleguides/STYLEGUIDE.md` — authoring and style source of truth.
54+
55+
## Conventions (see CONTRIBUTING.md for depth)
56+
57+
- A doc missing from `manifest.json` only warns, but still add the entry so the page is reachable in the sidenav.
58+
- Stale-PR hazard: rebase long-lived PRs on `main` (or merge it in) and rebuild before merging — another PR can invalidate frontmatter or links that were valid when yours opened.
59+
- SDK code examples must match the canonical partials `docs/_partials/create-user.mdx` and `docs/_partials/delete-user.mdx` per SDK (import path, auth accessor, `clerkClient` usage). The build never executes code blocks, so copy the pattern from there, not from memory.
60+
- Reference content is mixed: `<Typedoc />` pages pull auto-generated content from `clerk-typedoc/`, while other type pages (e.g. `docs/reference/types/agent-task.mdx`) are hand-authored. Know which kind a page is before editing.
61+
62+
## References
63+
64+
- Authoring, validation, and new-feature/reference checklists: `contributing/CONTRIBUTING.md`
65+
- Writing style: `styleguides/STYLEGUIDE.md`

CLAUDE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# CLAUDE.md
2+
3+
@AGENTS.md

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
<a href="https://clerk.com/discord">
1919
<img alt="Discord" src="https://img.shields.io/discord/856971667393609759?color=7389D8&label&logo=discord&logoColor=ffffff" />
2020
</a>
21-
<a href="https://twitter.com/clerkdev">
22-
<img alt="Twitter" src="https://img.shields.io/twitter/url.svg?label=%40clerkdev&style=social&url=https%3A%2F%2Ftwitter.com%2Fclerkdev" />
21+
<a href="https://x.com/clerk">
22+
<img alt="Follow on X" src="https://img.shields.io/twitter/url.svg?label=%40clerk&style=social&url=https%3A%2F%2Fx.com%2Fclerk" />
2323
</a>
2424
<br />
2525
<br />
@@ -32,7 +32,7 @@ Clerk is more than authentication, and we want to convey every feature of Clerk
3232

3333
We encourage you to contribute to Clerk's documentation! You can get started by following [this guide](./contributing/CONTRIBUTING.md).
3434

35-
> This repository contains the open-source documentation _content_ for [Clerk docs](https://clerk.com/docs). The _source code_ for the docs site is not yet open source, so if you have any questions or suggestions about _non-content_ related matters, please [reach out](https://clerk.com/support).
35+
> This repository contains the open-source documentation _content_ for [Clerk docs](https://clerk.com/docs). The _source code_ for the docs site is not yet open source, so if you have any questions or suggestions about _non-content_ related matters, please [reach out](https://clerk.com/contact/support).
3636
3737
## Found an issue?
3838

@@ -47,6 +47,6 @@ Feel free to create an [issue](https://github.com/clerk/clerk-docs/issues) with
4747

4848
## Connect with us
4949

50-
You can discuss ideas, ask questions, and meet others from the community in our [Discord](https://clerk.com/discord).
50+
You can discuss ideas and meet others from the community in [Discord](https://clerk.com/discord).
5151

52-
If you prefer, you can also find support through our [Twitter](https://twitter.com/ClerkDev), or you can [email](mailto:support@clerk.dev) us!
52+
You can also follow [@clerk on X](https://x.com/clerk) for updates, or [email the support team](mailto:support@clerk.com) directly.

clerk-typedoc/backend/agent-task.mdx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ for users without requiring full authentication flows.
55

66
## Properties
77

8-
| Property | Type | Description |
9-
| ------------------------------ | -------- | ---------------------------------------------------------------------------- |
10-
| <a id="agentid"></a> `agentId` | `string` | A stable identifier for the agent, unique per agent_name within an instance. |
11-
| <a id="taskid"></a> `taskId` | `string` | A unique identifier for this agent task. |
12-
| <a id="url"></a> `url` | `string` | The FAPI URL that, when visited, creates a session for the user. |
8+
| Property | Type | Description |
9+
| -------------------------------------- | -------- | --------------------------------------------------------------------------------- |
10+
| <a id="agentid"></a> `agentId` | `string` | A stable identifier for the agent, unique per agent_name within an instance. |
11+
| <a id="agenttaskid"></a> `agentTaskId` | `string` | A unique identifier for this agent task. |
12+
| <a id="taskid"></a> ~~`taskId`~~ | `string` | A unique identifier for this agent task. **Deprecated.** Use agentTaskId instead. |
13+
| <a id="url"></a> `url` | `string` | The FAPI URL that, when visited, creates a session for the user. |

clerk-typedoc/backend/allowlist-identifier.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The Backend `AllowlistIdentifier` object represents an identifier that has been added to the allowlist of your application. The Backend `AllowlistIdentifier` object is used in the [Backend API](/docs/reference/backend-api/tag/Allow-list-Block-list#operation/ListAllowlistIdentifiers) and is not directly accessible from the Frontend API.
1+
The Backend `AllowlistIdentifier` object represents an identifier that has been added to the allowlist of your application. The Backend `AllowlistIdentifier` object is used in the [Backend API](/docs/reference/backend-api/model/AllowlistIdentifier) and is not directly accessible from the Frontend API.
22

33
## Properties
44

clerk-typedoc/backend/api-key.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The Backend `APIKey` object holds information about an API key.
77
| <a id="claims"></a> `claims` | <code>null \| Record\<string, any\></code> | Custom claims associated with the API key. |
88
| <a id="createdat"></a> `createdAt` | `number` | The date when the API key was created. |
99
| <a id="createdby"></a> `createdBy` | <code>null \| string</code> | The user ID for the user creating the API key. |
10-
| <a id="description"></a> `description` | <code>null \| string</code> | An optional description for the API key. |
10+
| <a id="description"></a> `description` | <code>null \| string</code> | A description for the API key. |
1111
| <a id="expiration"></a> `expiration` | <code>null \| number</code> | The expiration date and time of the API key. `null` if the API key never expires. |
1212
| <a id="expired"></a> `expired` | `boolean` | A boolean indicating whether the API key has expired. |
1313
| <a id="id"></a> `id` | `string` | A unique ID for the API key. |
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
## Properties
22

3-
| Property | Type | Description |
4-
| ---------------------------------- | -------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
5-
| <a id="debug"></a> `debug` | <code>() => \{ [key: string]: any; \}</code> | Used to help debug issues when using Clerk in development. |
6-
| <a id="gettoken"></a> `getToken` | <code>() => Promise\<null\> \| () => Promise\<string\> \| ServerGetToken \| () => Promise\<null\></code> | A function that gets the current user's [session token](/docs/guides/sessions/session-tokens) or a [custom JWT template](/docs/guides/sessions/jwt-templates). |
7-
| <a id="has"></a> `has` | <code>CheckAuthorizationFromSessionClaims \| () => false</code> | A function that checks if the user has an Organization Role or Custom Permission. |
8-
| <a id="tokentype"></a> `tokenType` | <code>null \| "api_key" \| "oauth_token" \| "session_token" \| "m2m_token"</code> | The allowed token type. |
3+
| Property | Type | Description |
4+
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
5+
| <a id="debug"></a> `debug` | <code>() => \{ [key: string]: any; \}</code> | Used to help debug issues when using Clerk in development. |
6+
| <a id="gettoken"></a> `getToken` | <code>() => Promise\<null\> \| () => Promise\<string\> \| [ServerGetToken](../shared/server-get-token.mdx) \| () => Promise\<null\></code> | A function that gets the current user's [session token](/docs/guides/sessions/session-tokens) or a [custom JWT template](/docs/guides/sessions/jwt-templates). |
7+
| <a id="has"></a> `has` | <code>[CheckAuthorizationFromSessionClaims](../shared/check-authorization-from-session-claims.mdx) \| () => false</code> | A function that checks if the user has an Organization Role or Custom Permission. |
8+
| <a id="tokentype"></a> `tokenType` | <code>null \| "api_key" \| "oauth_token" \| "session_token" \| "m2m_token"</code> | The allowed token type. |

0 commit comments

Comments
 (0)