Skip to content

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

init og image generator

Isaiah Hamilton6298d5179b1b
diff --git a/supabase/.gitignore b/supabase/.gitignore
new file mode 100644
index 00000000000..773c7c3e0a1
--- /dev/null
+++ b/supabase/.gitignore
@@ -0,0 +1,3 @@
+# Supabase
+.branches
+.temp
diff --git a/supabase/config.toml b/supabase/config.toml
new file mode 100644
index 00000000000..74e1c6daa07
--- /dev/null
+++ b/supabase/config.toml
@@ -0,0 +1,71 @@
+# A string used to distinguish different Supabase projects on the same host. Defaults to the working
+# directory name when running `supabase init`.
+project_id = "supabase"
+
+[api]
+# Port to use for the API URL.
+port = 54321
+# Schemas to expose in your API. Tables, views and stored procedures in this schema will get API
+# endpoints. public and storage are always included.
+schemas = []
+# Extra schemas to add to the search_path of every request.
+extra_search_path = ["extensions"]
+# The maximum number of rows returns from a view, table, or stored procedure. Limits payload size
+# for accidental or malicious requests.
+max_rows = 1000
+
+[db]
+# Port to use for the local database URL.
+port = 54322
+# The database major version to use. This has to be the same as your remote database's. Run `SHOW
+# server_version;` on the remote database to check.
+major_version = 15
+
+[studio]
+# Port to use for Supabase Studio.
+port = 54323
+
+# Email testing server. Emails sent with the local dev setup are not actually sent - rather, they
+# are monitored, and you can view the emails that would have been sent from the web interface.
+[inbucket]
+# Port to use for the email testing server web interface.
+port = 54324
+smtp_port = 54325
+pop3_port = 54326
+
+[storage]
+# The maximum file size allowed (e.g. "5MB", "500KB").
+file_size_limit = "50MiB"
+
+[auth]
+# The base URL of your website. Used as an allow-list for redirects and for constructing URLs used
+# in emails.
+site_url = "http://localhost:3000"
+# A list of *exact* URLs that auth providers are permitted to redirect to post authentication.
+additional_redirect_urls = ["https://localhost:3000"]
+# How long tokens are valid for, in seconds. Defaults to 3600 (1 hour), maximum 604,800 seconds (one
+# week).
+jwt_expiry = 3600
+# Allow/disallow new user signups to your project.
+enable_signup = true
+
+[auth.email]
+# Allow/disallow new user signups via email to your project.
+enable_signup = true
+# If enabled, a user will be required to confirm any email change on both the old, and new email
+# addresses. If disabled, only the new email is required to confirm.
+double_confirm_changes = true
+# If enabled, users need to confirm their email address before signing in.
+enable_confirmations = false
+
+# Use an external OAuth provider. The full list of providers are: `apple`, `azure`, `bitbucket`,
+# `discord`, `facebook`, `github`, `gitlab`, `google`, `twitch`, `twitter`, `slack`, `spotify`.
+[auth.external.apple]
+enabled = false
+client_id = ""
+secret = ""
+# Overrides the default auth redirectUrl.
+redirect_uri = ""
+# Overrides the default auth provider URL. Used to support self-hosted gitlab, single-tenant Azure,
+# or any other third-party OIDC providers.
+url = ""
diff --git a/supabase/functions/og-images/component/Docs.tsx b/supabase/functions/og-images/component/Docs.tsx
new file mode 100644
index 00000000000..3bd4dd65d27
--- /dev/null
+++ b/supabase/functions/og-images/component/Docs.tsx
@@ -0,0 +1,56 @@
+import React from 'https://esm.sh/[email protected]?deno-std=0.140.0'
+
+type Props = {
+ type?: string | null
+ title: string
+ description: string
+ icon?: string | null
+}
+
+const Docs = (props: Props) => {
+ const { type, title, description, icon } = props
+
+ return (
+ <div
+ style={{
+ height: '100%',
+ width: '100%',
+ display: 'flex',
+ flexDirection: 'column',
+ color: 'white',
+ backgroundColor: '#1c1c1c',
+ backgroundImage: 'url(https://obuldanrptloktxcffvn.supabase.co/storage/v1/object/public/images/og-images/gradient.svg)',
+ backgroundRepeat: 'no-repeat',
+ }}
+ >
+ <div tw="flex flex-row items-center justify-center absolute top-[60px] left-[64px]">
+ {icon && (
+ <img src={`https://raw.githubusercontent.com/supabase/supabase/master/apps/docs/public/img/icons/${icon}-icon.svg`} width="50px" height="50px" />
+ )}
+ {type && icon && (
+ <div tw="h-[50px] border-[1px] border-white mx-4"></div>
+ )}
+ {type && (
+ <>
+ <div tw="w-[50px] h-[50px] bg-[#164430] rounded-md flex items-center justify-center">
+ <img src={`https://raw.githubusercontent.com/supabase/supabase/master/apps/docs/public/img/icons/menu/${type.toLowerCase()}.svg`} width="80%" height="80%" />
+ </div>
+ <span tw="text-[36px] text-[#ededed] ml-[16px]">{type}</span>
+ </>
+ )}
+ </div>
+ <div tw="flex flex-col">
+ <div tw="flex flex-col absolute left-[64px] top-[154px] w-[1072px]">
+ <h1 tw="my-0 mb-2 text-[60px]">{title}</h1>
+ <p tw="my-0 mt-2 text-[40px] text-[#f2fff9] opacity-50">{description}</p>
+ </div>
+ <div tw="flex flex-row items-center justify-center absolute left-[64px] top-[500px]">
+ <img src="https://raw.githubusercontent.com/supabase/supabase/master/packages/common/assets/images/supabase-logo-wordmark--dark.png" width={180} height={34} />
+ <span tw="text-lg font-normal text-[#3ecf8e] ml-2">DOCS</span>
+ </div>
+ </div>
+ </div>
+ )
+}
+
+export default Docs
\ No newline at end of file
diff --git a/supabase/functions/og-images/handler.tsx b/supabase/functions/og-images/handler.tsx
new file mode 100644
index 00000000000..85dfc4cd6e2
--- /dev/null
+++ b/supabase/functions/og-images/handler.tsx
@@ -0,0 +1,45 @@
+import React from 'https://esm.sh/[email protected]?deno-std=0.140.0'
+import { ImageResponse } from 'https://deno.land/x/[email protected]/mod.ts'
+import Docs from './component/Docs.tsx'
+
+const corsHeaders = {
+ 'Access-Control-Allow-Origin': '*',
+ 'Access-Control-Allow-Headers': 'authorization, x-client-info, apikey, content-type',
+ 'Content-Type': 'application/json'
+}
+
+const options = {
+ width: 1200,
+ height: 600,
+ status: 200,
+ headers: {
+ 'content-type': 'image/png',
+ 'cache-control': 'public, max-age=31536000, s-maxage=31536000, no-transform, immutable',
+ 'cdn-cache-control': 'max-age=31536000',
+ },
+}
+
+export async function handler(req: Request) {
+ const url = new URL(req.url)
+ const site = url.searchParams.get('site')?.toLowerCase() ?? url.searchParams.get('amp;site')?.toLowerCase()
+ const icon = url.searchParams.get('icon')?.toLowerCase() ?? url.searchParams.get('amp;icon')?.toLowerCase()
+ const type = url.searchParams.get('type') ?? url.searchParams.get('amp;type')
+ const title = url.searchParams.get('title') ?? url.searchParams.get('amp;title')
+ const description = url.searchParams.get('description') ?? url.searchParams.get('amp;description')
+
+ if(!site || !title || !description) {
+ return new Response(JSON.stringify({ message: 'missing params' }), {
+ headers: { ...corsHeaders },
+ status: 404,
+ })
+ }
+
+ if (site === 'docs') {
+ return new ImageResponse(( <Docs title={title} description={description} type={type} icon={icon} /> ), { ...options })
+ }
+
+ return new Response(JSON.stringify({error: 'Internal server error'}), {
+ headers: { ...corsHeaders },
+ status: 500
+ })
+}
diff --git a/supabase/functions/og-images/index.ts b/supabase/functions/og-images/index.ts
new file mode 100644
index 00000000000..ebf53f34dce
--- /dev/null
+++ b/supabase/functions/og-images/index.ts
@@ -0,0 +1,4 @@
+import { serve } from 'https://deno.land/[email protected]/http/server.ts'
+import { handler } from './handler.tsx'
+
+serve(handler)
diff --git a/supabase/seed.sql b/supabase/seed.sql
new file mode 100644
index 00000000000..e69de29bb2d