The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
chore: duplicated page to /storage and added basic text changes
Jonathan Summers-Muir6bd3783791a6
diff --git a/www/data/products/storage/permissions-examples.js b/www/data/products/storage/permissions-examples.jsnew file mode 100644index 00000000000..a1e87a022ba--- /dev/null+++ b/www/data/products/storage/permissions-examples.js@@ -0,0 +1,55 @@+export default [+ {+ lang: 'sql',+ title: 'Public access to a bucket',+ code: `CREATE POLICY open_all_update+ON storage.objects+for all WITH CHECK (bucket_id='bucket1');+ `,+ detail_title: 'Allow public CRUD access to a bucket',+ detail_text: "This will allow any user access to the bucket named 'bucket1'",+ badges_label: '',+ badges: [],+ url: '',+ },+ {+ lang: 'sql',+ title: 'Public access to a folder',+ code: `CREATE POLICY crud_public_folder+ON storage.objects+for all USING (bucket_id='bucket1' and (storage.foldername(name))[1] = 'public');+ `,+ detail_title: 'Allow public CRUD access to a folder in a bucket',+ detail_text:+ "This will allow any user access to the folder named 'public' in the bucket 'bucket1'",+ badges_label: '',+ badges: [],+ url: '',+ },+ {+ lang: 'sql',+ title: 'Authenticated access to a folder',+ code: `CREATE POLICY authenticated_folder+ON storage.objects+for all USING (bucket_id='bucket1' and (storage.foldername(name))[1] = 'authenticated' and auth.role() = 'authenticated');`,+ detail_title: 'Allow any authenticated user access to a folder',+ detail_text:+ "This will allow any authenticated user access to the folder named 'authenticated' in the bucket 'bucket1'",+ badges_label: '',+ badges: [],+ url: '',+ },+ {+ lang: 'sql',+ title: 'User access to a file',+ code: `CREATE POLICY crud_uid_file+ON storage.objects+for all USING (bucket_id='bucket2' and name = 'folder/only_uid.jpg' and auth.uid() = 'd8c7bce9-cfeb-497b-bd61-e66ce2cbdaa2');`,+ detail_title: 'Allow a specific user access to a file',+ detail_text:+ "This will allow a specific user based on the user's UID access to a file named 'only_uid.jpg'",+ badges_label: '',+ badges: [],+ url: '',+ },+]diff --git a/www/package-lock.json b/www/package-lock.jsonindex 4d0b7c595c6..183ee665322 100644--- a/www/package-lock.json+++ b/www/package-lock.json@@ -2738,9 +2738,9 @@},"dependencies": {"caniuse-lite": {- "version": "1.0.30001203",- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001203.tgz",- "integrity": "sha512-/I9tvnzU/PHMH7wBPrfDMSuecDeUKerjCPX7D0xBbaJZPxoT9m+yYxt0zCTkcijCkjTdim3H56Zm0i5Adxch4w=="+ "version": "1.0.30001204",+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001204.tgz",+ "integrity": "sha512-JUdjWpcxfJ9IPamy2f5JaRDCaqJOxDzOSKtbdx4rH9VivMd1vIzoPumsJa9LoMIi4Fx2BV2KZOxWhNkBjaYivQ=="},"postcss": {"version": "7.0.35",@@ -4532,14 +4532,14 @@}},"caniuse-lite": {- "version": "1.0.30001203",- "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001203.tgz",- "integrity": "sha512-/I9tvnzU/PHMH7wBPrfDMSuecDeUKerjCPX7D0xBbaJZPxoT9m+yYxt0zCTkcijCkjTdim3H56Zm0i5Adxch4w=="+ "version": "1.0.30001204",+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001204.tgz",+ "integrity": "sha512-JUdjWpcxfJ9IPamy2f5JaRDCaqJOxDzOSKtbdx4rH9VivMd1vIzoPumsJa9LoMIi4Fx2BV2KZOxWhNkBjaYivQ=="},"electron-to-chromium": {- "version": "1.3.693",- "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.693.tgz",- "integrity": "sha512-vUdsE8yyeu30RecppQtI+XTz2++LWLVEIYmzeCaCRLSdtKZ2eXqdJcrs85KwLiPOPVc6PELgWyXBsfqIvzGZag=="+ "version": "1.3.698",+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.698.tgz",+ "integrity": "sha512-VEXDzYblnlT+g8Q3gedwzgKOso1evkeJzV8lih7lV8mL8eAnGVnKyC3KsFT6S+R5PQO4ffdr1PI16/ElibY/kQ=="},"node-releases": {"version": "1.1.71",diff --git a/www/pages/storage/Storage.module.css b/www/pages/storage/Storage.module.cssnew file mode 100644index 00000000000..3dd7008e1bd--- /dev/null+++ b/www/pages/storage/Storage.module.css@@ -0,0 +1,7 @@+/* .github-icon svg {+ fill: currentColor;+} */++.github-icon {+ @apply text-white;+}diff --git a/www/pages/storage/Storage.tsx b/www/pages/storage/Storage.tsxnew file mode 100644index 00000000000..580519cbece--- /dev/null+++ b/www/pages/storage/Storage.tsx@@ -0,0 +1,276 @@+import { useRouter } from 'next/router'++import {+ Button,+ Auth,+ Badge,+ Card,+ Space,+ Tabs,+ Typography,+ IconCode,+ IconZoomIn,+ IconCopy,+ IconKey,+ IconBriefcase,+ IconEye,+ IconX,+ IconDatabase,+ IconShield,+ IconLink,+ IconArrowUpRight,+ IconShuffle,+ IconWifi,+} from '@supabase/ui'+import { createClient } from '@supabase/supabase-js'+import DefaultLayout from '~/components/Layouts/Default'++import CodeBlock from '~/components/CodeBlock/CodeBlock'+import ProductHeader from '~/components/Sections/ProductHeader'+import SectionContainer from '~/components/Layouts/SectionContainer'++import SplitCodeBlockCarousel from '~/components/Carousels/SplitCodeBlockCarousel'+import APISection from '~/components/Sections/APISection'+import GithubExamples from '~/components/Sections/GithubExamples'+import FeatureColumn from '~/components/FeatureColumn'+import FloatingIcons from '~/components/FloatingIcons'++import ApiExamples from 'data/products/database/api-examples'+import StoragePermissionsData from 'data/products/storage/permissions-examples'++import CTABanner from '~/components/CTABanner'++import Solutions from 'data/Solutions.json'+import ImageCarousel from '~/components/Carousels/ImageCarousel'+import TweetCard from '~/components/TweetCard'++import TableViewCarouselData from 'data/products/database/table-view-carousel.json'+import ExampleCard from '~/components/ExampleCard'++function AuthPage() {+ // base path for images+ const { basePath } = useRouter()++ // supabase auth widget project details+ const supabase = createClient(+ 'https://rsnibhkhsbfnncjmwnkj.supabase.co',+ 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlhdCI6MTYxNTIxNDE1MywiZXhwIjoxOTMwNzkwMTUzfQ.OQEbAaTfgDdLCCht251P2JRD3QDnui6nsU8N-tZA_Mc'+ )++ return (+ <DefaultLayout>+ <ProductHeader+ icon={Solutions['storage'].icon}+ title={Solutions['storage'].name}+ h1={[+ <span>+ Store and serve+ <br /> any type of digital content+ </span>,+ ]}+ subheader={[+ 'An open source scalable object store, capable of holding any file and file size you like.',+ 'With custom policies and permissions that are familair, easy to implement and unlimited scalable storage.',+ ]}+ image={[+ <img+ className="w-full header--light block"+ src={`${basePath}/images/product/auth/header--light.png`}+ />,+ <img+ className="w-full header--dark mr-0 dark:block"+ src={`${basePath}/images/product/auth/header--dark.png`}+ />,+ ]}+ />++ <SectionContainer>+ <div className="grid grid-cols-12">+ <div className="col-span-3">+ <p className="mb-4">+ <Space>+ <img src={`${basePath}/images/product/auth/google-icon.svg`} width={21} />+ <img src={`${basePath}/images/product/auth/facebook-icon.svg`} width={21} />+ <div>+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 32.58 31.77"+ width={21}+ className="text-gray-800 dark:text-white"+ >+ <path+ fill="currentColor"+ d="M16.29,0a16.29,16.29,0,0,0-5.15,31.75c.82.15,1.11-.36,1.11-.79s0-1.41,0-2.77C7.7,29.18,6.74,26,6.74,26a4.36,4.36,0,0,0-1.81-2.39c-1.47-1,.12-1,.12-1a3.43,3.43,0,0,1,2.49,1.68,3.48,3.48,0,0,0,4.74,1.36,3.46,3.46,0,0,1,1-2.18c-3.62-.41-7.42-1.81-7.42-8a6.3,6.3,0,0,1,1.67-4.37,5.94,5.94,0,0,1,.16-4.31s1.37-.44,4.48,1.67a15.41,15.41,0,0,1,8.16,0c3.11-2.11,4.47-1.67,4.47-1.67A5.91,5.91,0,0,1,25,11.07a6.3,6.3,0,0,1,1.67,4.37c0,6.26-3.81,7.63-7.44,8a3.85,3.85,0,0,1,1.11,3c0,2.18,0,3.94,0,4.47s.29.94,1.12.78A16.29,16.29,0,0,0,16.29,0Z"+ />+ </svg>+ </div>+ <img src={`${basePath}/images/product/auth/gitlab-icon.svg`} width={21} />+ <img src={`${basePath}/images/product/auth/bitbucket-icon.svg`} width={21} />+ </Space>+ </p>+ <Typography.Title level={4}>Write less code</Typography.Title>+ <Typography.Text>+ <p className="text-lg">+ Use media in your project without needing to reply on external services or learn new+ frameworks.+ </p>+ <p>+ Familiar and easy to use permissions mean that your content is secure and accessible+ only to the right users+ </p>+ </Typography.Text>+ </div>+ <div className="col-span-3 col-start-5">+ <p className="mb-4">+ <IconLink />+ </p>+ <Typography.Title level={4}>Blazing fast</Typography.Title>+ <Typography.Text>+ <p className="text-lg">API server is a thin layer built on Fasitfy.</p>+ <p>+ 1.3x faster than XXX, your content can be delivered anywhere in the world at the+ speed you expect.+ </p>+ </Typography.Text>+ </div>+ <div className="col-span-3 col-start-9">+ <p className="mb-4">+ <IconShield />+ </p>+ <Typography.Title level={4}>Dependable</Typography.Title>+ <Typography.Text>+ <p className="text-lg">+ Enterprise level uptime with automatic backups of your content kept and maintained+ all by Supabase.A durability rating of 99.999999999%.+ </p>+ </Typography.Text>+ </div>+ </div>+ </SectionContainer>++ <SectionContainer className="pt-16">+ <div className="mb-16 block">+ <Typography.Title>Sleek dashboard for managing your media</Typography.Title>+ <p className="text-lg">+ We provide a full storage explorer so any of your team can easily traverse content and+ files.+ </p>+ <p>+ Simple drag and drop uploading, file moving and multiple file selection so it’s as easy+ as working on your desktop.+ </p>+ </div>+ <ImageCarousel+ // @ts-ignore+ content={TableViewCarouselData}+ footer={[+ <Typography.Title level={4}>Check out our example app</Typography.Title>,+ // !! Update this example !!+ <ExampleCard+ type={'example'}+ products={['database']}+ title={'Profile managment example'}+ description={'NextJS Slack clone app using Supabase realtime subscriptions'}+ author={'supabase'}+ author_url={'https://github.com/supabase'}+ author_img={'https://avatars.githubusercontent.com/u/54469796'}+ repo_name={'update-this-example'}+ repo_url={+ 'https://github.com/supabase/supabase/tree/master/examples/nextjs-slack-clone'+ }+ vercel_deploy_url={''}+ demo_url={'https://supabase-slack-clone-supabase.vercel.app/'}+ />,+ ]}+ />+ </SectionContainer>++ <SectionContainer className="-mb-48 pt-0">+ <APISection+ title="Simple and convenient APIs"+ // @ts-ignore+ content={ApiExamples}+ text={[+ <p>+ An API built from the groud up for server and client side authentication that is fast+ to implement.+ </p>,+ <p>+ With powerful library clients coming soon that allow for asset optimasation and image+ transformation+ </p>,+ ]}+ footer={[+ <div className="grid grid-cols-12 gap-8 lg:gap-0 xl:gap-16 mt-8">+ <div className="col-span-6 lg:col-span-12 lg:mb-8 xl:mb-0 xl:col-span-4">+ <FeatureColumn+ icon={<IconWifi />}+ title="CDN integration"+ text="Request any kind of media in any format and size you like."+ />+ <Badge color="blue">Coming soon</Badge>+ </div>+ <div className="col-span-6 lg:col-span-12 xl:col-span-4">+ <FeatureColumn+ icon={<IconShuffle />}+ title="Auto transformation & optimisation"+ text="Request any kind of media in any format and size you like."+ />+ <Badge color="blue">Coming soon</Badge>+ </div>+ </div>,+ ]}+ />+ </SectionContainer>++ <div className="relative">+ <div className="section--masked">+ <div className="section--bg-masked">+ <div className="section--bg border-t border-gray-100 dark:border-gray-600"></div>+ </div>+ <div className="section-container pt-12 pb-0">+ {/* <FloatingIcons /> */}+ <div className="overflow-x-hidden">+ {/* <SectionContainer className="mb-0 pb-8">+ <GithubExamples />+ </SectionContainer> */}++ <SectionContainer>+ <div className="grid grid-cols-12 lg:gap-16">+ <div className="col-span-12 lg:col-span-5 mb-8">+ <Typography.Title level={2}>+ Integrates natively <br />+ with Supabase Auth{' '}+ </Typography.Title>+ <p className="text-lg">+ Why learn another syntax for writing policies when you can use the same SQL+ you use for your database permissions.+ </p>+ <p>+ Use any combination of postgres function, helper functions and even your own+ metadata to write any policy.+ </p>+ <Button+ size="small"+ type="default"+ className="mt-4"+ icon={<IconArrowUpRight />}+ >+ Expore documentation+ </Button>+ </div>+ <div className="col-span-12 lg:col-span-6 lg:col-start-7">+ <SplitCodeBlockCarousel content={StoragePermissionsData} />+ </div>+ </div>+ </SectionContainer>+ </div>+ </div>+ </div>+ </div>+ <CTABanner />+ </DefaultLayout>+ )+}++export default AuthPagediff --git a/www/pages/storage/index.tsx b/www/pages/storage/index.tsxnew file mode 100644index 00000000000..5ae171d948f--- /dev/null+++ b/www/pages/storage/index.tsx@@ -0,0 +1,3 @@+import Storage from './Storage'++export default Storage