From 973bacf783ca1d8cfb71cf9e25e25bb82f91e5f9 Mon Sep 17 00:00:00 2001 From: Copple <10214025+kiwicopple@users.noreply.github.com> Date: Wed, 11 Mar 2026 14:11:26 +0100 Subject: [PATCH] docs: Data API IA (#42417) *Summary* - reorganize the navigation menu to highlight modules, consolidate API security content, and move guide entries (auto-generated docs, type generation, security topics) to the intended sections - relocate the Data API hardening and custom claims RBAC guides into the API subtree, updating internal references and redirects, and fixing cross-links (including adjusting the Security reference order) - adjust data API topic references (e.g., securing guide and role management) to point to the new paths and ensure the helper link ordering follows the requested layout *Testing* - Not run (not requested) Change 1 image Change 2 image ## Summary by CodeRabbit * **Documentation** * Reorganized API documentation structure, consolidating REST and GraphQL API guides under a dedicated API section. * Moved security-related guides to API documentation paths for better organization. * Implemented automatic redirects for old documentation links to new locations. * Updated navigation menu to reflect the restructured documentation layout. --------- Co-authored-by: Chris Chinchilla Co-authored-by: Chris Chinchilla --- apps/docs/app/page.tsx | 14 +++- .../NavigationMenu.constants.ts | 78 ++++++++----------- apps/docs/content/guides/api.mdx | 4 +- ...ims-and-role-based-access-control-rbac.mdx | 0 .../{database => api}/hardening-data-api.mdx | 0 .../content/guides/api/securing-your-api.mdx | 2 +- .../guides/database/postgres/roles.mdx | 2 +- .../content/guides/database/secure-data.mdx | 2 +- .../guides/security/product-security.mdx | 4 +- .../guides/storage/schema/custom-roles.mdx | 2 +- .../database-api-42501-errors.mdx | 2 +- apps/www/lib/redirects.js | 10 +++ 12 files changed, 64 insertions(+), 56 deletions(-) rename apps/docs/content/guides/{database/postgres => api}/custom-claims-and-role-based-access-control-rbac.mdx (100%) rename apps/docs/content/guides/{database => api}/hardening-data-api.mdx (100%) diff --git a/apps/docs/app/page.tsx b/apps/docs/app/page.tsx index 2a5b592d32f..0c4b88aa9f6 100644 --- a/apps/docs/app/page.tsx +++ b/apps/docs/app/page.tsx @@ -98,6 +98,18 @@ const postgresIntegrations = [ href: '/guides/queues', description: 'Durable Message Queues with guaranteed delivery', }, + { + title: 'Data REST API', + icon: 'rest', + href: '/guides/api', + description: 'Access your database through a RESTful API.', + }, + { + title: 'GraphQL API', + icon: 'graphql', + href: '/guides/graphql', + description: 'Access your database through a GraphQL API.', + }, ] const selfHostingOptions = [ @@ -223,7 +235,7 @@ const HomePage = () => (

- Postgres Modules + Modules

diff --git a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts index 38cd600d0be..0bd637470b1 100644 --- a/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts +++ b/apps/docs/components/Navigation/NavigationMenu/NavigationMenu.constants.ts @@ -108,7 +108,13 @@ export const GLOBAL_MENU_ITEMS: GlobalMenuItems = [ }, ], [ - { label: 'Postgres Modules' }, + { label: 'Modules' }, + { + label: 'Data API (REST)', + icon: 'rest', + href: '/guides/api' as `/${string}`, + level: 'api', + }, { label: 'AI & Vectors', icon: 'ai', @@ -127,6 +133,12 @@ export const GLOBAL_MENU_ITEMS: GlobalMenuItems = [ href: '/guides/queues' as `/${string}`, level: 'queues', }, + { + label: 'GraphQL API', + icon: 'graphql', + href: '/guides/graphql' as `/${string}`, + level: 'graphql', + }, ], ], }, @@ -272,21 +284,6 @@ export const GLOBAL_MENU_ITEMS: GlobalMenuItems = [ level: 'ui', }, ], - [ - { label: 'Data API' }, - { - label: 'REST', - icon: 'rest', - href: '/guides/api' as `/${string}`, - level: 'api', - }, - { - label: 'GraphQL', - icon: 'graphql', - href: '/guides/graphql' as `/${string}`, - level: 'graphql', - }, - ], ], }, ], @@ -921,10 +918,6 @@ export const auth: NavMenuConstant = { name: 'Column Level Security', url: '/guides/database/postgres/column-level-security' as `/${string}`, }, - { - name: 'Custom Claims & RBAC', - url: '/guides/database/postgres/custom-claims-and-role-based-access-control-rbac' as `/${string}`, - }, ], }, ], @@ -1086,14 +1079,6 @@ export const database: NavMenuConstant = { name: 'Column Level Security', url: '/guides/database/postgres/column-level-security' as `/${string}`, }, - { - name: 'Hardening the Data API', - url: '/guides/database/hardening-data-api' as `/${string}`, - }, - { - name: 'Custom Claims & RBAC', - url: '/guides/database/postgres/custom-claims-and-role-based-access-control-rbac' as `/${string}`, - }, { name: 'Managing Postgres Roles', url: '/guides/database/postgres/roles' as `/${string}`, @@ -1471,7 +1456,7 @@ export const queues: NavMenuConstant = { export const api: NavMenuConstant = { icon: 'rest', - title: 'REST API', + title: 'Data REST API', url: '/guides/api', items: [ { name: 'Overview', url: '/guides/api', items: [] }, @@ -1482,32 +1467,33 @@ export const api: NavMenuConstant = { items: [], }, { - name: 'Auto-generated Docs', - url: '/guides/api/rest/auto-generated-docs', - items: [], - }, - { - name: 'Generating TypeScript Types', - url: '/guides/api/rest/generating-types', - items: [], - }, - { - name: 'Generating Python Types', - url: '/guides/api/rest/generating-python-types', - items: [], + name: 'Security', + url: '/guides/api', + items: [ + { name: 'How API Keys work', url: '/guides/api/api-keys' }, + { name: 'Securing your API', url: '/guides/api/securing-your-api' }, + { name: 'Hardening the Data API', url: '/guides/api/hardening-data-api' }, + { + name: 'Custom Claims & RBAC', + url: '/guides/api/custom-claims-and-role-based-access-control-rbac', + }, + ], }, { name: 'Tools', url: '/guides/api', - items: [{ name: 'SQL to REST API Translator', url: '/guides/api/sql-to-rest' }], + items: [ + { name: 'Auto-generated Docs', url: '/guides/api/rest/auto-generated-docs' }, + { name: 'SQL to REST API Translator', url: '/guides/api/sql-to-rest' }, + ], }, { name: 'Guides', url: '/guides/api', items: [ { name: 'Creating API routes', url: '/guides/api/creating-routes' }, - { name: 'How API Keys work', url: '/guides/api/api-keys' }, - { name: 'Securing your API', url: '/guides/api/securing-your-api' }, + { name: 'Generating TypeScript Types', url: '/guides/api/rest/generating-types' }, + { name: 'Generating Python Types', url: '/guides/api/rest/generating-python-types' }, { name: 'Error Codes', url: '/guides/api/rest/postgrest-error-codes' }, ], }, @@ -2471,7 +2457,7 @@ export const security: NavMenuConstant = { url: '/guides/deployment/shared-responsibility-model' as `/${string}`, }, { name: 'Row Level Security', url: '/guides/database/postgres/row-level-security' }, - { name: 'Hardening the Data API', url: '/guides/database/hardening-data-api' }, + { name: 'Hardening the Data API', url: '/guides/api/hardening-data-api' }, ], }, ], diff --git a/apps/docs/content/guides/api.mdx b/apps/docs/content/guides/api.mdx index 0f4c62d5743..1d6b41fc764 100644 --- a/apps/docs/content/guides/api.mdx +++ b/apps/docs/content/guides/api.mdx @@ -1,7 +1,7 @@ --- id: 'api' -title: 'REST API' -description: 'Auto-generating REST API.' +title: 'Data REST API' +description: 'Auto-generating data REST API.' sidebar_label: 'Overview' video: 'https://www.youtube.com/v/rPAJJFdtPw0' --- diff --git a/apps/docs/content/guides/database/postgres/custom-claims-and-role-based-access-control-rbac.mdx b/apps/docs/content/guides/api/custom-claims-and-role-based-access-control-rbac.mdx similarity index 100% rename from apps/docs/content/guides/database/postgres/custom-claims-and-role-based-access-control-rbac.mdx rename to apps/docs/content/guides/api/custom-claims-and-role-based-access-control-rbac.mdx diff --git a/apps/docs/content/guides/database/hardening-data-api.mdx b/apps/docs/content/guides/api/hardening-data-api.mdx similarity index 100% rename from apps/docs/content/guides/database/hardening-data-api.mdx rename to apps/docs/content/guides/api/hardening-data-api.mdx diff --git a/apps/docs/content/guides/api/securing-your-api.mdx b/apps/docs/content/guides/api/securing-your-api.mdx index 599d593223c..416476cf744 100644 --- a/apps/docs/content/guides/api/securing-your-api.mdx +++ b/apps/docs/content/guides/api/securing-your-api.mdx @@ -55,7 +55,7 @@ Any table **without RLS enabled** in the `public` schema will be accessible to t ## Disable the API or restrict to custom schema -If you don't use the Data API, or if you don't want to expose the `public` schema, you can either disable it entirely or change the automatically exposed schema to one of your choice. See **[Hardening the Data API](/docs/guides/database/hardening-data-api)** for instructions. +If you don't use the Data API, or if you don't want to expose the `public` schema, you can either disable it entirely or change the automatically exposed schema to one of your choice. See **[Hardening the Data API](/docs/guides/api/hardening-data-api)** for instructions. ## Enforce additional rules on each request diff --git a/apps/docs/content/guides/database/postgres/roles.mdx b/apps/docs/content/guides/database/postgres/roles.mdx index de7af27eb4d..e5271f84df9 100644 --- a/apps/docs/content/guides/database/postgres/roles.mdx +++ b/apps/docs/content/guides/database/postgres/roles.mdx @@ -5,7 +5,7 @@ description: 'Managing access to your Postgres database and configuring permissi subtitle: 'Managing access to your Postgres database and configuring permissions.' --- -Postgres manages database access permissions using the concept of roles. Generally you wouldn't use these roles for your own application - they are mostly for configuring _system access_ to your database. If you want to configure _application access_, then you should use [Row Level Security](/docs/guides/database/postgres/row-level-security) (RLS). You can also implement [Role-based Access Control](/docs/guides/database/postgres/custom-claims-and-role-based-access-control-rbac) on top of RLS. +Postgres manages database access permissions using the concept of roles. Generally you wouldn't use these roles for your own application - they are mostly for configuring _system access_ to your database. If you want to configure _application access_, then you should use [Row Level Security](/docs/guides/database/postgres/row-level-security) (RLS). You can also implement [Role-based Access Control](/docs/guides/api/custom-claims-and-role-based-access-control-rbac) on top of RLS. ## Users vs roles diff --git a/apps/docs/content/guides/database/secure-data.mdx b/apps/docs/content/guides/database/secure-data.mdx index e42a13b2d9b..3ddd3adef16 100644 --- a/apps/docs/content/guides/database/secure-data.mdx +++ b/apps/docs/content/guides/database/secure-data.mdx @@ -28,6 +28,6 @@ Supabase and Postgres provide you with multiple ways to manage security, includi - [Row Level Security](/docs/guides/database/postgres/row-level-security) - [Column Level Security](/docs/guides/database/postgres/column-level-security) -- [Hardening the Data API](/docs/guides/database/hardening-data-api) +- [Hardening the Data API](/docs/guides/api/hardening-data-api) - [Managing Postgres roles](/docs/guides/database/postgres/roles) - [Managing secrets with Vault](/docs/guides/database/vault) diff --git a/apps/docs/content/guides/security/product-security.mdx b/apps/docs/content/guides/security/product-security.mdx index 2c46fe215b4..f400d93829e 100644 --- a/apps/docs/content/guides/security/product-security.mdx +++ b/apps/docs/content/guides/security/product-security.mdx @@ -19,9 +19,9 @@ Various products at Supabase have their own hardening and configuration guides, - [Row Level Security](/docs/guides/database/postgres/row-level-security) - [Column Level Security](/docs/guides/database/postgres/column-level-security) -- [Hardening the Data API](/docs/guides/database/hardening-data-api) +- [Hardening the Data API](/docs/guides/api/hardening-data-api) - [Additional security controls for the Data API](/docs/guides/api/securing-your-api) -- [Custom claims and role based access control](/docs/guides/database/postgres/custom-claims-and-role-based-access-control-rbac) +- [Custom claims and role based access control](/docs/guides/api/custom-claims-and-role-based-access-control-rbac) - [Managing Postgres roles](/docs/guides/database/postgres/roles) - [Managing secrets with Vault](/docs/guides/database/vault) - [Superuser access and unsupported operations](docs/guides/database/postgres/roles-superuser) diff --git a/apps/docs/content/guides/storage/schema/custom-roles.mdx b/apps/docs/content/guides/storage/schema/custom-roles.mdx index 9af072af00e..bcc5447a490 100644 --- a/apps/docs/content/guides/storage/schema/custom-roles.mdx +++ b/apps/docs/content/guides/storage/schema/custom-roles.mdx @@ -12,7 +12,7 @@ Supabase Storage uses the same role-based access control system as any other Sup ## Create a custom role -Let's create a custom role `manager` to provide full read access to a specific bucket. For a more advanced setup, see the [RBAC Guide](/docs/guides/auth/custom-claims-and-role-based-access-control-rbac#create-auth-hook-to-apply-user-role). +Let's create a custom role `manager` to provide full read access to a specific bucket. For a more advanced setup, see the [RBAC Guide](/docs/guides/api/custom-claims-and-role-based-access-control-rbac#create-auth-hook-to-apply-user-role). ```sql create role 'manager'; diff --git a/apps/docs/content/troubleshooting/database-api-42501-errors.mdx b/apps/docs/content/troubleshooting/database-api-42501-errors.mdx index f45c755ab26..8251081019b 100644 --- a/apps/docs/content/troubleshooting/database-api-42501-errors.mdx +++ b/apps/docs/content/troubleshooting/database-api-42501-errors.mdx @@ -75,7 +75,7 @@ grant select, insert, update, delete on table public.your_table to anon, authent Granting privileges allows access to your table through the Data API, so you should ensure you [enable RLS](/docs/guides/database/postgres/row-level-security) and write appropriate policies to protect your data. -For more information, see [Adjusting table-level privileges](/docs/guides/database/hardening-data-api#adjusting-table-level-privileges). +For more information, see [Adjusting table-level privileges](/docs/guides/api/hardening-data-api#adjusting-table-level-privileges). diff --git a/apps/www/lib/redirects.js b/apps/www/lib/redirects.js index c8b408a4923..d7efc39d349 100644 --- a/apps/www/lib/redirects.js +++ b/apps/www/lib/redirects.js @@ -4,6 +4,16 @@ module.exports = [ source: '/auth/Auth', destination: '/auth', }, + { + permanent: true, + source: '/docs/guides/database/hardening-data-api', + destination: '/docs/guides/api/hardening-data-api', + }, + { + permanent: true, + source: '/docs/guides/database/postgres/custom-claims-and-role-based-access-control-rbac', + destination: '/docs/guides/api/custom-claims-and-role-based-access-control-rbac', + }, { permanent: true, source: '/docs/guides/platform/compute-add-ons',