Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

refactor(docs): migrate home page to app router (#27221)

Charisac192a502448
diff --git a/apps/docs/app/layout.tsx b/apps/docs/app/layout.tsx
new file mode 100644
index 00000000000..37c3b7203db
--- /dev/null
+++ b/apps/docs/app/layout.tsx
@@ -0,0 +1,55 @@
+import '@code-hike/mdx/styles'
+import 'config/code-hike.scss'
+import '../styles/main.scss'
+import '../styles/new-docs.scss'
+import '../styles/prism-okaidia.scss'
+
+import { genFaviconData } from 'common/MetaFavicons/app-router'
+import { type Metadata, type Viewport } from 'next'
+
+import { BASE_PATH } from '~/lib/constants'
+import { GlobalProviders } from '~/features/app.providers'
+
+const metadata: Metadata = {
+ applicationName: 'Supabase Docs',
+ title: 'Supabase Docs',
+ description:
+ 'Supabase is an open source Firebase alternative providing all the backend features you need to build a product.',
+ metadataBase: new URL('https://supabase.com'),
+ icons: genFaviconData(BASE_PATH),
+ robots: {
+ index: true,
+ follow: true,
+ },
+ openGraph: {
+ type: 'article',
+ authors: 'Supabase',
+ url: `${BASE_PATH}`,
+ images: `${BASE_PATH}/img/supabase-og-image.png`,
+ publishedTime: new Date().toISOString(),
+ modifiedTime: new Date().toISOString(),
+ },
+ twitter: {
+ card: 'summary_large_image',
+ site: '@supabase',
+ creator: '@supabase',
+ images: `${BASE_PATH}/img/supabase-og-image.png`,
+ },
+}
+
+const viewport: Viewport = {
+ themeColor: '#1E1E1E',
+}
+
+const RootLayout = ({ children }: { children: React.ReactNode }) => {
+ return (
+ <html lang="en">
+ <body>
+ <GlobalProviders>{children}</GlobalProviders>
+ </body>
+ </html>
+ )
+}
+
+export { metadata, viewport }
+export default RootLayout
diff --git a/apps/docs/app/page.tsx b/apps/docs/app/page.tsx
new file mode 100644
index 00000000000..cbfde7d0394
--- /dev/null
+++ b/apps/docs/app/page.tsx
@@ -0,0 +1,342 @@
+import { type Metadata, type ResolvingMetadata } from 'next'
+import Link from 'next/link'
+import { IconBackground, TextLink } from 'ui'
+import { IconPanel } from 'ui-patterns/IconPanel'
+
+import HomeMenuIconPicker from '~/components/Navigation/NavigationMenu/HomeMenuIconPicker'
+import { GlassPanelWithIconPicker } from '~/features/ui/GlassPanelWithIconPicker'
+import { IconPanelWithIconPicker } from '~/features/ui/IconPanelWithIconPicker'
+import HomeLayout from '~/layouts/HomeLayout'
+import { BASE_PATH } from '~/lib/constants'
+
+const generateMetadata = async (_, parent: ResolvingMetadata): Promise<Metadata> => {
+ const parentAlternates = (await parent).alternates
+
+ return {
+ alternates: {
+ ...parentAlternates,
+ canonical: `${BASE_PATH}`,
+ },
+ }
+}
+
+const products = [
+ {
+ title: 'Database',
+ icon: 'database',
+ hasLightIcon: true,
+ href: '/guides/database/overview',
+ description:
+ 'Supabase provides a full Postgres database for every project with Realtime functionality, database backups, extensions, and more.',
+ },
+ {
+ title: 'Auth',
+ icon: 'auth',
+ hasLightIcon: true,
+ href: '/guides/auth',
+ description:
+ 'Add and manage email and password, passwordless, OAuth, and mobile logins to your project through a suite of identity providers and APIs.',
+ },
+ {
+ title: 'Storage',
+ icon: 'storage',
+ hasLightIcon: true,
+ href: '/guides/storage',
+ description:
+ 'Store, organize, transform, and serve large files—fully integrated with your Postgres database with Row Level Security access policies.',
+ },
+ {
+ title: 'AI & Vectors',
+ icon: 'ai',
+ hasLightIcon: true,
+ href: '/guides/ai',
+ description: 'Use Supabase to store and search embedding vectors.',
+ },
+ {
+ title: 'Realtime',
+ icon: 'realtime',
+ hasLightIcon: true,
+ href: '/guides/realtime',
+ description:
+ 'Listen to database changes, store and sync user states across clients, broadcast data to clients subscribed to a channel, and more.',
+ },
+ {
+ title: 'Edge Functions',
+ icon: 'edge-functions',
+ hasLightIcon: true,
+ href: '/guides/functions',
+ description:
+ 'Globally distributed, server-side functions to execute your code closest to your users for the lowest latency.',
+ },
+]
+
+const migrationGuides = [
+ {
+ title: 'Firebase Auth',
+ icon: '/docs/img/icons/firebase-icon',
+ href: '/guides/resources/migrating-to-supabase/firebase-auth',
+ },
+ {
+ title: 'Firestore Data',
+ icon: '/docs/img/icons/firebase-icon',
+ href: '/guides/resources/migrating-to-supabase/firestore-data',
+ },
+ {
+ title: 'Firebase Storage',
+ icon: '/docs/img/icons/firebase-icon',
+ href: '/guides/resources/migrating-to-supabase/firebase-storage',
+ },
+ {
+ title: 'Heroku',
+ icon: '/docs/img/icons/heroku-icon',
+ href: '/guides/resources/migrating-to-supabase/heroku',
+ },
+ {
+ title: 'Render',
+ icon: '/docs/img/icons/render-icon',
+ href: '/guides/resources/migrating-to-supabase/render',
+ },
+ {
+ title: 'Amazon RDS',
+ icon: '/docs/img/icons/aws-rds-icon',
+ href: '/guides/resources/migrating-to-supabase/amazon-rds',
+ },
+ {
+ title: 'Postgres',
+ icon: '/docs/img/icons/postgres-icon',
+ href: '/guides/resources/migrating-to-supabase/postgres',
+ },
+ {
+ title: 'MySQL',
+ icon: '/docs/img/icons/mysql-icon',
+ href: '/guides/resources/migrating-to-supabase/mysql',
+ },
+ {
+ title: 'MSSQL',
+ icon: '/docs/img/icons/mssql-icon',
+ href: '/guides/resources/migrating-to-supabase/mssql',
+ },
+]
+
+const selfHostingOptions = [
+ {
+ title: 'Auth',
+ icon: 'auth',
+ href: 'reference/self-hosting-auth/introduction',
+ },
+ {
+ title: 'Realtime',
+ icon: 'realtime',
+ href: 'reference/self-hosting-realtime/introduction',
+ },
+ {
+ title: 'Storage',
+ icon: 'storage',
+ href: 'reference/self-hosting-storage/introduction',
+ },
+ {
+ title: 'Analytics',
+ icon: 'analytics',
+ href: 'reference/self-hosting-analytics/introduction',
+ },
+]
+
+const clientLibraries = [
+ {
+ title: 'Javascript',
+ icon: 'reference-javascript',
+ href: 'reference/javascript/introduction',
+ },
+ {
+ title: 'Flutter',
+ icon: 'reference-dart',
+ href: 'reference/dart/introduction',
+ },
+ {
+ title: 'Python',
+ icon: 'reference-python',
+ href: 'reference/python/introduction',
+ },
+ {
+ title: 'C#',
+ icon: 'reference-csharp',
+ href: 'reference/csharp/introduction',
+ },
+ {
+ title: 'Swift',
+ icon: 'reference-swift',
+ href: 'reference/swift/introduction',
+ },
+ {
+ title: 'Kotlin',
+ icon: 'reference-kotlin',
+ href: 'reference/kotlin/introduction',
+ },
+]
+
+const additionalResources = [
+ {
+ title: 'Management API',
+ description: 'Manage your Supabase projects and organizations.',
+ icon: 'reference-api',
+ href: 'reference/api/introduction',
+ },
+ {
+ title: 'Supabase CLI',
+ description: 'Use the CLI to develop, manage and deploy your projects.',
+ icon: 'reference-cli',
+ href: 'reference/cli/introduction',
+ },
+ {
+ title: 'Platform Guides',
+ description: 'Learn more about the tools and services powering Supabase.',
+ icon: 'platform',
+ href: 'guides/platform',
+ },
+ {
+ title: 'Integrations',
+ description: 'Explore a variety of integrations from Supabase partners.',
+ icon: 'integrations',
+ href: 'guides/integrations',
+ },
+]
+
+const HomePage = () => (
+ <HomeLayout>
+ <div className="flex flex-col">
+ <h2 id="products">Products</h2>
+ <ul className="grid grid-cols-12 gap-6 not-prose [&_svg]:text-brand-600">
+ {products.map((product) => {
+ return (
+ <li key={product.title} className="col-span-12 md:col-span-4">
+ <Link href={product.href} passHref>
+ <GlassPanelWithIconPicker {...product}>
+ {product.description}
+ </GlassPanelWithIconPicker>
+ </Link>
+ </li>
+ )
+ })}
+ </ul>
+
+ <div className="flex flex-col lg:grid grid-cols-12 gap-6 py-12 border-b">
+ <div className="col-span-4 flex flex-col gap-1 [&_h2]:m-0 [&_h3]:m-0">
+ <div className="md:max-w-xs 2xl:max-w-none">
+ <div className="flex items-center gap-3 mb-3 text-brand-600">
+ <h2 id="client-libraries" className="group scroll-mt-24">
+ Client Libraries
+ </h2>
+ </div>
+ </div>
+ </div>
+
+ <div className="grid col-span-8 grid-cols-12 gap-6 not-prose">
+ {clientLibraries.map((library) => {
+ return (
+ <Link
+ href={library.href}
+ key={library.title}
+ passHref
+ className="col-span-6 md:col-span-4"
+ >
+ <IconPanelWithIconPicker {...library} />
+ </Link>
+ )
+ })}
+ </div>
+ </div>
+
+ <div className="flex flex-col lg:grid grid-cols-12 gap-6 py-12 border-b">
+ <div className="col-span-4 flex flex-col gap-1 [&_h2]:m-0">
+ <h2 id="migrate-to-supabase" className="group scroll-mt-24">
+ Migrate to Supabase
+ </h2>
+ <p className="text-foreground-light text-sm p-0 m-0">
+ Bring your existing data, auth and storage to Supabase following our migration guides.
+ </p>
+ <TextLink
+ label="Explore more resources"
+ url="/guides/resources"
+ className="no-underline text-brand text-sm"
+ />
+ </div>
+
+ <ul className="grid col-span-8 grid-cols-12 gap-6 not-prose">
+ {migrationGuides.map((guide) => {
+ return (
+ <li key={guide.title} className="col-span-6 md:col-span-4">
+ <Link href={guide.href} passHref>
+ <IconPanel {...guide} background={true} showLink={false} />
+ </Link>
+ </li>
+ )
+ })}
+ </ul>
+ </div>
+
+ <div className="flex flex-col gap-6 py-12 border-b">
+ <div className="col-span-4 flex flex-col gap-1 [&_h2]:m-0 [&_h3]:m-0">
+ <h3 id="additional-resources" className="group scroll-mt-24">
+ Additional resources
+ </h3>
+ </div>
+
+ <ul className="grid grid-cols-12 gap-6 not-prose">
+ {additionalResources.map((resource) => {
+ return (
+ <li key={resource.title} className="col-span-12 md:col-span-6 lg:col-span-3">
+ <Link
+ href={resource.href}
+ className="col-span-12 md:col-span-6 lg:col-span-3"
+ passHref
+ >
+ <GlassPanelWithIconPicker {...resource} background={false}>
+ {resource.description}
+ </GlassPanelWithIconPicker>
+ </Link>
+ </li>
+ )
+ })}
+ </ul>
+ </div>
+
+ <div className="flex flex-col lg:grid grid-cols-12 gap-6 py-12">
+ <div className="col-span-4 flex flex-col gap-1 [&_h2]:m-0 [&_h3]:m-0">
+ <div className="md:max-w-xs 2xl:max-w-none">
+ <div className="flex items-center gap-3 mb-3 text-brand-600">
+ <IconBackground>
+ <HomeMenuIconPicker icon="self-hosting" width={18} height={18} />
+ </IconBackground>
+ <h3 id="self-hosting" className="group scroll-mt-24">
+ Self-Hosting
+ </h3>
+ </div>
+ <p className="text-foreground-light text-sm">Get started with self-hosting Supabase.</p>
+ <TextLink
+ label="More on Self-Hosting"
+ url="/guides/self-hosting"
+ className="no-underline text-brand text-sm"
+ />
+ </div>
+ </div>
+
+ <div className="grid col-span-8 grid-cols-12 gap-6 not-prose">
+ <ul className="col-span-full lg:col-span-8 grid grid-cols-12 gap-6">
+ {selfHostingOptions.map((option) => {
+ return (
+ <li key={option.title} className="col-span-6">
+ <Link href={option.href} passHref>
+ <IconPanelWithIconPicker {...option} background={true} showLink={false} />
+ </Link>
+ </li>
+ )
+ })}
+ </ul>
+ </div>
+ </div>
+ </div>
+ </HomeLayout>
+)
+
+export default HomePage
+export { generateMetadata }
diff --git a/apps/docs/components/DocsCoverLogo.tsx b/apps/docs/components/DocsCoverLogo.tsx
index 0e8965c50b6..8a66b35ea13 100644
--- a/apps/docs/components/DocsCoverLogo.tsx
+++ b/apps/docs/components/DocsCoverLogo.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import React, { type PropsWithChildren } from 'react'
import { LazyMotion, domAnimation, m } from 'framer-motion'
diff --git a/apps/docs/components/HomePageCover.tsx b/apps/docs/components/HomePageCover.tsx
index d9ee30ad170..f111d0d5480 100644
--- a/apps/docs/components/HomePageCover.tsx
+++ b/apps/docs/components/HomePageCover.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import Link from 'next/link'
import { IconBackground, IconPlay } from 'ui'
import { useBreakpoint } from 'common'
@@ -105,7 +107,7 @@ const HomePageCover = (props) => {
<div className="flex flex-col sm:flex-row gap-4 sm:gap-8 items-start sm:items-center w-full max-w-xl xl:max-w-[33rem]">
<DocsCoverLogo aria-hidden="true" />
<div className="flex flex-col">
- <h1 className="m-0 mb-3 text-2xl sm:text-3xl text-foreground">{props.meta?.title}</h1>
+ <h1 className="m-0 mb-3 text-2xl sm:text-3xl text-foreground">{props.title}</h1>
<p className="m-0 text-foreground-light">
Learn how to get up and running with Supabase through tutorials, APIs and platform
resources.
diff --git a/apps/docs/components/Navigation/NavigationMenu/HomeMenuIconPicker.tsx b/apps/docs/components/Navigation/NavigationMenu/HomeMenuIconPicker.tsx
index b4f2e7ae2a2..138e0d30f36 100644
--- a/apps/docs/components/Navigation/NavigationMenu/HomeMenuIconPicker.tsx
+++ b/apps/docs/components/Navigation/NavigationMenu/HomeMenuIconPicker.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import React from 'react'
import {
IconMenuApi,
diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.utils.ts b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.utils.ts
index 6d7ce92302d..04dc1545765 100644
--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.utils.ts
+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.utils.ts
@@ -1,3 +1,5 @@
+'use client'
+
import { useEffect, useState } from 'react'
import { ICommonItem } from '~/components/reference/Reference.types'
import { Json } from '~/types'
diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuCliList.tsx b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuCliList.tsx
index 7cba84fcba4..b5f44986898 100644
--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuCliList.tsx
+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuCliList.tsx
@@ -1,13 +1,11 @@
import Link from 'next/link'
-import { useRouter } from 'next/router'
import { IconChevronLeft } from 'ui'
-import * as NavItems from './NavigationMenu.constants'
+import { BASE_PATH } from '~/lib/constants'
import clientLibsCommon from '~/spec/common-cli.yml' assert { type: 'yml' }
+import * as NavItems from './NavigationMenu.constants'
const NavigationMenuCliList = ({ currentLevel, setLevel, id }) => {
- const router = useRouter()
-
const menu = NavItems[id]
const FunctionLink = ({
@@ -26,7 +24,7 @@ const NavigationMenuCliList = ({ currentLevel, setLevel, id }) => {
href={`#${id}`}
className="cursor-pointer transition text-foreground-lighter text-sm hover:text-brand flex gap-3"
>
- {icon && <img className="w-3" src={`${router.basePath}${icon}`} />}
+ {icon && <img className="w-3" src={`${BASE_PATH}${icon}`} />}
{title}
</Link>
</li>
@@ -113,7 +111,7 @@ const NavigationMenuCliList = ({ currentLevel, setLevel, id }) => {
</Link>
<div className="flex items-center gap-3 my-3">
<img
- src={`${router.basePath}` + menu.icon ?? `/img/icons/menu/${id}.svg`}
+ src={`${BASE_PATH}` + menu.icon ?? `/img/icons/menu/${id}.svg`}
className="w-5 rounded"
/>
diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideList.tsx b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideList.tsx
index 97e96e4f842..3d9b5d6872d 100644
--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideList.tsx
+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideList.tsx
@@ -1,14 +1,15 @@
+'use client'
+
import * as Accordion from '@radix-ui/react-accordion'
-import { useRouter } from 'next/router'
import * as NavItems from './NavigationMenu.constants'
import { getPathWithoutHash } from './NavigationMenu.utils'
import NavigationMenuGuideListItems from './NavigationMenuGuideListItems'
+import { usePathname } from 'next/navigation'
const NavigationMenuGuideList = ({ id }: { id: string }) => {
- const path = useRouter().asPath
- const url = getPathWithoutHash(path)
- const firstLevelRoute = url?.split('/')?.slice(0, 4)?.join('/')
+ const pathname = usePathname()
+ const firstLevelRoute = pathname?.split('/')?.slice(0, 4)?.join('/')
const menu = NavItems[id]
diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideListItems.tsx b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideListItems.tsx
index 0a2a7d6f9fc..595bb88558f 100644
--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideListItems.tsx
+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuGuideListItems.tsx
@@ -1,9 +1,9 @@
import * as Accordion from '@radix-ui/react-accordion'
import { ChevronLeft } from 'lucide-react'
+import { usePathname } from 'next/navigation'
import { useTheme } from 'next-themes'
import Image from 'next/legacy/image'
import Link from 'next/link'
-import { useRouter } from 'next/router'
import React, { useEffect, useRef } from 'react'
import HomeMenuIconPicker from './HomeMenuIconPicker'
@@ -14,14 +14,14 @@ const HeaderLink = React.memo(function HeaderLink(props: {
id: string
url: string
}) {
- const router = useRouter()
+ const pathname = usePathname()
return (
<span
className={[
' ',
!props.title && 'capitalize',
- props.url === router.asPath ? 'text-brand' : 'hover:text-brand text-foreground',
+ props.url === pathname ? 'text-brand' : 'hover:text-brand text-foreground',
].join(' ')}
>
{props.title ?? props.id}
@@ -30,10 +30,10 @@ const HeaderLink = React.memo(function HeaderLink(props: {
})
const ContentAccordionLink = React.memo(function ContentAccordionLink(props: any) {
- const router = useRouter()
+ const pathname = usePathname()
const { resolvedTheme } = useTheme()
- const activeItem = props.subItem.url === getPathWithoutHash(router.asPath)
- const activeItemRef = useRef(null)
+ const activeItem = props.subItem.url === pathname
+ const activeItemRef = useRef<HTMLLIElement>(null)
const LinkContainer = (props) => {
return (
@@ -77,11 +77,8 @@ const ContentAccordionLink = React.memo(function ContentAccordionLink(props: any
>
{props.subItem.icon && (
<Image
- alt={props.subItem.name + router.basePath}
- src={
- `${router.basePath}` +
- `${props.subItem.icon}${!resolvedTheme?.includes('dark') ? '-light' : ''}.svg`
- }
+ alt={props.subItem.name}
+ src={`${props.subItem.icon}${!resolvedTheme?.includes('dark') ? '-light' : ''}.svg`}
width={15}
height={15}
/>
@@ -99,7 +96,7 @@ const ContentAccordionLink = React.memo(function ContentAccordionLink(props: any
href={`${subSubItem.url}`}
className={[
'cursor-pointer transition text-sm',
- subSubItem.url === getPathWithoutHash(router.asPath)
+ subSubItem.url === pathname
? 'text-brand'
: 'hover:text-brand text-foreground-lighter',
].join(' ')}
@@ -117,7 +114,7 @@ const ContentAccordionLink = React.memo(function ContentAccordionLink(props: any
})
const ContentLink = React.memo(function ContentLink(props: any) {
- const router = useRouter()
+ const pathname = usePathname()
return (
<li className="mb-1.5">
@@ -125,13 +122,13 @@ const ContentLink = React.memo(function ContentLink(props: any) {
href={props.url}
className={[
'cursor-pointer transition text-sm',
- props.url === router.asPath
+ props.url === pathname
? 'text-brand-link'
: 'hover:text-foreground text-foreground-lighter',
].join(' ')}
>
{props.icon && (
- <Image alt={props.icon} width={12} height={12} src={`${router.basePath}${props.icon}`} />
+ <Image alt={props.icon} width={12} height={12} src={`${pathname}${props.icon}`} />
)}
{props.name}
</Link>
diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefListItems.tsx b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefListItems.tsx
index 20b6ca58861..12a50f78e19 100644
--- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefListItems.tsx
+++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenuRefListItems.tsx
@@ -1,20 +1,20 @@
-import * as Accordion from '@radix-ui/react-accordion'
-import Link from 'next/link'
-import { useRouter } from 'next/router'
-import { IconChevronLeft, IconChevronUp, cn } from 'ui'
-import * as NavItems from './NavigationMenu.constants'
+'use client'
+import * as Accordion from '@radix-ui/react-accordion'
+import { ChevronLeft, ChevronUp } from 'lucide-react'
import Image from 'next/legacy/image'
-
+import Link from 'next/link'
+import { Fragment, memo } from 'react'
+import { cn } from 'ui'
import RevVersionDropdown from '~/components/RefVersionDropdown'
-import { menuState, useMenuActiveRefId } from '~/hooks/useMenuState'
-
-import React, { Fragment } from 'react'
import { ICommonItem, ICommonSection } from '~/components/reference/Reference.types'
+import { menuState, useMenuActiveRefId } from '~/hooks/useMenuState'
+import { BASE_PATH } from '~/lib/constants'
import HomeMenuIconPicker from './HomeMenuIconPicker'
+import * as NavItems from './NavigationMenu.constants'
import { deepFilterSections } from './NavigationMenu.utils'
-const HeaderLink = React.memo(function HeaderLink(props: any) {
+const HeaderLink = memo(function HeaderLink(props: any) {
return (
<span className={['text-base text-brand-600 ', !props.title && 'capitalize'].join(' ')}>
{props.title ?? props.id}
@@ -34,7 +34,7 @@ interface FunctionLinkProps {
onClick?: () => void
}
-const FunctionLink = React.memo(function FunctionLink({
+const FunctionLink = memo(function FunctionLink({
title,
id,
icon,
@@ -44,10 +44,9 @@ const FunctionLink = React.memo(function FunctionLink({
isSubItem = false,
onClick = () => {},
}: FunctionLinkProps) {
- const router = useRouter()
const activeAccordionItem = useMenuActiveRefId()
- const url = `${router.basePath}${basePath}/${slug}`
+ const url = `${BASE_PATH}${basePath}/${slug}`
const active = activeAccordionItem === id
return (
@@ -70,7 +69,7 @@ const FunctionLink = React.memo(function FunctionLink({
active ? 'text-brand' : 'text-foreground-lighter'
)}
>
- {icon && <Image width={16} height={16} alt={icon} src={`${router.basePath}${icon}`} />}
+ {icon && <Image width={16} height={16} alt={icon} src={`${BASE_PATH}${icon}`} />}
{title}
{active && !isSubItem && (
<div
@@ -79,7 +78,7 @@ const FunctionLink = React.memo(function FunctionLink({
></div>
)}
{isParent && (
- <IconChevronUp
+ <ChevronUp
width={16}
className="data-open-parent:rotate-0 data-closed-parent:rotate-90 transition"
/>
@@ -94,7 +93,7 @@ export interface RenderLinkProps {
basePath: string
}
-const RenderLink = React.memo(function RenderLink({ section, basePath }: RenderLinkProps) {
+const RenderLink = memo(function RenderLink({ section, basePath }: RenderLinkProps) {
const activeAccordionItem = useMenuActiveRefId()
if (!('items' in section)) {
@@ -190,7 +189,7 @@ const NavigationMenuRefListItems = ({
>
<div className="relative w-2">
<div className="transition-all ease-out ml-0 group-hover:-ml-1">
- <IconChevronLeft size={10} strokeWidth={3} />
+ <ChevronLeft size={10} strokeWidth={3} />
</div>
</div>
<span>Back to Main Menu</span>
@@ -223,4 +222,4 @@ const NavigationMenuRefListItems = ({
)
}
-export default React.memo(NavigationMenuRefListItems)
+export default memo(NavigationMenuRefListItems)
diff --git a/apps/docs/features/app.providers.tsx b/apps/docs/features/app.providers.tsx
new file mode 100644
index 00000000000..dc43baf5127
--- /dev/null
+++ b/apps/docs/features/app.providers.tsx
@@ -0,0 +1,43 @@
+import { CommandMenuProvider } from '@ui-patterns/Cmdk'
+import PromoToast from '@ui-patterns/PromoToast'
+import { ThemeProvider } from 'common'
+import { PortalToast } from 'ui'
+import { type PropsWithChildren } from 'react'
+
+import SiteLayout from '~/layouts/SiteLayout'
+import { AuthContainer } from './auth/auth.client'
+import { QueryClientProvider } from './data/queryClient.client'
+import { ShortcutPreviewBuild } from './envs/staging.client'
+import { PageTelemetry } from './telemetry/telemetry.client'
+import { ScrollRestoration } from './ui/helpers.scroll.client'
+import { ThemeSandbox } from './ui/theme.client'
+
+/**
+ * Global providers that wrap the entire app
+ */
+function GlobalProviders({ children }: PropsWithChildren) {
+ return (
+ <ShortcutPreviewBuild>
+ <QueryClientProvider>
+ <AuthContainer>
+ <PageTelemetry />
+ <ScrollRestoration />
+ <ThemeProvider defaultTheme="system" enableSystem disableTransitionOnChange>
+ <CommandMenuProvider site="docs">
+ <div className="h-screen flex flex-col">
+ <SiteLayout>
+ <PortalToast />
+ <PromoToast />
+ {children}
+ </SiteLayout>
+ <ThemeSandbox />
+ </div>
+ </CommandMenuProvider>
+ </ThemeProvider>
+ </AuthContainer>
+ </QueryClientProvider>
+ </ShortcutPreviewBuild>
+ )
+}
+
+export { GlobalProviders }
diff --git a/apps/docs/features/ui/GlassPanelWithIconPicker.tsx b/apps/docs/features/ui/GlassPanelWithIconPicker.tsx
new file mode 100644
index 00000000000..dc00d27faef
--- /dev/null
+++ b/apps/docs/features/ui/GlassPanelWithIconPicker.tsx
@@ -0,0 +1,18 @@
+import { type ComponentProps, type PropsWithChildren } from 'react'
+import { GlassPanel } from 'ui-patterns/GlassPanel'
+
+import HomeMenuIconPicker from '~/components/Navigation/NavigationMenu/HomeMenuIconPicker'
+
+type GlassPanelWithIconPickerProps = PropsWithChildren<
+ Omit<ComponentProps<typeof GlassPanel>, 'icon'> & { icon: string }
+>
+
+function GlassPanelWithIconPicker({ children, icon, ...props }: GlassPanelWithIconPickerProps) {
+ return (
+ <GlassPanel icon={<HomeMenuIconPicker icon={icon} width={18} height={18} />} {...props}>
+ {children}
+ </GlassPanel>
+ )
+}
+
+export { GlassPanelWithIconPicker }
diff --git a/apps/docs/features/ui/IconPanelWithIconPicker.tsx b/apps/docs/features/ui/IconPanelWithIconPicker.tsx
new file mode 100644
index 00000000000..9b7e4f30099
--- /dev/null
+++ b/apps/docs/features/ui/IconPanelWithIconPicker.tsx
@@ -0,0 +1,14 @@
+import { type ComponentProps } from 'react'
+import { IconPanel } from 'ui-patterns'
+
+import HomeMenuIconPicker from '~/components/Navigation/NavigationMenu/HomeMenuIconPicker'
+
+type IconPanelWithIconPickerProps = Omit<ComponentProps<typeof IconPanel>, 'icon'> & {
+ icon: string
+}
+
+function IconPanelWithIconPicker({ icon, ...props }: IconPanelWithIconPickerProps) {
+ return <IconPanel icon={<HomeMenuIconPicker icon={icon} width={18} height={18} />} {...props} />
+}
+
+export { IconPanelWithIconPicker }
diff --git a/apps/docs/hooks/useCopy.ts b/apps/docs/hooks/useCopy.ts
index 460df34f30a..9b052e4adee 100644
--- a/apps/docs/hooks/useCopy.ts
+++ b/apps/docs/hooks/useCopy.ts
@@ -1,3 +1,5 @@
+'use client'
+
import { useState } from 'react'
export function useCopy() {
diff --git a/apps/docs/layouts/HomeLayout.tsx b/apps/docs/layouts/HomeLayout.tsx
index 7f2ff3de39a..cf9a4efac56 100644
--- a/apps/docs/layouts/HomeLayout.tsx
+++ b/apps/docs/layouts/HomeLayout.tsx
@@ -1,73 +1,22 @@
-import { MDXProvider } from '@mdx-js/react'
-import { NextSeo } from 'next-seo'
-import Head from 'next/head'
-import { useRouter } from 'next/router'
-import { FC } from 'react'
-import components from '~/components'
+import { type PropsWithChildren } from 'react'
+
import HomePageCover from '~/components/HomePageCover'
import { MenuId } from '~/components/Navigation/NavigationMenu/NavigationMenu'
import { LayoutMainContent } from './DefaultLayout'
import { MainSkeleton } from './MainSkeleton'
-interface Props {
- meta: {
- title: string
- canonical?: string
- description?: string
- video?: string
- }
- children: any
-}
-
-const HomeLayout: FC<Props> = (props: Props) => {
- const { asPath } = useRouter()
-
+const HomeLayout = ({ children }: PropsWithChildren) => {
return (
- <>
- <Head>
- <title>{asPath === '/' ? 'Supabase Docs' : `${props.meta?.title} | Supabase Docs`}</title>
- <meta name="description" content={props.meta?.description} />
- <meta property="og:image" content={`https://supabase.com/docs/img/supabase-og-image.png`} />
- <meta
- name="twitter:image"
- content={`https://supabase.com/docs/img/supabase-og-image.png`}
- />
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
- </Head>
- <NextSeo
- canonical={props.meta?.canonical ?? `https://supabase.com/docs${asPath}`}
- openGraph={{
- url: `https://supabase.com/docs${asPath}`,
- type: 'article',
- videos: props.meta?.video && [
- {
- // youtube based video meta
- url: props.meta?.video,
- width: 640,
- height: 385,
- type: 'application/x-shockwave-flash',
- },
- ],
- article: {
- publishedTime: new Date().toISOString(),
- modifiedTime: new Date().toISOString(),
- authors: ['Supabase'],
- },
- }}
- />
- <MainSkeleton menuId={MenuId.Home}>
- <article>
- <HomePageCover meta={props.meta} />
- <LayoutMainContent>
- <div className={['relative transition-all ease-out', 'duration-150 '].join(' ')}>
- <div className="prose max-w-none">
- <MDXProvider components={components}>{props.children}</MDXProvider>
- </div>
- </div>
- </LayoutMainContent>
- </article>
- </MainSkeleton>
- </>
+ <MainSkeleton menuId={MenuId.Home}>
+ <article>
+ <HomePageCover title="Supabase Documentation" />
+ <LayoutMainContent>
+ <div className={['relative transition-all ease-out', 'duration-150 '].join(' ')}>
+ <div className="prose max-w-none">{children}</div>
+ </div>
+ </LayoutMainContent>
+ </article>
+ </MainSkeleton>
)
}
diff --git a/apps/docs/layouts/MainSkeleton.tsx b/apps/docs/layouts/MainSkeleton.tsx
index 18206d69af1..ff34e0db290 100644
--- a/apps/docs/layouts/MainSkeleton.tsx
+++ b/apps/docs/layouts/MainSkeleton.tsx
@@ -1,7 +1,9 @@
+'use client'
+
import { useTheme } from 'next-themes'
import Image from 'next/legacy/image'
import Link from 'next/link'
-import { type CSSProperties, type PropsWithChildren, memo, useEffect } from 'react'
+import { type PropsWithChildren, memo, useEffect } from 'react'
import { cn } from 'ui'
import Footer from '~/components/Navigation/Footer'
import HomeMenuIconPicker from '~/components/Navigation/NavigationMenu/HomeMenuIconPicker'
@@ -277,16 +279,19 @@ const Container = memo(function Container({
// used by layout to scroll to top
id={DOCS_CONTENT_CONTAINER_ID}
className={cn(
- // 'overflow-x-auto',
+ /**
+ * This controls scroll restoration on page navigation, so the overflow
+ * must be on the element with DOCS_CONTENT_CONTAINER_ID
+ */
+ 'overflow-auto',
'w-full transition-all ease-out',
- // 'absolute lg:relative',
mobileMenuOpen ? 'ml-[75%] sm:ml-[50%] md:ml-[33%] overflow-hidden' : 'overflow-auto',
// desktop override any margin styles
'lg:ml-0',
className
)}
>
- <div className="flex flex-col relative">{children}</div>
+ {children}
</div>
)
})
@@ -300,7 +305,7 @@ const NavContainer = memo(function NavContainer({ menuId }: { menuId: MenuId })
className={[
// 'hidden',
'absolute lg:relative',
- mobileMenuOpen ? 'w-[75%] sm:w-[50%] md:w-[33%] left-0' : 'w-0 -left-[280px]',
+ mobileMenuOpen ? 'w-[75%] sm:w-[50%] md:w-[33%] left-0 z-20' : 'w-0 -left-[280px]',
'lg:w-[420px] !lg:left-0',
// desktop override any left styles
'lg:left-0',
@@ -376,10 +381,8 @@ function MainSkeleton({ children, menuId }: PropsWithChildren<{ menuId: MenuId }
<MobileHeader menuId={menuId} />
</div>
</div>
- <div className="grow">
- {children}
- <Footer />
- </div>
+ {children}
+ <Footer />
<MobileMenuBackdrop />
</Container>
</div>
diff --git a/apps/docs/layouts/SiteLayout.tsx b/apps/docs/layouts/SiteLayout.tsx
index 5754ddff924..c784de3dd73 100644
--- a/apps/docs/layouts/SiteLayout.tsx
+++ b/apps/docs/layouts/SiteLayout.tsx
@@ -1,15 +1,7 @@
-import Head from 'next/head'
import { PropsWithChildren } from 'react'
const SiteLayout = ({ children }: PropsWithChildren<{}>) => {
- return (
- <>
- <Head>
- <title>Supabase Docs</title>
- </Head>
- <main className="grow overflow-hidden">{children}</main>
- </>
- )
+ return <main className="grow overflow-hidden">{children}</main>
}
export default SiteLayout
diff --git a/apps/docs/next-env.d.ts b/apps/docs/next-env.d.ts
index 4f11a03dc6c..fd36f9494e2 100644
--- a/apps/docs/next-env.d.ts
+++ b/apps/docs/next-env.d.ts
@@ -1,5 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
+/// <reference types="next/navigation-types/compat/navigation" />
// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
diff --git a/apps/docs/next.config.mjs b/apps/docs/next.config.mjs
index 762c631aaec..8a950d488d0 100644
--- a/apps/docs/next.config.mjs
+++ b/apps/docs/next.config.mjs
@@ -1,6 +1,7 @@
// @ts-check
import { remarkCodeHike } from '@code-hike/mdx'
import nextMdx from '@next/mdx'
+import os from 'node:os'
import rehypeSlug from 'rehype-slug'
import remarkGfm from 'remark-gfm'
@@ -71,6 +72,30 @@ const nextConfig = {
'api-types',
'icons',
],
+ /**
+ * The SQL to REST API translator relies on libpg-query, which packages a
+ * native Node.js module that wraps the Postgres query parser.
+ *
+ * The default webpack config can't load native modules, so we need a custom
+ * loader for it, which calls process.dlopen to load C++ Addons.
+ *
+ * See https://github.com/eisberg-labs/nextjs-node-loader
+ */
+ webpack: (config) => {
+ config.module.rules.push({
+ test: /\.node$/,
+ use: [
+ {
+ loader: 'nextjs-node-loader',
+ options: {
+ flags: os.constants.dlopen.RTLD_NOW,
+ outputPath: config.output.path,
+ },
+ },
+ ],
+ })
+ return config
+ },
async headers() {
return [
{
diff --git a/apps/docs/pages/_app.tsx b/apps/docs/pages/_app.tsx
index 3ab997f2673..38b19b776fe 100644
--- a/apps/docs/pages/_app.tsx
+++ b/apps/docs/pages/_app.tsx
@@ -4,47 +4,24 @@ import '../styles/main.scss'
import '../styles/new-docs.scss'
import '../styles/prism-okaidia.scss'
-import { ThemeProvider } from 'common'
import MetaFaviconsPagesRouter from 'common/MetaFavicons/pages-router'
import Head from 'next/head'
-import { PortalToast } from 'ui'
-import { PromoToast } from 'ui-patterns/PromoToast'
-import { CommandMenuProvider } from 'ui-patterns/Cmdk'
-import { AuthContainer } from '~/features/auth/auth.client'
-import { QueryClientProvider } from '~/features/data/queryClient.client'
-import { ShortcutPreviewBuild } from '~/features/envs/staging.client'
-import { PageTelemetry } from '~/features/telemetry/telemetry.client'
-import { ThemeSandbox } from '~/features/ui/theme.client'
-import { ScrollRestoration } from '~/features/ui/helpers.scroll.client'
-import SiteLayout from '~/layouts/SiteLayout'
+
import type { AppPropsWithLayout } from '~/types'
+import { GlobalProviders } from '~/features/app.providers'
function MyApp({ Component, pageProps }: AppPropsWithLayout) {
return (
- <ShortcutPreviewBuild>
+ <>
<MetaFaviconsPagesRouter applicationName="Supabase Docs" />
<Head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <title>Supabase Docs</title>
</Head>
- <QueryClientProvider>
- <AuthContainer>
- <PageTelemetry />
- <ScrollRestoration />
- <ThemeProvider defaultTheme="system" enableSystem disableTransitionOnChange>
- <CommandMenuProvider site="docs">
- <div className="h-screen flex flex-col">
- <SiteLayout>
- <PortalToast />
- <PromoToast />
- <Component {...pageProps} />
- </SiteLayout>
- <ThemeSandbox />
- </div>
- </CommandMenuProvider>
- </ThemeProvider>
- </AuthContainer>
- </QueryClientProvider>
- </ShortcutPreviewBuild>
+ <GlobalProviders>
+ <Component {...pageProps} />
+ </GlobalProviders>
+ </>
)
}
diff --git a/apps/docs/pages/index.mdx b/apps/docs/pages/index.mdx
deleted file mode 100644
index 5b912d11238..00000000000
--- a/apps/docs/pages/index.mdx
+++ /dev/null
@@ -1,363 +0,0 @@
-import HomeLayout from '~/layouts/HomeLayout'
-import Link from 'next/link'
-import { Button, IconBackground, IconChevronRight, IconPlay, TextLink } from 'ui'
-import { GlassPanel } from 'ui-patterns/GlassPanel'
-import { IconPanel } from 'ui-patterns/IconPanel'
-
-import HomeMenuIconPicker from '~/components/Navigation/NavigationMenu/HomeMenuIconPicker'
-
-export const meta = {
- title: 'Supabase Documentation',
- description:
- 'Supabase is an open source Firebase alternative providing all the backend features you need to build a product.',
- subtitle: 'Supabase Developer Documentation and API Reference',
-}
-
-<div className="flex flex-col">
- <div>
- <div className="max-w-xl">
- ## Products
- </div>
-
- <ul className="grid grid-cols-12 gap-6 not-prose [&_svg]:text-brand-600">
- {products.map((product) => {
- return (
- <li key={product.title} className={product.span ?? 'col-span-12 md:col-span-4'}>
- <Link href={product.href} passHref>
- <GlassPanel {...product} icon={<HomeMenuIconPicker icon={product.icon} width={18} height={18} />} background={true} showIconBg={true} showLink={false}>
- {product.description}
- </GlassPanel>
- </Link>
- </li>
- )
- })}
- </ul>
-
- <div className="flex flex-col lg:grid grid-cols-12 gap-6 py-12 border-b">
-
- <div className="col-span-4 flex flex-col gap-1 [&_h2]:m-0 [&_h3]:m-0">
-
- <div className="md:max-w-xs 2xl:max-w-none">
- <div className="flex items-center gap-3 mb-3 text-brand-600">
- {/* <IconBackground>
- <HomeMenuIconPicker icon="reference-cli" width={18} height={18} />
- </IconBackground> */}
- ## Client Libraries
- </div>
- </div>
-
- </div>
-
- <div className="grid col-span-8 grid-cols-12 gap-6 not-prose">
- {clientLibraries.map((product) => {
- return (
- <Link href={product.href} key={product.title} passHref className={product.span ?? 'col-span-6 md:col-span-4'}>
- <IconPanel
- {...product}
- icon={<HomeMenuIconPicker icon={product.icon} width={18} height={18} />}
- background={true}
- showIconBg={true}
- showLink={false}
- >
- {product.description}
- </IconPanel>
- </Link>
- )
- })}
- </div>
-
- </div>
-
- <div className="flex flex-col lg:grid grid-cols-12 gap-6 py-12 border-b">
-
- <div className="col-span-4 flex flex-col gap-1 [&_h2]:m-0">
-
- ## Migrate to Supabase
-
- <p className="text-foreground-light text-sm p-0 m-0">Bring your existing data, auth and storage to Supabase following our migration guides.</p>
-
- <TextLink
- label="Explore more resources"
- url="/guides/resources"
- className="no-underline text-brand text-sm"
- />
- </div>
-
- <ul className="grid col-span-8 grid-cols-12 gap-6 not-prose">
- {migrationGuides.map((product) => {
- return (
- <li className={product.span ?? 'col-span-6 md:col-span-4'} key={product.title}>
- <Link
- href={product.href}
- passHref
- >
- <IconPanel {...product} background={true} showIconBg={true} showLink={false}>
- {product.description}
- </IconPanel>
- </Link>
- </li>
- )
- })}
- </ul>
-
- </div>
-
- </div>
-
- <div className="flex flex-col gap-6 py-12 border-b">
-
- <div className="col-span-4 flex flex-col gap-1 [&_h2]:m-0 [&_h3]:m-0">
-
- ### Additional resources
-
- </div>
-
- <ul className="grid grid-cols-12 gap-6 not-prose">
- {additionalResources.map((product) => {
- return (
- <li className={product.span ?? 'col-span-12 md:col-span-6 lg:col-span-3'} key={product.title}>
- <Link
- href={product.href}
- className={product.span ?? 'col-span-12 md:col-span-6 lg:col-span-3'}
- passHref
- >
- <GlassPanel {...product} icon={<HomeMenuIconPicker icon={product.icon} width={18} height={18} />} background={false}>
- {product.description}
- </GlassPanel>
-
- </Link>
- </li>
- )
- })}
- </ul>
-
- </div>
-
- <div className="flex flex-col lg:grid grid-cols-12 gap-6 py-12">
-
- <div className="col-span-4 flex flex-col gap-1 [&_h2]:m-0 [&_h3]:m-0">
-
- <div className="md:max-w-xs 2xl:max-w-none">
- <div className="flex items-center gap-3 mb-3 text-brand-600">
- <IconBackground>
- <HomeMenuIconPicker icon="self-hosting" width={18} height={18} />
- </IconBackground>
- ### Self-Hosting
- </div>
- <p className="text-foreground-light text-sm">Get started with self-hosting Supabase.</p>
- <TextLink
- label="More on Self-Hosting"
- url="/guides/self-hosting"
- className="no-underline text-brand text-sm"
- />
- </div>
-
- </div>
-
- <div className="grid col-span-8 grid-cols-12 gap-6 not-prose">
- <ul className="col-span-full lg:col-span-8 grid grid-cols-12 gap-6">
- {selfHostingOptions.map((product) => {
- return (
- <li className={product.span ?? 'col-span-6'} key={product.title}>
- <Link
- href={product.href}
- passHref
- >
- <IconPanel {...product} icon={<HomeMenuIconPicker icon={product.icon} width={18} height={18} />} background={true} showIconBg={true} showLink={false}>
- {product.description}
- </IconPanel>
- </Link>
- </li>
- )
- })}
- </ul>
- </div>
-
- </div>
-
-</div>
-
-export const products = [
- {
- title: 'Database',
- icon: 'database',
- hasLightIcon: true,
- href: '/guides/database/overview',
- description:
- 'Supabase provides a full Postgres database for every project with Realtime functionality, database backups, extensions, and more.',
- },
- {
- title: 'Auth',
- icon: 'auth',
- hasLightIcon: true,
- href: '/guides/auth',
- description:
- 'Add and manage email and password, passwordless, OAuth, and mobile logins to your project through a suite of identity providers and APIs.',
- },
- {
- title: 'Storage',
- icon: 'storage',
- hasLightIcon: true,
- href: '/guides/storage',
- description:
- 'Store, organize, transform, and serve large files—fully integrated with your Postgres database with Row Level Security access policies.',
- },
- {
- title: 'AI & Vectors',
- icon: 'ai',
- hasLightIcon: true,
- href: '/guides/ai',
- description: 'Use Supabase to store and search embedding vectors.',
- },
- {
- title: 'Realtime',
- icon: 'realtime',
- hasLightIcon: true,
- href: '/guides/realtime',
- description:
- 'Listen to database changes, store and sync user states across clients, broadcast data to clients subscribed to a channel, and more.',
- },
- {
- title: 'Edge Functions',
- icon: 'edge-functions',
- hasLightIcon: true,
- href: '/guides/functions',
- description:
- 'Globally distributed, server-side functions to execute your code closest to your users for the lowest latency.',
- },
-]
-
-export const migrationGuides = [
- {
- title: 'Firebase Auth',
- icon: '/docs/img/icons/firebase-icon',
- href: '/guides/resources/migrating-to-supabase/firebase-auth',
- },
- {
- title: 'Firestore Data',
- icon: '/docs/img/icons/firebase-icon',
- href: '/guides/resources/migrating-to-supabase/firestore-data',
- },
- {
- title: 'Firebase Storage',
- icon: '/docs/img/icons/firebase-icon',
- href: '/guides/resources/migrating-to-supabase/firebase-storage',
- },
- {
- title: 'Heroku',
- icon: '/docs/img/icons/heroku-icon',
- href: '/guides/resources/migrating-to-supabase/heroku',
- },
- {
- title: 'Render',
- icon: '/docs/img/icons/render-icon',
- href: '/guides/resources/migrating-to-supabase/render',
- },
- {
- title: 'Amazon RDS',
- icon: '/docs/img/icons/aws-rds-icon',
- href: '/guides/resources/migrating-to-supabase/amazon-rds',
- },
- {
- title: 'Postgres',
- icon: '/docs/img/icons/postgres-icon',
- href: '/guides/resources/migrating-to-supabase/postgres',
- },
- {
- title: 'MySQL',
- icon: '/docs/img/icons/mysql-icon',
- href: '/guides/resources/migrating-to-supabase/mysql',
- },
- {
- title: 'MSSQL',
- icon: '/docs/img/icons/mssql-icon',
- href: '/guides/resources/migrating-to-supabase/mssql',
- },
-]
-
-export const selfHostingOptions = [
- {
- title: 'Auth',
- icon: 'auth',
- href: 'reference/self-hosting-auth/introduction',
- },
- {
- title: 'Realtime',
- icon: 'realtime',
- href: 'reference/self-hosting-realtime/introduction',
- },
- {
- title: 'Storage',
- icon: 'storage',
- href: 'reference/self-hosting-storage/introduction',
- },
- {
- title: 'Analytics',
- icon: 'analytics',
- href: 'reference/self-hosting-analytics/introduction',
- },
-]
-
-export const clientLibraries = [
- {
- title: 'Javascript',
- icon: 'reference-javascript',
- href: 'reference/javascript/introduction',
- },
- {
- title: 'Flutter',
- icon: 'reference-dart',
- href: 'reference/dart/introduction',
- },
- {
- title: 'Python',
- icon: 'reference-python',
- href: 'reference/python/introduction',
- },
- {
- title: 'C#',
- icon: 'reference-csharp',
- href: 'reference/csharp/introduction',
- },
- {
- title: 'Swift',
- icon: 'reference-swift',
- href: 'reference/swift/introduction',
- },
- {
- title: 'Kotlin',
- icon: 'reference-kotlin',
- href: 'reference/kotlin/introduction',
- },
-]
-
-export const additionalResources = [
- {
- title: 'Management API',
- description: 'Manage your Supabase projects and organizations.',
- icon: 'reference-api',
- href: 'reference/api/introduction',
- },
- {
- title: 'Supabase CLI',
- description: 'Use the CLI to develop, manage and deploy your projects.',
- icon: 'reference-cli',
- href: 'reference/cli/introduction',
- },
- {
- title: 'Platform Guides',
- description: 'Learn more about the tools and services powering Supabase.',
- icon: 'platform',
- href: 'guides/platform',
- },
- {
- title: 'Integrations',
- description: 'Explore a variety of integrations from Supabase partners.',
- icon: 'integrations',
- href: 'guides/integrations',
- },
-]
-
-export const Page = ({ children }) => <HomeLayout meta={meta} children={children} />
-
-export default Page
diff --git a/apps/docs/tailwind.config.js b/apps/docs/tailwind.config.js
index b4b91c5d972..47217b6c131 100644
--- a/apps/docs/tailwind.config.js
+++ b/apps/docs/tailwind.config.js
@@ -2,9 +2,11 @@ const config = require('config/tailwind.config')
module.exports = config({
content: [
+ './app/**/*.{ts,tsx,mdx}',
'./components/**/*.tsx',
'./content/**/*.{ts,tsx,mdx}',
'./docs/**/*.{tsx,mdx}',
+ './features/**/*.{ts,tsx,mdx}',
'./layouts/**/*.tsx',
'./pages/**/*.{tsx,mdx}',
'./../../packages/ui/src/**/*.{tsx,ts,js}',
diff --git a/apps/docs/tsconfig.json b/apps/docs/tsconfig.json
index ae8e217aa85..0e8f0b99046 100644
--- a/apps/docs/tsconfig.json
+++ b/apps/docs/tsconfig.json
@@ -20,7 +20,13 @@
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
- "module": "esnext"
+ "module": "esnext",
+ "plugins": [
+ {
+ "name": "next"
+ }
+ ],
+ "strictNullChecks": false
},
"include": [
"next-env.d.ts",
@@ -28,6 +34,7 @@
"**/*.tsx",
"pages/guides/append-test.js",
"jest.config.mjs",
+ ".next/types/**/*.ts",
"./../../packages/ui/src/**/*.d.ts"
],
"exclude": ["node_modules"]
diff --git a/package-lock.json b/package-lock.json
index b60df10462b..e17df090917 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -14733,9 +14733,9 @@
"integrity": "sha512-HMwFiRujE5PjrgwHQ25+bsLJgowjGjm5Z8FVSf0N6PwgJrwxH0QxzHYDcKsTfV3wva0vzrpqMTJS2jXPr5BMEQ=="
},
"node_modules/@types/lodash": {
- "version": "4.14.202",
- "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.202.tgz",
- "integrity": "sha512-OvlIYQK9tNneDlS0VN54LLd5uiPCBOp7gS5Z0f1mjoJYBrtStzgmJBxONW3U6OZqdtNzZPmn9BS/7WI7BFFcFQ==",
+ "version": "4.17.5",
+ "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.5.tgz",
+ "integrity": "sha512-MBIOHVZqVqgfro1euRDWX7OO0fBVUUMrN6Pwm8LQsz8cWhEpihlvR70ENj3f40j58TNxZaWv2ndSkInykNBBJw==",
"dev": true
},
"node_modules/@types/lodash.template": {
@@ -42967,6 +42967,7 @@
"@testing-library/react": "^16.0.0",
"@testing-library/user-event": "^13.5.0",
"@types/common-tags": "^1.8.4",
+ "@types/lodash": "^4.17.5",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"api-types": "*",
diff --git a/packages/common/MetaFavicons/pages-router.tsx b/packages/common/MetaFavicons/pages-router.tsx
index a2e5f157fa5..67bc040afa4 100644
--- a/packages/common/MetaFavicons/pages-router.tsx
+++ b/packages/common/MetaFavicons/pages-router.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import Head from 'next/head'
import { useRouter } from 'next/router'
diff --git a/packages/common/auth.tsx b/packages/common/auth.tsx
index 86cfffdaabc..2a8bc0d8c29 100644
--- a/packages/common/auth.tsx
+++ b/packages/common/auth.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import type { Session } from '@supabase/supabase-js'
import {
createContext,
diff --git a/packages/common/hooks/useBreakpoint.tsx b/packages/common/hooks/useBreakpoint.tsx
index ca6221326e1..8bdcb890449 100644
--- a/packages/common/hooks/useBreakpoint.tsx
+++ b/packages/common/hooks/useBreakpoint.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import { useState } from 'react'
import { useIsomorphicLayoutEffect, useWindowSize } from 'react-use'
diff --git a/packages/common/hooks/useConstant.ts b/packages/common/hooks/useConstant.ts
index 5255d3dabdb..9dd5723165d 100644
--- a/packages/common/hooks/useConstant.ts
+++ b/packages/common/hooks/useConstant.ts
@@ -1,3 +1,5 @@
+'use client'
+
// based on https://github.com/Andarist/use-constant
import { useRef } from 'react'
diff --git a/packages/common/hooks/useCopy.ts b/packages/common/hooks/useCopy.ts
index 460df34f30a..9b052e4adee 100644
--- a/packages/common/hooks/useCopy.ts
+++ b/packages/common/hooks/useCopy.ts
@@ -1,3 +1,5 @@
+'use client'
+
import { useState } from 'react'
export function useCopy() {
diff --git a/packages/common/hooks/useDebounce.tsx b/packages/common/hooks/useDebounce.tsx
index 9f70e50df7f..09203da0d1b 100644
--- a/packages/common/hooks/useDebounce.tsx
+++ b/packages/common/hooks/useDebounce.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import { useEffect, useMemo, useRef } from 'react'
import { debounce } from 'lodash'
diff --git a/packages/common/hooks/useDocsSearch.ts b/packages/common/hooks/useDocsSearch.ts
index 7d90c25a1f4..5252467cdef 100644
--- a/packages/common/hooks/useDocsSearch.ts
+++ b/packages/common/hooks/useDocsSearch.ts
@@ -1,3 +1,5 @@
+'use client'
+
import type { SupabaseClient } from '@supabase/supabase-js'
import { compact, debounce, uniqBy } from 'lodash'
import { useCallback, useMemo, useReducer, useRef } from 'react'
diff --git a/packages/common/hooks/useParams.ts b/packages/common/hooks/useParams.ts
index 879d3f4e50e..eb8043a9139 100644
--- a/packages/common/hooks/useParams.ts
+++ b/packages/common/hooks/useParams.ts
@@ -1,4 +1,15 @@
-import { useRouter } from 'next/router'
+/*
+ * next/compat/router is used so that this doesn't cause an error on App
+ * Router builds. However, no replacement for the functionality is provided if
+ * the router is missing (it just silently fails).
+ *
+ * This is fine because docs (the only site moving to App Router right now)
+ * doesn't use this hook. Skipping it silently is less troublesome than trying
+ * to make it work across both routers -- making search params work seamlessly
+ * is a giant pain, and too much critical studio functionality depends on this
+ * to mess with it lightly.
+ */
+import { useRouter } from 'next/compat/router'
import { useMemo } from 'react'
/**
@@ -22,7 +33,8 @@ function convertToCamelCase(key: string): string {
export function useParams(): {
[k: string]: string | undefined
} {
- const { query } = useRouter()
+ const router = useRouter()
+ const query = router?.query
const modifiedQuery = {
...query,
diff --git a/packages/common/hooks/useSearchParamsShallow.ts b/packages/common/hooks/useSearchParamsShallow.ts
index a5245404144..c2ccfcf454b 100644
--- a/packages/common/hooks/useSearchParamsShallow.ts
+++ b/packages/common/hooks/useSearchParamsShallow.ts
@@ -1,3 +1,5 @@
+'use client'
+
import { useCallback, useEffect, useId, useMemo, useReducer, useRef } from 'react'
/**
diff --git a/packages/common/hooks/useTelemetryProps.ts b/packages/common/hooks/useTelemetryProps.ts
index 5a0b1f9c399..e780615654c 100644
--- a/packages/common/hooks/useTelemetryProps.ts
+++ b/packages/common/hooks/useTelemetryProps.ts
@@ -1,8 +1,11 @@
-import { useRouter } from 'next/router'
+'use client'
+
+import { useRouter } from 'next/compat/router'
import { isBrowser } from '../helpers'
export function useTelemetryProps() {
- const { locale } = useRouter()
+ const router = useRouter()
+ const locale = router ? router.locale : undefined
return {
screenResolution: isBrowser ? `${window.innerWidth}x${window.innerHeight}` : undefined,
diff --git a/packages/common/hooks/useThemeSandbox.tsx b/packages/common/hooks/useThemeSandbox.tsx
index 06b49c08b6c..103cce7fd87 100644
--- a/packages/common/hooks/useThemeSandbox.tsx
+++ b/packages/common/hooks/useThemeSandbox.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import { useEffect, useState } from 'react'
import { IS_PROD } from '../constants'
diff --git a/packages/ui-patterns/AssistantChat/AssistantChatForm.tsx b/packages/ui-patterns/AssistantChat/AssistantChatForm.tsx
index 6e620a1dd2e..dedae876eb7 100644
--- a/packages/ui-patterns/AssistantChat/AssistantChatForm.tsx
+++ b/packages/ui-patterns/AssistantChat/AssistantChatForm.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import { Loader2 } from 'lucide-react'
import React, { ChangeEvent, createRef, useEffect } from 'react'
import { TextArea } from 'ui/src/components/shadcn/ui/text-area'
diff --git a/packages/ui-patterns/Cmdk/AiCommand.tsx b/packages/ui-patterns/Cmdk/AiCommand.tsx
index c98472451e6..7b4fde7e53b 100644
--- a/packages/ui-patterns/Cmdk/AiCommand.tsx
+++ b/packages/ui-patterns/Cmdk/AiCommand.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import type OpenAI from 'openai'
import {
Dispatch,
diff --git a/packages/ui-patterns/Cmdk/CommandMenu.tsx b/packages/ui-patterns/Cmdk/CommandMenu.tsx
index 0bc5193a29d..6084daa1671 100644
--- a/packages/ui-patterns/Cmdk/CommandMenu.tsx
+++ b/packages/ui-patterns/Cmdk/CommandMenu.tsx
@@ -1,5 +1,7 @@
+'use client'
+
import { useParams } from 'common'
-import { useRouter } from 'next/router'
+import { useRouter } from 'next/navigation'
import * as React from 'react'
import { AiIconAnimation } from 'ui/src/layout/ai-icon-animation/ai-icon-animation'
diff --git a/packages/ui-patterns/Cmdk/CommandMenuProvider.tsx b/packages/ui-patterns/Cmdk/CommandMenuProvider.tsx
index b15361aedae..72f921f67c7 100644
--- a/packages/ui-patterns/Cmdk/CommandMenuProvider.tsx
+++ b/packages/ui-patterns/Cmdk/CommandMenuProvider.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import dynamic from 'next/dynamic'
import {
createContext,
diff --git a/packages/ui-patterns/Cmdk/DocsSearch.tsx b/packages/ui-patterns/Cmdk/DocsSearch.tsx
index df393436b8c..32f554068e7 100644
--- a/packages/ui-patterns/Cmdk/DocsSearch.tsx
+++ b/packages/ui-patterns/Cmdk/DocsSearch.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import { useSupabaseClient } from '@supabase/auth-helpers-react'
import {
type DocsSearchResult as Page,
@@ -6,7 +8,7 @@ import {
useDocsSearch,
} from 'common'
import { Book, ChevronRight, Github, Hash, Loader2, MessageSquare, Search } from 'lucide-react'
-import { useRouter } from 'next/router'
+import { useRouter } from 'next/navigation'
import { useEffect, useRef } from 'react'
import { Button } from 'ui'
import { CommandGroup, CommandItem, CommandLabel, TextHighlighter } from './Command.utils'
diff --git a/packages/ui-patterns/Cmdk/SearchButton.tsx b/packages/ui-patterns/Cmdk/SearchButton.tsx
index d5f1bcef345..eb0a4d4db55 100644
--- a/packages/ui-patterns/Cmdk/SearchButton.tsx
+++ b/packages/ui-patterns/Cmdk/SearchButton.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import { ButtonHTMLAttributes, DetailedHTMLProps, PropsWithChildren, useRef } from 'react'
import { useCommandMenu } from './CommandMenuProvider'
diff --git a/packages/ui-patterns/ConsentToast/index.tsx b/packages/ui-patterns/ConsentToast/index.tsx
index 33506cba7ee..3a46bf60797 100644
--- a/packages/ui-patterns/ConsentToast/index.tsx
+++ b/packages/ui-patterns/ConsentToast/index.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import {
LOCAL_STORAGE_KEYS,
handlePageTelemetry,
diff --git a/packages/ui-patterns/CountdownWidget/CountdownStep.tsx b/packages/ui-patterns/CountdownWidget/CountdownStep.tsx
index 85927e3d805..7d183909585 100644
--- a/packages/ui-patterns/CountdownWidget/CountdownStep.tsx
+++ b/packages/ui-patterns/CountdownWidget/CountdownStep.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import { useEffect, useState } from 'react'
import { cn } from 'ui'
diff --git a/packages/ui-patterns/Dialogs/ConfirmDialog.tsx b/packages/ui-patterns/Dialogs/ConfirmDialog.tsx
index 11ff5a24457..80aba0f849b 100644
--- a/packages/ui-patterns/Dialogs/ConfirmDialog.tsx
+++ b/packages/ui-patterns/Dialogs/ConfirmDialog.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import { useEffect, useState } from 'react'
import { Button, Form, Modal } from 'ui'
diff --git a/packages/ui-patterns/GlassPanel/index.tsx b/packages/ui-patterns/GlassPanel/index.tsx
index e2b0fd526ad..1f91067762a 100644
--- a/packages/ui-patterns/GlassPanel/index.tsx
+++ b/packages/ui-patterns/GlassPanel/index.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import { useTheme } from 'next-themes'
import Image from 'next/image'
import * as React from 'react'
diff --git a/packages/ui-patterns/IconPanel/index.tsx b/packages/ui-patterns/IconPanel/index.tsx
index 90e01d8ba7e..5e8e71f2890 100644
--- a/packages/ui-patterns/IconPanel/index.tsx
+++ b/packages/ui-patterns/IconPanel/index.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import { useTheme } from 'next-themes'
import * as React from 'react'
import { ChevronRight } from 'react-feather'
diff --git a/packages/ui-patterns/PrivacySettings/index.tsx b/packages/ui-patterns/PrivacySettings/index.tsx
index 53f48224a93..61789b53d3c 100644
--- a/packages/ui-patterns/PrivacySettings/index.tsx
+++ b/packages/ui-patterns/PrivacySettings/index.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import { LOCAL_STORAGE_KEYS } from 'common'
import Link from 'next/link'
import { PropsWithChildren, useEffect, useState } from 'react'
diff --git a/packages/ui-patterns/SqlToRest/index.tsx b/packages/ui-patterns/SqlToRest/index.tsx
index b180065a980..5a1187c8e39 100644
--- a/packages/ui-patterns/SqlToRest/index.tsx
+++ b/packages/ui-patterns/SqlToRest/index.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import Editor, { useMonaco } from '@monaco-editor/react'
import { ChevronUp, GitPullRequest } from 'lucide-react'
import type { editor } from 'monaco-editor'
diff --git a/packages/ui-patterns/ThemeImage/index.tsx b/packages/ui-patterns/ThemeImage/index.tsx
index bce80dff03e..be2950698d0 100644
--- a/packages/ui-patterns/ThemeImage/index.tsx
+++ b/packages/ui-patterns/ThemeImage/index.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import { useTheme } from 'next-themes'
import Image from 'next/image'
import { useEffect, useState } from 'react'
diff --git a/packages/ui-patterns/ThemeToggle.tsx b/packages/ui-patterns/ThemeToggle.tsx
index 8a53c91112d..f5443a0e4c1 100644
--- a/packages/ui-patterns/ThemeToggle.tsx
+++ b/packages/ui-patterns/ThemeToggle.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import { useTheme } from 'next-themes'
import { useState } from 'react'
import {
diff --git a/packages/ui-patterns/package.json b/packages/ui-patterns/package.json
index cdce0f619bf..ee62b3c0aa1 100644
--- a/packages/ui-patterns/package.json
+++ b/packages/ui-patterns/package.json
@@ -37,6 +37,7 @@
"@testing-library/react": "^16.0.0",
"@testing-library/user-event": "^13.5.0",
"@types/common-tags": "^1.8.4",
+ "@types/lodash": "^4.17.5",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"api-types": "*",
diff --git a/packages/ui/src/components/TextLink/TextLink.tsx b/packages/ui/src/components/TextLink/TextLink.tsx
index ce946291ca9..17f7ae1cc88 100644
--- a/packages/ui/src/components/TextLink/TextLink.tsx
+++ b/packages/ui/src/components/TextLink/TextLink.tsx
@@ -1,3 +1,5 @@
+'use client'
+
import Link from 'next/link'
import { IconChevronRight, cn } from 'ui'