Skip to content

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

docs: add smart regions docs (#39313)

Kang Ming1f245734aeed
diff --git a/apps/docs/components/RegionsList.tsx b/apps/docs/components/RegionsList.tsx
index 0f9826046b2..15f751bb1cc 100644
--- a/apps/docs/components/RegionsList.tsx
+++ b/apps/docs/components/RegionsList.tsx
@@ -1,4 +1,5 @@
import { AWS_REGIONS } from 'shared-data'
+import { SMART_REGION_TO_EXACT_REGION_MAP } from 'shared-data/regions'
export function RegionsList() {
return (
@@ -12,3 +13,15 @@ export function RegionsList() {
</ul>
)
}
+export function SmartRegionsList() {
+ return (
+ <ul>
+ {[...SMART_REGION_TO_EXACT_REGION_MAP.entries()].map(([smartRegion, exactRegion]) => (
+ <li key={smartRegion} className="flex flex-col gap-2">
+ <span className="w-fit !mt-0">{smartRegion}</span>
+ <code className="w-fit">{exactRegion}</code>
+ </li>
+ ))}
+ </ul>
+ )
+}
diff --git a/apps/docs/content/guides/platform/regions.mdx b/apps/docs/content/guides/platform/regions.mdx
index 5085bb72faa..594e3f80cbf 100644
--- a/apps/docs/content/guides/platform/regions.mdx
+++ b/apps/docs/content/guides/platform/regions.mdx
@@ -5,6 +5,14 @@ subtitle: Spin up Supabase projects in our global regions
The following regions are available for your Supabase projects.
+## Smart region selection
+
+Smart Region Selection is a feature that allows you to select from a list of broader regions. Optimizations are made to ensure that the selected region has compute capacity availability.
+
+<SmartRegionsList />
+
+Currently, smart region selection is not available for read replicas and project-related operations via the management API.
+
## AWS
<RegionsList />
diff --git a/apps/docs/features/docs/MdxBase.shared.tsx b/apps/docs/features/docs/MdxBase.shared.tsx
index 2e1fef8edc4..e332d72fd8a 100644
--- a/apps/docs/features/docs/MdxBase.shared.tsx
+++ b/apps/docs/features/docs/MdxBase.shared.tsx
@@ -18,7 +18,7 @@ import { NavData } from '~/components/NavData'
import { Price } from '~/components/Price'
import { ProjectConfigVariables } from '~/components/ProjectConfigVariables'
import { RealtimeLimitsEstimator } from '~/components/RealtimeLimitsEstimator'
-import { RegionsList } from '~/components/RegionsList'
+import { RegionsList, SmartRegionsList } from '~/components/RegionsList'
import { SharedData } from '~/components/SharedData'
import StepHikeCompact from '~/components/StepHikeCompact'
import { CodeSampleDummy, CodeSampleWrapper } from '~/features/directives/CodeSample.client'
@@ -60,6 +60,7 @@ const components = {
ProjectConfigVariables,
RealtimeLimitsEstimator,
RegionsList,
+ SmartRegionsList,
SharedData,
ShowUntil,
SqlToRest,
diff --git a/apps/docs/next-env.d.ts b/apps/docs/next-env.d.ts
new file mode 100644
index 00000000000..830fb594ca2
--- /dev/null
+++ b/apps/docs/next-env.d.ts
@@ -0,0 +1,6 @@
+/// <reference types="next" />
+/// <reference types="next/image-types/global" />
+/// <reference path="./.next/types/routes.d.ts" />
+
+// NOTE: This file should not be edited
+// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
diff --git a/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.ts b/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.ts
index 64060ffc0b7..1c2da89ce34 100644
--- a/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.ts
+++ b/apps/studio/components/interfaces/ProjectCreation/ProjectCreation.utils.ts
@@ -1,14 +1,9 @@
import type { CloudProvider, Region } from 'shared-data'
import { AWS_REGIONS, FLY_REGIONS } from 'shared-data'
-
-const smartRegionToExactRegionMap = new Map([
- ['Americas', 'East US (North Virginia)'],
- ['Europe', 'Central EU (Frankfurt)'],
- ['APAC', 'Southeast Asia (Singapore)'],
-])
+import { SMART_REGION_TO_EXACT_REGION_MAP } from 'shared-data/regions'
export function smartRegionToExactRegion(smartOrExactRegion: string) {
- return smartRegionToExactRegionMap.get(smartOrExactRegion) ?? smartOrExactRegion
+ return SMART_REGION_TO_EXACT_REGION_MAP.get(smartOrExactRegion) ?? smartOrExactRegion
}
export function getAvailableRegions(cloudProvider: CloudProvider): Region {
diff --git a/apps/studio/next-env.d.ts b/apps/studio/next-env.d.ts
new file mode 100644
index 00000000000..254b73c165d
--- /dev/null
+++ b/apps/studio/next-env.d.ts
@@ -0,0 +1,6 @@
+/// <reference types="next" />
+/// <reference types="next/image-types/global" />
+/// <reference path="./.next/types/routes.d.ts" />
+
+// NOTE: This file should not be edited
+// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.
diff --git a/packages/shared-data/regions.ts b/packages/shared-data/regions.ts
index 51d59e0d910..4eb43a4545b 100644
--- a/packages/shared-data/regions.ts
+++ b/packages/shared-data/regions.ts
@@ -77,3 +77,9 @@ export type AWS_REGIONS_KEYS = keyof typeof AWS_REGIONS
export const FLY_REGIONS = {
SOUTHEAST_ASIA: { code: 'sin', displayName: 'Singapore', location: [1.3521, 103.8198] },
} as const
+
+export const SMART_REGION_TO_EXACT_REGION_MAP = new Map([
+ ['Americas', 'East US (North Virginia)'],
+ ['Europe', 'Central EU (Frankfurt)'],
+ ['APAC', 'Southeast Asia (Singapore)'],
+])