Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ node_modules/*
.next
.env*
tsconfig.tsbuildinfo
_pagefind/
out/
pagefind.log

# Generated
public/robots.txt
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
repos:
- repo: "https://github.com/DavidAnson/markdownlint-cli2"
rev: "v0.14.0"
Expand Down
1 change: 1 addition & 0 deletions .yamllint
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ yaml-files:
- ".yamllint"
ignore: |
pnpm-lock.yaml
pnpm-workspace.yaml
node_modules/
extends: "default"
rules:
Expand Down
4 changes: 3 additions & 1 deletion pages/_meta.ts → app/_meta.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type { MetaRecord } from "nextra";

export default {
index: {
title: "Documentation",
Expand All @@ -19,4 +21,4 @@ export default {
title: "MCP",
type: "page",
},
};
} satisfies MetaRecord;
File renamed without changes.
6 changes: 3 additions & 3 deletions pages/authzed/api/_meta.ts → app/authzed/api/_meta.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import type { MetaRecord } from "nextra";
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nextra fails cryptically when you have a _meta.ts file with the wrong shape. Adding this type assertion helps prevent that.


export default {
"grpc-api": {
title: "gRPC API Reference",
href: "https://buf.build/authzed/api/docs/main:authzed.api.v1",
newWindow: true,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nextra automatically opens external links in new tabs now.

},
"http-api": {
title: "HTTP API Reference",
},
"cloud-api": {
title: "Cloud API Reference",
href: "https://www.postman.com/authzed/spicedb/collection/5fm402n/authzed-cloud-api",
newWindow: true,
},
};
} satisfies MetaRecord;
5 changes: 5 additions & 0 deletions app/authzed/api/http-api/page.mdx
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file was just moved.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Swagger } from "@/components/swagger";

# HTTP API Documentation

<Swagger />
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import YouTube from "react-youtube";
import YouTube from "@/components/youtube-wrapper";
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We needed to wrap this component because it's an old-style class component and next doesn't like them in server components, which is what these mdx files turn into.


# Workload Isolation

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Callout } from "nextra/components";
import YouTube from "react-youtube";
import YouTube from "@/components/youtube-wrapper";

# Getting Started with AuthZed Cloud

Expand Down
8 changes: 3 additions & 5 deletions pages/authzed/links/_meta.ts → app/authzed/links/_meta.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
import type { MetaRecord } from "nextra";

export default {
schedule: {
title: "Schedule a Call",
href: "https://authzed.com/call?utm_source=docs",
newWindow: true,
},
changelog: {
title: "Changelog",
href: "https://changelog.authzed.cloud?utm_source=docs",
newWindow: true,
},
"security-policies": {
title: "Security Policies",
href: "https://security.authzed.com?utm_source=docs",
newWindow: true,
},
status: {
title: "Service Status Page",
href: "https://status.authzed.com?utm_source=docs",
newWindow: true,
},
};
} satisfies MetaRecord;
File renamed without changes.
File renamed without changes.
95 changes: 95 additions & 0 deletions app/globals.css
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was autogenerated by the tailwind v4 migration script.

Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
@import "tailwindcss";

@custom-variant dark (&:is(html[class~="dark"] *));

@theme {
--breakpoint-*: initial;
--breakpoint-sm: 640px;
--breakpoint-md: 768px;
--breakpoint-lg: 1024px;
--breakpoint-xl: 1280px;
--breakpoint-2xl: 1536px;

--text-*: initial;
--text-xs: 0.75rem;
--text-sm: 0.875rem;
--text-base: 1rem;
--text-lg: 1.125rem;
--text-xl: 1.25rem;
--text-2xl: 1.5rem;
--text-3xl: 1.875rem;
--text-4xl: 2.25rem;
--text-5xl: 3rem;
--text-6xl: 4rem;

--tracking-*: initial;
--tracking-tight: -0.015em;

--color-dark: #111;
--color-transparent: transparent;
--color-current: currentColor;
--color-black: #000;
--color-white: #fff;

--color-primary-50: #fafafa;
--color-primary-100: #f5f5f5;
--color-primary-200: #e5e5e5;
--color-primary-300: #d4d4d4;
--color-primary-400: #a3a3a3;
--color-primary-500: #737373;
--color-primary-600: #525252;
--color-primary-700: #404040;
--color-primary-800: #262626;
--color-primary-900: #171717;
--color-primary-950: #0a0a0a;
}

/*
The default border color has changed to `currentcolor` in Tailwind CSS v4,
so we've added these compatibility styles to make sure everything still
looks the same as it did with Tailwind CSS v3.

If we ever want to remove these styles, we need to add an explicit border
color utility to any element that depends on these defaults.
*/
@layer base {
*,
::after,
::before,
::backdrop,
::file-selector-button {
border-color: var(--color-gray-200, currentcolor);
}
}

body {
font-feature-settings:
"rlig" 1,
"calt" 1;
}

/* https://github.com/tjallingt/react-youtube/issues/242 */
.youtubeContainer {
position: relative;
width: 100%;
height: 0;
padding-bottom: 56.25%;
overflow: hidden;
margin-bottom: 50px;
}

.youtubeContainer iframe {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
}

.swagger-ui .information-container {
display: none;
}

.swagger-ui .scheme-container {
display: none;
}
109 changes: 109 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import { Layout, Navbar, Footer } from "nextra-theme-docs";
import Link from "next/link";
import { Head, Search, Banner } from "nextra/components";
import { getPageMap } from "nextra/page-map";
import "nextra-theme-docs/style.css";
import Logo from "@/components/icons/logo.svg";
import LogoIcon from "@/components/icons/logo-icon.svg";
import BannerContents from "@/components/banner";
import Providers from "@/components/providers";
import { TocCTA } from "@/components/cta";
import type { Metadata, ResolvingMetadata } from "next";
import { SpeedInsights } from "@vercel/speed-insights/next";
import "./globals.css";

import { default as OurLayout } from "@/components/layout";

export const generateMetadata = async (
_props: unknown,
parentPromise: ResolvingMetadata,
): Promise<Metadata> => {
Comment on lines +17 to +20
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is how we generate metadata in the <head> across all of our pages. It basically says "use this function anytime you need to generate metadata," and it composes the appropriate metadata for the page you're on. I've checked that it works on subpages.

const { description } = await parentPromise;
return {
metadataBase: new URL("https://authzed.com"),
title: {
default: "Authzed Docs",
template: "%s - Authzed Docs",
},
description: "Welcome to the SpiceDB and AuthZed docs site.",
openGraph: {
title: {
default: "Authzed Docs",
template: "%s - Authzed Docs",
},
description: description ?? undefined,
},
alternates: {
// This is how you say "the current page is the canonical one",
// using the metadataBase field.
canonical: "./",
Comment on lines +38 to +39
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, next. 🪄

},
};
};

export default async function RootLayout({ children }) {
const pageMap = await getPageMap();
const enableSearch =
process.env.NEXT_PUBLIC_ENABLE_SEARCH_BLOG_INTEGRATION === "true";

const navbar = (
<Navbar
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a bunch of components that we were reimplementing that we can now pull directly from Nextra. Navbar and Footer are examples.

logo={<Logo />}
logoLink="https://authzed.com"
chatLink="https://authzed.com/discord"
projectLink="https://github.com/authzed/spicedb"
/>
);

return (
<html lang="en" dir="ltr" suppressHydrationWarning>
<Head
color={{
hue: { dark: 45, light: 290 },
saturation: { dark: 100, light: 100 },
}}
Comment on lines +61 to +64
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where the color part of the old themeconfig went.

/>
<body>
<Layout
banner={
<Banner dismissible={false}>
<BannerContents />
</Banner>
Comment on lines +69 to +71
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where the banner part of the old themeconfig went.

}
navbar={navbar}
footer={
<Footer>
<Link href="https://authzed.com" title="AuthZed">
<LogoIcon height={20} />
</Link>{" "}
&copy; {new Date().getFullYear()} AuthZed.
</Footer>
}
darkMode
docsRepositoryBase="https://github.com/authzed/docs/tree/main"
search={enableSearch && <Search />}
sidebar={{
defaultMenuCollapseLevel: 1,
toggleButton: true,
}}
pageMap={pageMap}
feedback={{
content: (
<span>
Something unclear?
<br />
Create an issue →
</span>
),
}}
toc={{ backToTop: true, extraContent: <TocCTA /> }}
>
<OurLayout>
<SpeedInsights />
<Providers>{children}</Providers>
</OurLayout>
Comment on lines +101 to +104
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where the old app.tsx bits went.

</Layout>
</body>
</html>
);
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 5 additions & 3 deletions pages/index.mdx → app/page.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#
---
title: Authzed Docs
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This head matter is necessary to make the title metadata show up on this page - the generateMetadata function in layout.tsx works for all child routes, but not for page.mdx in the same folder.

---

Browse documentation for **SpiceDB** or **AuthZed Products** by selecting one below.

Expand All @@ -9,13 +11,13 @@ import { Cards } from "nextra/components";
image
arrow
title="View"
href="spicedb/getting-started/discovering-spicedb"
href="/spicedb/getting-started/discovering-spicedb"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These need the leading slashes for the baseUrl behavior in Next to work properly. I'm not sure how they were working before this.

>
<div className="p-4">
<h3>SpiceDB Documentation</h3>
</div>
</Cards.Card>
<Cards.Card image arrow title="View" href="authzed/guides/picking-a-product">
<Cards.Card image arrow title="View" href="/authzed/guides/picking-a-product">
<div className="p-4">
<h3>AuthZed Products Documentation</h3>
</div>
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions pages/spicedb/api/_meta.ts → app/spicedb/api/_meta.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import type { MetaRecord } from "nextra";

export default {
"grpc-api": {
title: "gRPC API Reference",
href: "https://buf.build/authzed/api/docs/main:authzed.api.v1",
newWindow: true,
},
"http-api": {
title: "HTTP API Reference",
},
postman: {
title: "Postman Collection",
href: "https://www.postman.com/authzed/workspace/spicedb/overview",
newWindow: true,
},
};
} satisfies MetaRecord;
5 changes: 5 additions & 0 deletions app/spicedb/api/http-api/page.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Swagger } from "@/components/swagger";

# HTTP API Documentation

<Swagger />
File renamed without changes.
Loading