Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/studio-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ permissions:
jobs:
test:
# Uses larger hosted runner as it significantly decreases build times
runs-on:
group: Default Larger Runners
runs-on: ubuntu-latest
strategy:
matrix:
test_number: [1]
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/typecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ permissions:
jobs:
typecheck:
# Uses larger hosted runner as it significantly decreases build times
runs-on:
group: Default Larger Runners
runs-on: ubuntu-latest

steps:
- name: Checkout
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/app/contributing/content.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -354,11 +354,11 @@ Some guides and tutorials will require that users copy their Supabase project UR

```mdx
<ProjectConfigVariables variable="url" />
<ProjectConfigVariables variable="anonKey" />
<ProjectConfigVariables variable="publishableKey" />
```

<ProjectConfigVariables variable="url" />
<ProjectConfigVariables variable="anonKey" />
<ProjectConfigVariables variable="publishableKey" />

### Step Hike

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ function VariableView({ variable, className }: { variable: Variable; className?:
const hasBranches = selectedProject?.is_branch_enabled ?? false
const ref = hasBranches ? selectedBranch?.project_ref : selectedProject?.ref

const needsApiQuery = variable === 'anonKey' || variable === 'url'
const needsApiQuery = variable === 'publishableKey' || variable === 'url'
const needsSupavisorQuery = variable === 'sessionPooler'

const {
Expand Down Expand Up @@ -303,7 +303,7 @@ function VariableView({ variable, className }: { variable: Variable; className?:
switch (variable) {
case 'url':
return !apiData.app_config?.endpoint
case 'anonKey':
case 'publishableKey':
return !apiData.service_api_keys?.some((key) => key.tags === 'anon')
}
}
Expand Down Expand Up @@ -336,7 +336,7 @@ function VariableView({ variable, className }: { variable: Variable; className?:
case 'url':
variableValue = `https://${apiData?.app_config?.endpoint}`
break
case 'anonKey':
case 'publishableKey':
variableValue = apiData?.service_api_keys?.find((key) => key.tags === 'anon')?.api_key || ''
break
case 'sessionPooler':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export type Org = OrganizationsData[number]
export type Project = ProjectsData[number]
export type Branch = BranchesData[number]

export type Variable = 'url' | 'anonKey' | 'sessionPooler'
export type Variable = 'url' | 'publishableKey' | 'sessionPooler'

function removeDoubleQuotes(str: string) {
return str.replaceAll('"', '')
Expand All @@ -30,7 +30,7 @@ function unescapeDoubleQuotes(str: string) {

export const prettyFormatVariable: Record<Variable, string> = {
url: 'Project URL',
anonKey: 'Anon key',
publishableKey: 'Publishable key',
sessionPooler: 'Connection string (pooler session mode)',
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pnpm add @supabase/ssr @supabase/supabase-js
In your environment variables file, set your Supabase URL and Supabase Anon Key:

<ProjectConfigVariables variable="url" />
<ProjectConfigVariables variable="anonKey" />
<ProjectConfigVariables variable="publishableKey" />

<Tabs scrollable size="small" type="underlined" defaultActiveId="nextjs" queryGroup="framework">

Expand Down
4 changes: 2 additions & 2 deletions apps/docs/content/guides/auth/server-side/nextjs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Create a `.env.local` file in your project root directory.
Fill in your `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`:

<ProjectConfigVariables variable="url" />
<ProjectConfigVariables variable="anonKey" />
<ProjectConfigVariables variable="publishableKey" />

</StepHikeCompact.Details>

Expand Down Expand Up @@ -560,7 +560,7 @@ Create a `.env.local` file in your project root directory.
Fill in your `NEXT_PUBLIC_SUPABASE_URL` and `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY`:

<ProjectConfigVariables variable="url" />
<ProjectConfigVariables variable="anonKey" />
<ProjectConfigVariables variable="publishableKey" />

</StepHikeCompact.Details>

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/guides/auth/server-side/sveltekit.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Create a `.env.local` file in your project root directory.
Fill in your `PUBLIC_SUPABASE_URL` and `PUBLIC_SUPABASE_PUBLISHABLE_KEY`:

<ProjectConfigVariables variable="url" />
<ProjectConfigVariables variable="anonKey" />
<ProjectConfigVariables variable="publishableKey" />

</StepHikeCompact.Details>

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/guides/functions/auth.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { createClient } from 'npm:@supabase/supabase-js@2'
Deno.serve(async (req: Request) => {
const supabaseClient = createClient(
Deno.env.get('SUPABASE_URL') ?? '',
Deno.env.get('SUPABASE_PUBLISHABLE_KEY') ?? '',
Deno.env.get('SUPABASE_ANON_KEY') ?? '',
// Create client with Auth context of the user that called the function.
// This way your row-level-security (RLS) policies are applied.
{
Expand Down
4 changes: 2 additions & 2 deletions apps/docs/content/guides/functions/secrets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ subtitle: 'Manage sensitive data securely across environments.'
Edge Functions have access to these secrets by default:

- `SUPABASE_URL`: The API gateway for your Supabase project
- `SUPABASE_PUBLISHABLE_KEY`: The `publishable` key for your Supabase API. This is safe to use in a browser when you have Row Level Security enabled
- `SUPABASE_ANON_KEY`: The `anon` key for your Supabase API. This is safe to use in a browser when you have Row Level Security enabled
- `SUPABASE_SERVICE_ROLE_KEY`: The `service_role` key for your Supabase API. This is safe to use in Edge Functions, but it should NEVER be used in a browser. This key will bypass Row Level Security
- `SUPABASE_DB_URL`: The URL for your Postgres database. You can use this to connect directly to your database

Expand All @@ -32,7 +32,7 @@ import { createClient } from 'npm:@supabase/supabase-js@2'
// For user-facing operations (respects RLS)
const supabase = createClient(
Deno.env.get('SUPABASE_URL')!,
Deno.env.get('SUPABASE_PUBLISHABLE_KEY')!
Deno.env.get('SUPABASE_ANON_KEY')!
)

// For admin operations (bypasses RLS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ hideToc: true
Open `lib/main.dart` and edit the main function to initialize Supabase using your project URL and public API (anon) key:

<ProjectConfigVariables variable="url" />
<ProjectConfigVariables variable="anonKey" />
<ProjectConfigVariables variable="publishableKey" />

</StepHikeCompact.Details>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ hideToc: true
Lastly, [enable anonymous sign-ins](https://supabase.com/dashboard/project/_/settings/auth) in the Auth settings.

<ProjectConfigVariables variable="url" />
<ProjectConfigVariables variable="anonKey" />
<ProjectConfigVariables variable="publishableKey" />

</StepHikeCompact.Details>
<StepHikeCompact.Code>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ hideToc: true
Create a new `Supabase.swift` file add a new Supabase instance using your project URL and public API (anon) key:

<ProjectConfigVariables variable="url" />
<ProjectConfigVariables variable="anonKey" />
<ProjectConfigVariables variable="publishableKey" />

</StepHikeCompact.Details>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ hideToc: true
Replace the `supabaseUrl` and `supabaseKey` with your own:

<ProjectConfigVariables variable="url" />
<ProjectConfigVariables variable="anonKey" />
<ProjectConfigVariables variable="publishableKey" />

</StepHikeCompact.Details>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ hideToc: true
Rename `.env.example` to `.env.local` and populate with your Supabase connection variables:

<ProjectConfigVariables variable="url" />
<ProjectConfigVariables variable="anonKey" />
<ProjectConfigVariables variable="publishableKey" />

</StepHikeCompact.Details>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ hideToc: true
Create a `.env` file and populate with your Supabase connection variables:

<ProjectConfigVariables variable="url" />
<ProjectConfigVariables variable="anonKey" />
<ProjectConfigVariables variable="publishableKey" />

</StepHikeCompact.Details>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ hideToc: true
Create a `.env.local` file and populate with your Supabase connection variables:

<ProjectConfigVariables variable="url" />
<ProjectConfigVariables variable="anonKey" />
<ProjectConfigVariables variable="publishableKey" />

</StepHikeCompact.Details>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ hideToc: true
You now have to update the `supabaseClient` with the `SUPABASE_URL` and `SUPABASE_KEY` of your Supabase API. The `supabaseClient` is used in auth provider and data provider methods that allow the refine app to connect to your Supabase backend.

<ProjectConfigVariables variable="url" />
<ProjectConfigVariables variable="anonKey" />
<ProjectConfigVariables variable="publishableKey" />

</StepHikeCompact.Details>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ hideToc: true
Create a `.env.local` file and populate with your Supabase connection variables:

<ProjectConfigVariables variable="url" />
<ProjectConfigVariables variable="anonKey" />
<ProjectConfigVariables variable="publishableKey" />

</StepHikeCompact.Details>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ hideToc: true
Create a `.env` file at the root of your project and populate with your Supabase connection variables:

<ProjectConfigVariables variable="url" />
<ProjectConfigVariables variable="anonKey" />
<ProjectConfigVariables variable="publishableKey" />

</StepHikeCompact.Details>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ hideToc: true
Create a `.env.local` file and populate with your Supabase connection variables:

<ProjectConfigVariables variable="url" />
<ProjectConfigVariables variable="anonKey" />
<ProjectConfigVariables variable="publishableKey" />

</StepHikeCompact.Details>

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/content/guides/telemetry/log-drains.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Create a HTTP drain under the [Project Settings > Log Drains](https://supabase.c
- Under URL, set it to your edge function URL `https://[PROJECT REF].supabase.co/functions/v1/hello-world`
- Under Headers, set the `Authorization: Bearer [ANON KEY]`

<ProjectConfigVariables variable="anonKey" />
<ProjectConfigVariables variable="publishableKey" />

</AccordionItem>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { DiskAttributesData } from 'data/config/disk-attributes-query'
import { DesiredInstanceSize, instanceSizeSpecs } from 'data/projects/new-project.constants'
import {
DISK_LIMITS,
DISK_PRICING,
DiskType,
PLAN_DETAILS,
} from '../DiskManagement/ui/DiskManagement.constants'

// Ref: https://supabase.com/docs/guides/platform/compute-and-disk
const maxDiskForCompute = new Map([
[10, instanceSizeSpecs.micro],
[50, instanceSizeSpecs.small],
[100, instanceSizeSpecs.medium],
[200, instanceSizeSpecs.large],
[500, instanceSizeSpecs.xlarge],
[1_000, instanceSizeSpecs['2xlarge']],
[2_000, instanceSizeSpecs['4xlarge']],
[4_000, instanceSizeSpecs['8xlarge']],
[6_000, instanceSizeSpecs['12xlarge']],
[10_000, instanceSizeSpecs['16xlarge']],
])

export const estimateComputeSize = (
projectDiskSize: number,
branchComputeSize?: DesiredInstanceSize
) => {
if (branchComputeSize) {
return instanceSizeSpecs[branchComputeSize]
}
// Fallback to estimating based on volume size
for (const [disk, compute] of maxDiskForCompute) {
if (projectDiskSize <= disk) {
return compute
}
}
return instanceSizeSpecs['24xlarge']
}

export const estimateDiskCost = (disk: DiskAttributesData['attributes']) => {
const diskType = disk.type as DiskType

const pricing = DISK_PRICING[diskType]
const includedGB = PLAN_DETAILS['pro'].includedDiskGB[diskType]
const priceSize = Math.max(disk.size_gb - includedGB, 0) * pricing.storage
const includedIOPS = DISK_LIMITS[diskType].includedIops
const priceIOPS = Math.max(disk.iops - includedIOPS, 0) * pricing.iops

const priceThroughput =
diskType === DiskType.GP3 && 'throughput_mbps' in disk
? Math.max(disk.throughput_mbps - DISK_LIMITS[DiskType.GP3].includedThroughput, 0) *
DISK_PRICING[DiskType.GP3].throughput
: 0

return {
total: priceSize + priceIOPS + priceThroughput,
size: priceSize,
iops: priceIOPS,
throughput: priceThroughput,
}
}

export const estimateRestoreTime = (disk: DiskAttributesData['attributes']) => {
// This is interpolated from real restore time
return (720 / 21000) * disk.size_gb + 3
}
Loading
Loading