Skip to content

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

Midway starting on realtime landing page

Joshen Lim231d8bbc22c2
diff --git a/apps/www/data/Solutions.json b/apps/www/data/Solutions.json
index 7e9131da046..e6abd655e13 100644
--- a/apps/www/data/Solutions.json
+++ b/apps/www/data/Solutions.json
@@ -30,5 +30,13 @@
"description_short": "",
"label": "",
"url": "/edge-functions"
+ },
+ "realtime": {
+ "name": "Realtime",
+ "icon": "M13 10V3L4 14h7v7l9-11h-7z",
+ "description": "Listen to changes in a Postgres Database and broadcast them over web sockets",
+ "description_short": "",
+ "label": "",
+ "url": "/realtime"
}
}
diff --git a/apps/www/data/products/realtime/api-examples.js b/apps/www/data/products/realtime/api-examples.js
new file mode 100644
index 00000000000..3519bdba82e
--- /dev/null
+++ b/apps/www/data/products/realtime/api-examples.js
@@ -0,0 +1,83 @@
+export default [
+ {
+ lang: 'js',
+ title: 'Subscribing to events',
+ description: '',
+ code: `
+import { RealtimeClient } from '@supabase/realtime-js'
+const client = new RealtimeClient(process.env.REALTIME_URL)
+
+// Listen to events on the entire database.
+const databaseChanges = client.channel('realtime:*')
+databaseChanges.on('*', (e) => console.log(e))
+databaseChanges.subscribe()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ `,
+ },
+ {
+ lang: 'js',
+ title: 'Presence',
+ description: '',
+ code: `
+import { RealtimeClient } from '@supabase/realtime-js'
+const client = new RealtimeClient(process.env.REALTIME_URL)
+
+const channel = client.channel('room:*')
+channel.on('presence', { event: 'SYNC' }, () => {
+ console.log('Presence synced')
+})
+channel.subscribe().receive('ok', () => console.log('Subscribed!))
+
+
+
+
+
+
+
+
+
+
+
+
+ `,
+ },
+ {
+ lang: 'js',
+ title: 'Broadcast',
+ description: '',
+ code: `
+ // Sign in with magic links
+ const { user, error } = await supabase.auth.signIn({
+ })
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ `,
+ },
+]
diff --git a/apps/www/data/products/realtime/app-examples.js b/apps/www/data/products/realtime/app-examples.js
new file mode 100644
index 00000000000..c9b7bcc93b5
--- /dev/null
+++ b/apps/www/data/products/realtime/app-examples.js
@@ -0,0 +1,62 @@
+export default [
+ {
+ image: '',
+ title: 'Leaderboard',
+ description:
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ',
+ },
+ {
+ image: '',
+ title: 'Shared code editor',
+ description:
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ',
+ },
+ {
+ image: '',
+ title: 'Shared text editor',
+ description:
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ',
+ },
+ {
+ image: '',
+ title: 'Stock market',
+ description:
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ',
+ },
+ {
+ image: '',
+ title: 'Share whiteboard',
+ description:
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ',
+ },
+ {
+ image: '',
+ title: 'Multiplayer',
+ description:
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ',
+ },
+ {
+ image: '',
+ title: 'Charts',
+ description:
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ',
+ },
+ {
+ image: '',
+ title: 'Location',
+ description:
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ',
+ },
+ {
+ image: '',
+ title: 'Notifications',
+ description:
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ',
+ },
+ {
+ image: '',
+ title: 'In app chat',
+ description:
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ',
+ },
+]
diff --git a/apps/www/pages/realtime/Realtime.module.css b/apps/www/pages/realtime/Realtime.module.css
new file mode 100644
index 00000000000..3dd7008e1bd
--- /dev/null
+++ b/apps/www/pages/realtime/Realtime.module.css
@@ -0,0 +1,7 @@
+/* .github-icon svg {
+ fill: currentColor;
+} */
+
+.github-icon {
+ @apply text-white;
+}
diff --git a/apps/www/pages/realtime/Realtime.tsx b/apps/www/pages/realtime/Realtime.tsx
new file mode 100644
index 00000000000..0cfd3b81ca3
--- /dev/null
+++ b/apps/www/pages/realtime/Realtime.tsx
@@ -0,0 +1,175 @@
+import {
+ Button,
+ IconArrowUpRight,
+ IconBriefcase,
+ IconEye,
+ IconLink,
+ IconShield,
+} from '@supabase/ui'
+
+// [TODO] These need to be relooked - I'm using multiplayer.dev as a "docs"
+import ApiExamples from 'data/products/realtime/api-examples'
+import AppExamples from 'data/products/realtime/app-examples'
+
+import AuthSqlRulesExamples from 'data/products/auth/auth-sql-rules-examples'
+import Solutions from 'data/Solutions.json'
+import { NextSeo } from 'next-seo'
+import Image from 'next/image'
+import Link from 'next/link'
+import { useRouter } from 'next/router'
+import SplitCodeBlockCarousel from '~/components/Carousels/SplitCodeBlockCarousel'
+import CTABanner from '~/components/CTABanner'
+import FeatureColumn from '~/components/FeatureColumn'
+import FloatingIcons from '~/components/FloatingIcons'
+import DefaultLayout from '~/components/Layouts/Default'
+import SectionContainer from '~/components/Layouts/SectionContainer'
+import APISection from '~/components/Sections/APISection'
+import GithubExamples from '~/components/Sections/GithubExamples'
+import ProductHeader from '~/components/Sections/ProductHeader'
+import AuthProviders from '~/data/auth.json'
+
+const Cursor = (color: string = 'none') => {
+ return (
+ <svg
+ xmlns="http://www.w3.org/2000/svg"
+ fill={color}
+ viewBox="0 0 24 24"
+ aria-hidden="true"
+ className="h-8 w-8 stroke-black dark:stroke-white"
+ >
+ <path
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ d="M3 3l7.07 16.97 2.51-7.39 7.39-2.51L3 3z"
+ />
+ </svg>
+ )
+}
+
+function AuthPage() {
+ // base path for images
+ const { basePath } = useRouter()
+ const meta_title = 'Realtime | Sync your data in real time'
+ const meta_description =
+ 'Listens to changes in a PostgreSQL Database and broadcasts them over WebSockets'
+
+ return (
+ <>
+ <NextSeo
+ title={meta_title}
+ description={meta_description}
+ openGraph={{
+ title: meta_title,
+ description: meta_description,
+ url: `https://supabase.com/realtime`,
+ images: [
+ {
+ // [TODO] Update OG image
+ // [TODO] Update to use an appropriate icon for realtime in Solutions.json
+ url: `https://supabase.com${basePath}/images/product/auth/auth-og.jpg`,
+ },
+ ],
+ }}
+ />
+ <DefaultLayout>
+ <ProductHeader
+ icon={Solutions['realtime'].icon}
+ title={Solutions['realtime'].name}
+ h1={[<span key={'authentication-h1'}>Build reactive web and mobile applications</span>]}
+ subheader={[
+ 'Sync data across clients by listening to changes in your Database and broadcasting them over web sockets',
+ ]}
+ image={[
+ <div className="bg-scale-500 relative h-[372px] w-[560px] rounded">
+ <Cursor />
+ </div>,
+ // <div className="header--light block w-full" key="light">
+ // <Image
+ // src={`${basePath}/images/product/auth/header--light.png`}
+ // alt="auth header"
+ // layout="responsive"
+ // width="1372"
+ // height="1074"
+ // />
+ // </div>,
+ // <div className="header--dark mr-0 w-full dark:block" key="dark">
+ // <Image
+ // src={`${basePath}/images/product/auth/header--dark.png`}
+ // alt="auth header"
+ // layout="responsive"
+ // width="1372"
+ // height="1074"
+ // />
+ // </div>,
+ ]}
+ // [TODO] Point to the correct docs URL
+ documentation_url={'/docs/guides/auth'}
+ />
+
+ <SectionContainer className="-mb-48">
+ <APISection
+ title="Simple and convenient APIs"
+ // @ts-ignore
+ content={ApiExamples}
+ size="large"
+ text={[
+ <p key={0}>
+ {/* [TODO] Update copy */}
+ <p className="text-base lg:text-lg">
+ APIs that you can understand. With powerful libraries that work on client and
+ server-side applications.
+ </p>
+ </p>,
+ ]}
+ // [TODO] Point to the correct docs URL
+ documentation_link={'/docs/guides/auth'}
+ />
+ </SectionContainer>
+
+ <div className="relative">
+ <div className="section--masked">
+ <div className="section--bg-masked">
+ <div className="section--bg border-t border-b 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>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <SectionContainer>
+ <div className="grid grid-cols-12">
+ <div className="col-span-12 text-center">
+ <h2 className="h3">What you can build with Realtime</h2>
+ <p className="p mx-auto lg:w-1/2">
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
+ incididunt ut labore et dolore magna aliqua.
+ </p>
+ <div className="col-span-12 grid grid-cols-12 gap-8 py-16">
+ {AppExamples.map((example) => {
+ return (
+ <div className="col-span-3">
+ <div className="bg-scale-500 mb-4 h-40 w-full rounded" />
+ <p className="p !mb-2 text-left">{example.title}</p>
+ <p className="p text-left text-sm">{example.description}</p>
+ </div>
+ )
+ })}
+ </div>
+ </div>
+ </div>
+ </SectionContainer>
+
+ <CTABanner />
+ </DefaultLayout>
+ </>
+ )
+}
+
+export default AuthPage
diff --git a/apps/www/pages/realtime/index.tsx b/apps/www/pages/realtime/index.tsx
new file mode 100644
index 00000000000..a8eea95247e
--- /dev/null
+++ b/apps/www/pages/realtime/index.tsx
@@ -0,0 +1,3 @@
+import Realtime from './Realtime'
+
+export default Realtime