These are the guidelines we use to write our docs.
Try to keep things in alphabetic order, except Next.js, React, and JavaScript are prioritized as these are our core SDKs. For example, our SDK selector prioritizes Next.js, React, and Javascript, and then alphabetizes the rest of the SDK's. Another example is that whenever there is a <Tabs items={[]}>
component, the items
should follow this same rule.
When mentioning a documented component, function, etc, multiple times on a page, link to the reference documentation on the first mention of that item. The exception to this rule is when the reference is mentioned under a different heading. In that case, link to the reference documentation again.
❌ The
currentUser()
helper will return theUser
object of the currently active user. The following example uses thecurrentUser()
helper to access theUser
object for the authenticated user.
✅ The
currentUser()
helper will return theUser
object of the currently active user. The following example uses thecurrentUser()
helper to access theUser
object for the authenticated user.
❌ How to Set up Custom Pages
✅ How to set up custom pages
When writing titles that contain component references in MDX pages, wrap the component name in backticks and escape any angle brackets.
❌ title: '' title:
✅ title: '
<RedirectToOrganizationProfile />
'
"Middleware," "Server Actions," "Server Components," "Route Handlers" are capitalized in the Next.js docs and in Clerk's docs where referring to a Next.js project or code.
❌ Add it to your app's middleware.
✅ Add it to your app's Middleware.
Use "sign in" and "sign out" rather than "log in" or "log out".
❌
<SignInButton />
creates a button that allows users to log into your Clerk application.
✅
<SignInButton />
creates a button that allows users to sign into your Clerk application.
If you want to abbreviate a term in your article, write it out fully first, then put the abbreviation in parentheses. If you want to make an abbreviation plural treat them as regular words, e.g. APIs, IDEs or OSes.
❌ An AST is a tree representation of code. AST's are a fundamental part of the way a compiler works.
✅ An abstract syntax tree (AST) is a tree representation of code. ASTs are a fundamental part of the way a compiler works.
We refer to the reader with "you/your/yours." We objectively refer to Clerk as "Clerk," not "we/us/our/ours."
❌ Our
<ClerkProvider>
provides active session and user context to our hooks and other components. Let's import it into our app by addingimport { ClerkProvider } from '@clerk/nextjs'
at the top of the file.
✅ Clerk's
<ClerkProvider>
provides active session and user context to Clerk's hooks and other components. Import it into your app by addingimport { ClerkProvider } from '@clerk/nextjs'
at the top of your file.
Use conjunctions in the copy to make the copy more colloquial.
❌ "You will"
✅ "You'll"
English gerunds ("-ing" words like "running") turn verbs into nouns ("run" becomes "running"). This makes the sentence sound passive ("They run" becomes "they are running") and makes it harder to translate. Use an active voice as much as possible and avoid these words.
❌ Using a routing library with Clerk
✅ How to use a routing library with Clerk
When learners are performing an order of operations, it helps for them to start with where they need to be to perform the action.
❌ Open your
.env.local file
in your Next.js project's folder.
✅ In your Next.js project's root folder, open your
.env.local file
.
Use active verbs that put the reader in the first person instead of passive verbs; "be" verbs that describe the learners actions as a state of being, like "is/was/to be".
❌ The
middleware.ts
file should be created in the root folder of your application or insidesrc/
if that is how you set up your app.
✅ Create the
middleware.ts
file in the root folder of your application or inside thesrc/
if that is how your app is set up.
❌ User session and data
✅ Read user session and data
Bold proper nouns found in the UI, such as titles, headings, product names, etc.
An exception to this rule is "the Clerk Dashboard", which doesn't need to be bolded because it's referenced often in the docs and we want to avoid too much visual noise.
❌
In the Azure services section, select Microsoft Entra ID.
✅
In the **Azure services** section, select **Microsoft Entra ID**.
The proper names for the components are:
- Dashboard: refers to a control panel or central hub where users can interact with multiple tools or view data
- Panel: drawer
- Modal: popup
- Dropdown
Use "application" for the first instance where it's used and then "app" for the rest of the guide.
Use "redirected to" instead of "taken to."
❌
On this same page, under **Client credentials**, select **Add a certificate or secret** to generate a Client Secret. You'll be taken to the **Certificate & secrets** page.
✅
On this same page, under **Client credentials**, select **Add a certificate or secret** to generate a Client Secret. You'll be redirected to the **Certificate & secrets** page.
Use "ensure" instead of "make sure."
❌ Make sure you have the correct permissions.
✅ Ensure you have the correct permissions.
Code examples should always have an explanation preceding them. Typically, they begin with something along the lines of "The following example demonstrates..."
❌ You might have already configured
<ConvexProvider>
. Ensure that<ClerkProvider>
wrapsConvexProviderWithClerk
and thatuseAuth
is passed toConvexProviderWithClerk
.
✅ The following example demonstrates how to configure Clerk and Convex's providers. Clerk's
useAuth()
hook must be passed to<ConvexProviderWithClerk>
and Clerk's<ClerkProvider>
must be wrapped around it.
Avoid using language that assumes someone's level of proficiency. Something that is difficult for someone new to programming may not be difficult for a senior engineer. This language can inadvertently alienate or insult a learner. Avoid words like "just", "easy", "simple", "senior", "hard".
Use as little jargon as necessary. Describe jargon in parentheses on first reference or link to a trusted definition.
❌ It's easy to authenticate your app with Clerk!
✅ You can authenticate your app with Clerk in three steps.
❌ Clerk works great with PWA as it supports offline mode.
✅ Clerk supports offline mode, a feature that lets users use an app without being connected to data or wifi.
"Click" is an outdated term that assumes the learner is using a mouse. But learners may be navigating by touchscreen, keyboard, or assistive technology. Often there are better words than "click", like "select" and "open".
❌ Click the Settings tab.
Click the Google social connection.
✅ Open the Settings tab.
Select the Google social connection.
❌ Select the New client secret button.
✅ Select New client secret.
❌ Copy the environment variables to your .env file.
✅ Copy the environment variables to your
.env
file.
❌ In your browser, open http://localhost:3000/.
✅ In your browser, open
http://localhost:3000/
.
Component references should be wrapped in < />
if they are self closing. Otherwise, they should be wrapped in < >
.
❌ Use the
<SignIn/>
component.
❌ Use the "SignIn component".
❌ Use the
SignIn
component.
❌ Use the
<SignIn>
component.
The last case is incorrect because the <SignIn />
component will never wrap children, and therefore, should have a self-closing tag.
✅ Use the
<SignIn />
component.
If the code should run in a terminal, set the code block's syntax highlighting and filename with sh {{ filename: 'terminal' }}
.
❌
```
npm i @clerk/nextjs
```
✅
```sh {{ filename: 'terminal' }}
npm i @clerk/nextjs
```
Be sure to use the correct term with components vs functions.
❌ The
<SignUp />
component accepts thesignUpProps
parameter. ThebuildUrlWithAuth()
function accepts theto
property.
✅ Pass the
signUpProps
property to<SignUp />
.buildUrlWithAuth()
accepts astring
for theto
parameter.
When instructing learners to perform an operation in the Clerk Dashboard, begin with "In the Clerk Dashboard" and end with a link to the page you're directing them to using this URL syntax: https://dashboard.clerk.com/last-active?path=PAGE
❌ Go to User & Authentication in your dashboard.
✅ In the Clerk Dashboard, navigate to the User & Authentication page.
❌ Find fallback redirects in the Redirect tab on the Account Portal in the Clerk Dashboard.
✅ To specify the fallback redirects, in the Clerk Dashboard, go to the Account Portal page and open the Redirects tab.
❌ A modal will appear.
✅ A modal will open.
❌ In the top navigation bar of the Clerk Dashboard, select Users.
✅ At the top of the Clerk Dashboard, select Users.