import { CubeIcon } from '@heroicons/react/outline'
import { useBreakpoint } from 'common'
import { Check, Sparkles, Timer } from 'lucide-react'
import dynamic from 'next/dynamic'
import Link from 'next/link'
import { topTweets } from 'shared-data'
import { PRODUCT_SHORTNAMES } from 'shared-data/products'
import { Button, cn, IconDiscord } from 'ui'
import { Image } from 'ui-patterns/Image'
import MainProducts from '../MainProducts'
import {
FrameworkLink,
getEditors,
type FeaturesSection,
type HeroSection,
type Metadata,
} from './solutions.utils'
import { frameworks } from '@/components/Hero/HeroFrameworks'
import type { MPCSectionProps } from '@/components/Solutions/MPCSection'
import type { PlatformSectionProps } from '@/components/Solutions/PlatformSection'
import type { TwoColumnsSectionProps } from '@/components/Solutions/TwoColumnsSection'
import type { TwitterSocialSectionProps } from '@/components/TwitterSocialSection'
import { DASHBOARD_SIGN_UP_URL } from '@/lib/dashboard-links'
import { useSendTelemetryEvent } from '@/lib/telemetry'
const AuthVisual = dynamic(() => import('components/Products/AuthVisual'))
const ComputePricingCalculator = dynamic(
() => import('components/Pricing/ComputePricingCalculator')
)
const FunctionsVisual = dynamic(() => import('components/Products/FunctionsVisual'))
const RealtimeVisual = dynamic(() => import('components/Products/RealtimeVisual'))
const data: () => {
metadata: Metadata
heroSection: HeroSection
why: FeaturesSection
platform: PlatformSectionProps
twitterSocialSection: TwitterSocialSectionProps
platformStarterSection: TwoColumnsSectionProps
mcp: MPCSectionProps
} = () => {
const isXs = useBreakpoint(640)
const editors = getEditors(isXs)
const sendTelemetryEvent = useSendTelemetryEvent()
return {
metadata: {
metaTitle: 'Supabase for Beginners',
metaDescription:
'Supabase gives you the tools to easily manage databases, authentication, and backend infrastructure so you can build faster.',
},
heroSection: {
id: 'hero',
title: 'Supabase for Beginner Developers',
h1: (
<>
Build in a weekendScale to millions
>
),
subheader: [
<>
Learning to build a full-stack application is exciting. Supabase gives you the tools,
documentation, and community that makes managing databases, authentication, and backend
infrastructure a lot less overwhelming. Ship faster and learn by doing with Supabase.
>,
],
image: undefined,
ctas: [
{
label: 'Start your project',
href: DASHBOARD_SIGN_UP_URL,
type: 'primary' as any,
onClick: () =>
sendTelemetryEvent({
action: 'start_project_button_clicked',
properties: { buttonLocation: 'Solutions: Beginners page hero' },
}),
},
],
},
why: {
id: 'why-supabase',
label: '',
heading: (
<>
Why developers of all skill levels choose
Supabase
>
),
subheading:
'Supabase is the Postgres development platform that powers a new generation of developer tools. Give your users an integrated, scalable backend that lets them focus on building without worrying about infrastructure.',
features: [
{
id: 'get-to-market-faster',
icon: Timer,
heading: 'Instant backend',
subheading:
'Deploy a database in seconds. Choose your front-end framework and platform. Start coding and learning. With Supabase, batteries are always included.',
},
{
id: 'the-tools-you-need-at-a-great-price',
icon: CubeIcon,
heading: 'Everything you need to learn and build',
subheading:
'Supabase offers a fully integrated suite of tools including authentication, storage, edge functions, real-time subscriptions, and vector search. Use one or all.',
},
{
id: 'scalable-and-dependable',
icon: (props: any) => (
),
heading: 'Scalable and dependable',
subheading:
'Supabase is just Postgres, the world’s most popular and dependable database. When you’re ready to grow, Supabase will be there for you.',
},
],
},
platform: {
id: 'postgres-platform',
title: (
<>
Supabase helps you build
>
),
subheading:
'Supabase includes everything you need to create the perfect app for your brand, business, or just for fun.',
className: cn(
'[&_div.grid]:sm:divide-x [&_div.grid]:divide-y',
'[&_div.grid>div:nth-child(2n+2)]:sm:border-l-0!',
'[&_div.grid>div:nth-child(2n+2)]:lg:border-l!',
'[&_div.grid>div:nth-child(3n+3)]:lg:border-l-0!',
'[&_div.grid>div:nth-child(2)]:lg:border-t-0!'
),
features: [
{
id: 'database',
title: 'Database',
isDatabase: true,
icon: MainProducts[PRODUCT_SHORTNAMES.DATABASE].icon,
subheading: (
<>
A fully managed database that’s simple
for creators and{' '}
trusted by enterprises.
>
),
className: 'sm:col-span-2 flex-col lg:flex-row px-4 lg:pr-0',
image: (
),
},
],
},
twitterSocialSection: {
heading: 'Fun projects built with Supabase',
subheading: 'Discover what our community has to say about their Supabase experience.',
ctas: (
}>
sendTelemetryEvent({
action: 'homepage_discord_button_clicked',
})
}
>
Join us on Discord
),
tweets: topTweets,
},
platformStarterSection: {
id: 'platform-starter',
heading: (
<>
Choose your platform to start building in
seconds
>
),
headingRight: (
<>
Or, start with Supabase AI Prompts{' '}
>
),
docsUrl: 'https://supabase.com/docs/guides/ai-tools/ai-prompts',
leftFooter: (
{frameworks.map((framework) => (
))}
),
aiPrompts: [
{
id: 'auth-setup',
title: 'Bootstrap Next.js app with Supabase Auth',
code: `1. Install @supabase/supabase-js and @supabase/ssr packages.
2. Set up environment variables.
3. Write two utility functions with \u0060createClient\u0060 functions to create a browser client and a server client.
4. Hook up middleware to refresh auth tokens
`,
language: 'markdown',
docsUrl: 'https://supabase.com/docs/guides/ai-tools/ai-prompts/nextjs-supabase-auth',
},
{
id: 'edge-functions',
title: 'Writing Supabase Edge Functions',
code: `1. Try to use Web APIs and Deno’s core APIs instead of external dependencies (eg: use fetch instead of Axios, use WebSockets API instead of node-ws)
2. If you are reusing utility methods between Edge Functions, add them to 'supabase/functions/_shared' and import using a relative path. Do NOT have cross dependencies between Edge Functions.
3. Do NOT use bare specifiers when importing dependecnies. If you need to use an external dependency, make sure it's prefixed with either 'npm:' or 'jsr:'. For example, '@supabase/supabase-js' should be written as 'npm:@supabase/supabase-js'.
4. For external imports, always define a version. For example, 'npm:@express' should be written as 'npm:express@4.18.2'.
5. For external dependencies, importing via 'npm:' and 'jsr:' is preferred. Minimize the use of imports from @'deno.land/x' , 'esm.sh' and @'unpkg.com' . If you have a package from one of those CDNs, you can replace the CDN hostname with 'npm:' specifier.
`,
language: 'markdown',
docsUrl: 'https://supabase.com/docs/guides/ai-tools/ai-prompts/edge-functions',
},
{
id: 'declarative-db-schema',
title: 'Declarative Database Schema',
code: `Mandatory Instructions for Supabase Declarative Schema Management
## 1. **Exclusive Use of Declarative Schema**
-**All database schema modifications must be defined within '.sql' files located in the 'supabase/schemas/' directory.`,
language: 'markdown',
docsUrl:
'https://supabase.com/docs/guides/ai-tools/ai-prompts/declarative-database-schema',
},
{
id: 'rls-policies',
title: 'Create RLS policies',
code: `You're a Supabase Postgres expert in writing row level security policies. Your purpose is to generate a policy with the constraints given by the user. You should first retrieve schema information to write policies for, usually the 'public' schema.
The output should use the following instructions:
- The generated SQL must be valid SQL.`,
language: 'markdown',
docsUrl: 'https://supabase.com/docs/guides/ai-tools/ai-prompts/database-rls-policies',
},
],
},
mcp: {
id: 'mcp',
heading: (
Supabase MCP server works seamlessly with{' '}
your favorite AI code editor