Skip to content

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

Can now generate pages with .mdx files using a layout export

Jonathan Summers-Muir484341368db8
diff --git a/apps/www/layouts/Layout.tsx b/apps/www/layouts/Layout.tsx
new file mode 100644
index 00000000000..4b455673d77
--- /dev/null
+++ b/apps/www/layouts/Layout.tsx
@@ -0,0 +1,68 @@
+import { MDXProvider } from '@mdx-js/react'
+import { useRouter } from 'next/router'
+
+import Image from 'next/image'
+import Avatar from '~/components/Avatar'
+import CodeBlock from '~/components/CodeBlock/CodeBlock'
+import ImageGrid from '~/components/ImageGrid'
+import Quote from '~/components/Quote'
+
+// plugins for next-mdx-remote
+import DefaultLayout from '~/components/Layouts/Default'
+import { NextSeo } from 'next-seo'
+
+const ignoreClass = 'ignore-on-export'
+
+function getComponents(type: any) {
+ const components = {
+ CodeBlock,
+ Quote,
+ Avatar,
+ code: (props: any) => {
+ if (props.className !== ignoreClass) {
+ return <CodeBlock {...props} />
+ } else {
+ return <code {...props} />
+ }
+ },
+ ImageGrid,
+ img: (props: any) => {
+ if (props.className !== ignoreClass) {
+ return (
+ <div
+ className={[
+ 'next-image--dynamic-fill',
+ type === 'blog' && 'to-scale-400 from-scale-500 rounded-lg border bg-gradient-to-r',
+ ].join(' ')}
+ >
+ <Image
+ {...props}
+ className={['next-image--dynamic-fill', type === 'blog' && 'rounded-md border'].join(
+ ' '
+ )}
+ layout="fill"
+ />
+ </div>
+ )
+ }
+ return <img {...props} />
+ },
+ }
+
+ return components
+}
+
+export default function ContentsLayout({ context }: any) {
+ const router = useRouter()
+
+ console.log(context)
+
+ return (
+ <DefaultLayout>
+ <NextSeo {...context.meta} />
+ <MDXProvider components={getComponents(context.type)}>
+ <div className="prose max-w-none">{context.children}</div>
+ </MDXProvider>
+ </DefaultLayout>
+ )
+}
diff --git a/apps/www/next.config.js b/apps/www/next.config.js
index 36703af7ae8..048ee85b0bc 100644
--- a/apps/www/next.config.js
+++ b/apps/www/next.config.js
@@ -1,9 +1,18 @@
-const withMDX = require('@next/mdx')()
+const gfm = require('remark-gfm')
+const slug = require('rehype-slug')
+const withMDX = require('@next/mdx')({
+ extension: /\.mdx?$/,
+ options: {
+ remarkPlugins: [gfm],
+ rehypePlugins: [slug],
+ // If you use `MDXProvider`, uncomment the following line.
+ providerImportSource: '@mdx-js/react',
+ },
+})
module.exports = withMDX({
basePath: '',
pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'md', 'mdx'],
-
trailingSlash: false,
images: {
dangerouslyAllowSVG: true,
diff --git a/apps/www/pages/[slug].tsx b/apps/www/pages/[slug].tsx
new file mode 100644
index 00000000000..981b3a933a1
--- /dev/null
+++ b/apps/www/pages/[slug].tsx
@@ -0,0 +1,396 @@
+import { Badge, Card, Divider, IconChevronLeft, IconFile, Space } from '@supabase/ui'
+import matter from 'gray-matter'
+import authors from 'lib/authors.json'
+import hydrate from 'next-mdx-remote/hydrate'
+import renderToString from 'next-mdx-remote/render-to-string'
+import { NextSeo } from 'next-seo'
+import Link from 'next/link'
+import Image from 'next/image'
+import { useRouter } from 'next/router'
+import React from 'react'
+import ReactMarkdown from 'react-markdown'
+import CodeBlock from '~/components/CodeBlock/CodeBlock'
+import CTABanner from '~/components/CTABanner'
+import DefaultLayout from '~/components/Layouts/Default'
+import Quote from '~/components/Quote'
+import Avatar from '~/components/Avatar'
+import ImageGrid from '~/components/ImageGrid'
+import { generateReadingTime } from '~/lib/helpers'
+import { getAllPostSlugs, getPostdata, getSortedPosts } from '~/lib/posts'
+
+const ignoreClass = 'ignore-on-export'
+
+// import all components used in blog articles here
+// for instance, if you use a button, you must add `Button` in the components object below.
+const components = {
+ CodeBlock,
+ Quote,
+ Avatar,
+ code: (props: any) => {
+ if (props.className !== ignoreClass) {
+ return <CodeBlock {...props} />
+ } else {
+ return <code {...props} />
+ }
+ },
+ ImageGrid,
+ img: (props: any) => {
+ if (props.className !== ignoreClass) {
+ return (
+ <div
+ className="
+ next-image--dynamic-fill
+ to-scale-400
+ from-scale-500 rounded-lg
+ border bg-gradient-to-r
+ "
+ >
+ <Image {...props} className="next-image--dynamic-fill rounded-md border" layout="fill" />
+ </div>
+ )
+ }
+ return <img {...props} />
+ },
+}
+
+// plugins for next-mdx-remote
+const gfm = require('remark-gfm')
+const slug = require('rehype-slug')
+
+// table of contents extractor
+const toc = require('markdown-toc')
+
+const directory = ''
+
+export async function getStaticPaths() {
+ const paths = getAllPostSlugs(directory)
+ return {
+ paths,
+ fallback: false,
+ }
+}
+
+export async function getStaticProps({ params }: any) {
+ const filePath = `${params.slug}`
+ const postContent = await getPostdata(filePath, directory)
+ const { data, content } = matter(postContent)
+
+ const mdxSource: any = await renderToString(content, {
+ components,
+ scope: data,
+ mdxOptions: {
+ remarkPlugins: [gfm],
+ rehypePlugins: [slug],
+ },
+ })
+
+ const relatedPosts = getSortedPosts(directory, 5, mdxSource.scope.tags)
+
+ const allPosts = getSortedPosts(directory)
+
+ const currentIndex = allPosts
+ .map(function (e) {
+ return e.slug
+ })
+ .indexOf(filePath)
+
+ const nextPost = allPosts[currentIndex + 1]
+ const prevPost = allPosts[currentIndex - 1]
+
+ return {
+ props: {
+ prevPost: currentIndex === 0 ? null : prevPost ? prevPost : null,
+ nextPost: currentIndex === allPosts.length ? null : nextPost ? nextPost : null,
+ relatedPosts,
+ blog: {
+ slug: `${params.slug}`,
+ content: mdxSource,
+ ...data,
+ toc: toc(content, { maxdepth: data.toc_depth ? data.toc_depth : 2 }),
+ },
+ },
+ }
+}
+
+function BlogPostPage(props: any) {
+ // @ts-ignore
+ const content = hydrate(props.blog.content, { components })
+ const authorArray = props.blog.author.split(',')
+
+ const author = []
+ for (let i = 0; i < authorArray.length; i++) {
+ author.push(
+ // @ts-ignore
+ authors.find((authors: string) => {
+ // @ts-ignore
+ return authors.author_id === authorArray[i]
+ })
+ )
+ }
+
+ const { basePath } = useRouter()
+
+ const NextCard = (props: any) => {
+ const { post, label, className } = props
+
+ return (
+ <Link href={`${post.path}`} as={`${post.path}`}>
+ <div className={className}>
+ <div className="border-scale-500 hover:bg-scale-100 dark:hover:bg-scale-300 cursor-pointer rounded border p-6 transition">
+ <div className="space-y-4">
+ <div>
+ <p className="text-scale-900 text-sm">{label}</p>
+ </div>
+ <div>
+ <h4 className="text-scale-1200 text-lg">{post.title}</h4>
+ <p className="small">{post.date}</p>
+ </div>
+ </div>
+ </div>
+ </div>
+ </Link>
+ )
+ }
+
+ const toc = props.blog.toc && (
+ <div className="space-y-8 py-8 lg:py-0">
+ <div>
+ <div className="space-x-2">
+ {props.blog.tags.map((tag: string) => {
+ return (
+ <a href={`/blog/tags/${tag}`} key={`category-badge-${tag}`}>
+ <Badge>{tag}</Badge>
+ </a>
+ )
+ })}
+ </div>
+ </div>
+ <div>
+ <div>
+ <p className="text-scale-1200 mb-4">On this page</p>
+ <div className="prose-toc">
+ <ReactMarkdown plugins={[gfm]}>{props.blog.toc.content}</ReactMarkdown>
+ </div>
+ </div>
+ </div>
+ </div>
+ )
+
+ return (
+ <>
+ <NextSeo
+ title={props.blog.title}
+ openGraph={{
+ title: props.blog.title,
+ description: props.blog.description,
+ url: `https://supabase.com/blog/${props.blog.slug}`,
+ type: 'article',
+
+ article: {
+ //
+ // to do: add expiration and modified dates
+ // https://github.com/garmeeh/next-seo#article
+ publishedTime: props.blog.date,
+ //
+ // to do: author urls should be internal in future
+ // currently we have external links to github profiles
+ authors: [props.blog.author_url],
+ tags: props.blog.tags.map((cat: string) => {
+ return cat
+ }),
+ },
+ images: [
+ {
+ url: `https://supabase.com${basePath}/images/blog/${
+ props.blog.image ? props.blog.image : props.blog.thumb
+ }`,
+ alt: `${props.blog.title} thumbnail`,
+ },
+ ],
+ }}
+ />
+ <DefaultLayout>
+ <div
+ className="
+ container mx-auto px-8 py-16 sm:px-16
+ xl:px-20
+ "
+ >
+ <div className="grid grid-cols-12 gap-4">
+ <div className="col-span-12 mb-2 lg:col-span-2">
+ {/* Back button */}
+ <p>
+ <a
+ href={'/blog'}
+ className="text-scale-900 hover:text-scale-1200 flex cursor-pointer items-center text-sm transition"
+ >
+ <IconChevronLeft style={{ padding: 0 }} />
+ Back
+ </a>
+ </p>
+ </div>
+ <div className="col-span-12 lg:col-span-12 xl:col-span-10">
+ {/* Title and description */}
+ <div className="mb-16 max-w-5xl space-y-8">
+ <div className="space-y-4">
+ <p className="text-brand-900">Blog post</p>
+ <h1 className="h1">{props.blog.title}</h1>
+ <div className="text-scale-900 flex space-x-3 text-sm">
+ <p>{props.blog.date}</p>
+ <p>•</p>
+ <p>{generateReadingTime(props.blog.content.renderedOutput)}</p>
+ </div>
+ <div className="flex gap-3">
+ {author.map((author: any) => {
+ return (
+ <div className="mt-6 mb-8 mr-4 w-max lg:mb-0">
+ <Link href={author.author_url}>
+ <a className="cursor-pointer">
+ <div className="flex items-center gap-3">
+ {author.author_image_url && (
+ <div className="w-10">
+ <Image
+ src={author.author_image_url}
+ className="dark:border-dark rounded-full border"
+ width="100%"
+ height="100%"
+ layout="responsive"
+ />
+ </div>
+ )}
+ <div className="flex flex-col">
+ <span className="text-scale-1200 mb-0 text-sm">
+ {author.author}
+ </span>
+ <span className="text-scale-900 mb-0 text-xs">
+ {author.position}
+ </span>
+ </div>
+ </div>
+ </a>
+ </Link>
+ </div>
+ )
+ })}
+ </div>
+ </div>
+ </div>
+ <div className="grid grid-cols-12 lg:gap-16 xl:gap-8">
+ {/* Content */}
+ <div className="col-span-12 lg:col-span-7 xl:col-span-7">
+ {props.blog.thumb && (
+ <div className="relative mb-8 h-96 w-full overflow-auto rounded-lg border">
+ <Image
+ src={'/images/blog/' + props.blog.thumb}
+ layout="fill"
+ objectFit="cover"
+ />
+ </div>
+ )}
+ <article className={['prose prose-docs'].join(' ')}>{content}</article>
+ <div className="py-16">
+ <div className="text-scale-900 dark:text-scale-1000 text-sm">
+ Share this article
+ </div>
+ <div className="mt-4 flex items-center space-x-4">
+ <Link
+ passHref
+ href={`https://twitter.com/share?text=${props.blog.title}&url=https://supabase.com/blog/${props.blog.slug}`}
+ >
+ <a target="_blank" className="text-scale-900 hover:text-scale-1200">
+ <svg
+ height="26"
+ width="26"
+ viewBox="-89 -46.8 644 446.8"
+ xmlns="http://www.w3.org/2000/svg"
+ fill="currentColor"
+ >
+ <path
+ d="m154.729 400c185.669 0 287.205-153.876 287.205-287.312 0-4.37-.089-8.72-.286-13.052a205.304 205.304 0 0 0 50.352-52.29c-18.087 8.044-37.55 13.458-57.968 15.899 20.841-12.501 36.84-32.278 44.389-55.852a202.42 202.42 0 0 1 -64.098 24.511c-18.42-19.628-44.644-31.904-73.682-31.904-55.744 0-100.948 45.222-100.948 100.965 0 7.925.887 15.631 2.619 23.025-83.895-4.223-158.287-44.405-208.074-105.504a100.739 100.739 0 0 0 -13.668 50.754c0 35.034 17.82 65.961 44.92 84.055a100.172 100.172 0 0 1 -45.716-12.63c-.015.424-.015.837-.015 1.29 0 48.903 34.794 89.734 80.982 98.986a101.036 101.036 0 0 1 -26.617 3.553c-6.493 0-12.821-.639-18.971-1.82 12.851 40.122 50.115 69.319 94.296 70.135-34.549 27.089-78.07 43.224-125.371 43.224a204.9 204.9 0 0 1 -24.078-1.399c44.674 28.645 97.72 45.359 154.734 45.359"
+ fillRule="nonzero"
+ />
+ </svg>
+ </a>
+ </Link>
+
+ <Link
+ passHref
+ href={`https://www.linkedin.com/shareArticle?url=https://supabase.com/blog/${props.blog.slug}&title=${props.blog.title}`}
+ >
+ <a target="_blank" className="text-scale-900 hover:text-scale-1200">
+ <svg
+ width="20"
+ height="20"
+ viewBox="0 5 1036 990"
+ xmlns="http://www.w3.org/2000/svg"
+ fill="currentColor"
+ >
+ <path d="M0 120c0-33.334 11.667-60.834 35-82.5C58.333 15.833 88.667 5 126 5c36.667 0 66.333 10.666 89 32 23.333 22 35 50.666 35 86 0 32-11.333 58.666-34 80-23.333 22-54 33-92 33h-1c-36.667 0-66.333-11-89-33S0 153.333 0 120zm13 875V327h222v668H13zm345 0h222V622c0-23.334 2.667-41.334 8-54 9.333-22.667 23.5-41.834 42.5-57.5 19-15.667 42.833-23.5 71.5-23.5 74.667 0 112 50.333 112 151v357h222V612c0-98.667-23.333-173.5-70-224.5S857.667 311 781 311c-86 0-153 37-201 111v2h-1l1-2v-95H358c1.333 21.333 2 87.666 2 199 0 111.333-.667 267.666-2 469z" />
+ </svg>
+ </a>
+ </Link>
+ </div>
+ </div>
+ <div className="grid gap-8 py-8 lg:grid-cols-1">
+ <div>
+ {props.prevPost && <NextCard post={props.prevPost} label="Last post" />}
+ </div>
+ <div>
+ {props.nextPost && (
+ <NextCard post={props.nextPost} label="Next post" className="text-right" />
+ )}
+ </div>
+ </div>
+ </div>
+ {/* Sidebar */}
+ <div className="col-span-12 space-y-8 lg:col-span-5 xl:col-span-3 xl:col-start-9">
+ <div className="space-y-8 lg:sticky lg:top-16 lg:mb-16">
+ <div className="hidden lg:block">{toc}</div>
+ <div>
+ <div className="mb-4">
+ <p className="text-scale-1200 text-sm">Related articles</p>
+ </div>
+ <div className="space-y-3">
+ {props.relatedPosts.map((post: any) => (
+ <Link href={`${post.path}`} as={`${post.path}`}>
+ <div>
+ <p className="cursor-pointer">
+ <div className="flex gap-2">
+ <div className="text-scale-900">
+ <IconFile size={'small'} style={{ minWidth: '1.2rem' }} />
+ </div>
+ <span className="text-scale-1100 hover:text-gray-1200 text-sm">
+ {post.title}
+ </span>
+ </div>
+ </p>
+ <Divider light className="mt-2" />
+ </div>
+ </Link>
+ ))}
+ <div className="mt-2">
+ <Link href={`/blog`} passHref>
+ <a className="text-scale-1100 hover:text-scale-1200 cursor-pointer text-sm">
+ View all posts
+ </a>
+ </Link>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <CTABanner />
+ </DefaultLayout>
+ </>
+ )
+}
+
+// function BlogPostPage() {
+// return <h1>blog post</h1>
+// }
+
+export default BlogPostPage
diff --git a/apps/www/pages/security.mdx b/apps/www/pages/security.mdx
new file mode 100644
index 00000000000..7cdf1a81a51
--- /dev/null
+++ b/apps/www/pages/security.mdx
@@ -0,0 +1,134 @@
+import { KeyIcon, LinkIcon } from '@heroicons/react/outline'
+import { Button, IconGitHub } from '@supabase/ui'
+import Layout from '../layouts/Layout'
+
+export const meta = {
+ type: 'lp',
+ title: 'Security at Supabase',
+ description: 'Security at Supabase',
+}
+
+export const Section = ({ children, icon, img }) => (
+ <div>
+ {icon && (
+ <div className="bordershadow-scale-500 not-prose dark:bg-scale-400 -mb-4 flex h-7 w-7 items-center justify-center rounded-md bg-white">
+ <figure className="w-4">{icon}</figure>
+ </div>
+ )}
+ {img && <div className="-mb-4 flex h-12 w-12 items-center justify-center">{img}</div>}
+ {children}
+ </div>
+)
+
+<div className="container mx-auto px-8 sm:px-16 xl:px-20 grid grid-cols-12 items-center my-16">
+ <div className="col-span-12 lg:col-span-6">
+ <h1>Security at Supabase</h1>
+ <h2 className="text-base text-scale-1100 max-w-xl">
+ All customer data is encrypted at REST with AES-256 and in transit via TLS. Sensitive
+ information like access tokens and encryption keys are encrypted at the application level
+ before they are stored in the database.
+ </h2>
+ </div>
+ <div className="col-span-12 lg:col-span-5 lg:col-start-8">
+
+![Supabase security](/images/security/security-hero.png)
+
+ </div>
+</div>
+
+<div className="container mx-auto px-8 sm:px-16 xl:px-20 mb-16">
+
+<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-8 lg:gap-16">
+
+<Section icon={<LinkIcon />}>
+
+### SOC 2
+
+Supabase is SOC2 type 1 compliant. Enterprise customers can request a copy of our SOC2 report by contacting
+
+<div className="w-16">
+ <img src="/images/security/21972-312_SOC_NonCPA.png" />
+</div>
+
+</Section>
+<Section icon={<KeyIcon strokeWidth={1}/>}>
+
+### Data Encryption
+
+All customer data is encrypted at REST with AES-256 and in transit via TLS.
+
+Sensitive information like access tokens and encryption keys are encrypted at the application level before they are stored in the database.
+
+</Section>
+
+<Section icon={<IconGitHub size={15} />}>
+
+### Github security integration
+
+[We have partnered with GitHub]('/blog') to scan for Supabase service role API keys. If Github detects any keys with full access to the database being pushed to GitHub, they are automatically revoked.
+
+</Section>
+
+<Section icon={<KeyIcon strokeWidth={1}/>}>
+
+### Role based access control
+
+All customer data is encrypted at REST with AES-256 and in transit via TLS.
+
+Sensitive information like access tokens and encryption keys are encrypted at the application level before they are stored in the database.
+
+</Section>
+
+<Section icon={<KeyIcon strokeWidth={1}/>}>
+
+### Backups
+
+All customer databases are fully backed up every day.
+
+Enterprise customers have access to Point in Time Recovery which enables restoring the database to any point in time.
+
+</Section>
+
+<Section icon={<KeyIcon strokeWidth={1}/>}>
+
+### Payment processing
+
+Supabase uses [Stripe](https://stripe.com) to process payments and does not store personal credit card information for any of our customers.
+
+Stripe is a certified PCI Service Provider Level 1, which is the highest level of certification in the payments industry.
+
+</Section>
+
+<Section icon={<KeyIcon strokeWidth={1}/>}>
+
+### Vulnerability Management
+
+Supabase works with industry experts to conduct annual penetration tests.
+
+In addition to internal security reviews, we use various tools to scan our code for vulnerabilities including Github, Vanta and Snyk.
+
+</Section>
+
+</div>
+
+</div>
+
+---
+
+<div className="container mx-auto mb-24 grid grid-cols-12 items-center px-8 sm:px-16 xl:px-20">
+ <div className="col-span-6">
+
+<h3 className="text-3xl">Vanta Security Portal</h3>
+
+Access Supabase’s security and compliance documents on our Security Portal, such as
+penetration testing and audit reports.
+
+<Button type="default" size="medium">
+ View Report
+</Button>
+
+ </div>
+</div>
+
+export default (context) => <Layout meta={meta} children={context.children} context={context} />
diff --git a/apps/www/public/images/security/21972-312_SOC_NonCPA.png b/apps/www/public/images/security/21972-312_SOC_NonCPA.png
new file mode 100644
index 00000000000..3cb083ecda2
Binary files /dev/null and b/apps/www/public/images/security/21972-312_SOC_NonCPA.png differ
diff --git a/apps/www/public/images/security/security-hero.png b/apps/www/public/images/security/security-hero.png
new file mode 100644
index 00000000000..635b14beaee
Binary files /dev/null and b/apps/www/public/images/security/security-hero.png differ
diff --git a/packages/config/tailwind.config.js b/packages/config/tailwind.config.js
index 8aec9fdab93..d977515425d 100644
--- a/packages/config/tailwind.config.js
+++ b/packages/config/tailwind.config.js
@@ -16,10 +16,10 @@ module.exports = ui({
mode: 'JIT',
content: [
'../../packages/common/**/*.{ts,tsx}',
- './src/**/*.{ts,tsx}',
+ './src/**/*.{ts,tsx,mdx}',
'./components/**/*.tsx',
'./layouts/**/*.tsx',
- './pages/**/*.tsx',
+ './pages/**/*.{tsx,mdx}',
'./_blog/*.mdx',
// purge styles from supabase ui theme
'../../node_modules/@supabase/ui/dist/config/default-theme.js',