These docs are built using [Astro][astro] and [Starlight][starlight]. All commands are run from the root of the project, from a terminal:
| Command | Action |
|---|---|
npm ci |
Installs dependencies |
npm run dev |
Starts local dev server at localhost:4321 |
npm run build |
Build your production site to ./dist/ |
npm run preview |
Preview your build locally, before deploying |
npm run astro ... |
Run CLI commands like astro add, astro check |
npm run astro -- --help |
Get help using the Astro CLI |
We use Playwright for browser testing. The tests are
located in the ./tests directory.
These instructions assume you are already running in the provided devcontainer.
Playwright will automatically detect if your local dev server is already running. If your local dev server isn't running, Playwright will build and preview the site for testing.
To open Playwright in UI mode:
npm run pw:openTo run Playwright tests in the terminal:
npm run pw:runWe use screenshot testing to ensure visual consistency. If you make intentional changes you will likely need to update the stored screenshots. To do so run:
npm run pw:run -- --update-snapshots=changedThis will update only the screenshots for tests that have changed. On rare occasions you may want to update all screenshots, which you can do with:
npm run pw:run -- --update-snapshots=all- in
lib/prefs.tsadd the key and label to theframeworksarray - in
src/components/icons/tech/$Framework.tsxadd an icon - in
src/components/FrameworkSwitcher.tsxreference the icon in theframeworkIconobject - in
src/components/FrameworkLinks.tsxadd acase "$framework"for the icon - in
src/content/docs/get-started.mdxadd toframeworksandtitleByFramework, define steps, and use those steps where appropriate - in
src/content/docs/reference/$framework.mdxwrite a reference guide - in
src/components/SdkReferenceLinkByFramework.mdxandsrc/lib/sidebar.tslink that reference - in
public/llms-full.txtunder SDKs link that reference
To add a framework option to a page such as src/content/docs/get-started.mdx:
-
Add your framework to the frontmatter
frameworks -
Add the page title to the frontmatter
titleByFramework -
Use
<SlotByFramework />or<TextByFramework />components to display content for the currently selected framework:<SlotByFramework client:load> ... <SomeContent slot="$framework" /> </SlotByFramework>
This will make
<SomeContent />only visible when the new framework is selected.
We provide a framework selection component for each page including the docs home. However the docs home is the only page that always display the links. The other pages will hide the component if a framework is already selected.
In home:
<FrameworkLinks
title="Get started"
path="/get-started"
alwaysShow
client:load
/>Internal links between docs pages must use <Link.Page> or <Link.ToSdk>
components, not plain markdown links. This enables framework-aware routing.
import { Link } from "@/components/link";
{/* Internal page link */}
See <Link.Page href="/environment">Environment variables</Link.Page>.
{/* SDK-specific link (backwards compatible with ?f= framework switcher) */}
See the <Link.ToSdk href="/get-started" sdk="next">quick start</Link.ToSdk>.- Import once per file:
import { Link } from "@/components/link"; hrefis the root-relative path without domain (e.g./environment#arcjet-env)- Link text must be on a single line — newlines inside
<Link.*>…</Link.*>break MDX rendering - External links and
[Arcjet Dashboard](https://app.arcjet.com)style links remain plain markdown
Older pages used markdown reference-style links ([text][ref-id]) with
definitions at the bottom of the file. Those have been replaced. Any remaining
plain markdown internal links (e.g. [text](/path)) should be converted to
<Link.Page> or <Link.ToSdk> when editing a file.
We maintain a 30 day cooldown period for dependency versions to mitigate supply chain risks. This cooldown period does not include Arcjet maintained packages or security updates.
npx --no -- npm-check-updates --interactive --workspaces --filter 'arcjet, @arcjet/*, nosecone, @nosecone/*' --target latest
npm up arcjet "@arcjet/*" nosecone "@nosecone/*" --workspacesnpx --no -- npm-check-updates --interactive --workspaces --cooldown 30 --target minornpx --no -- npm-check-updates --interactive --workspaces --cooldown 30 --target @latest