Commit Graph

51 Commits

Author SHA1 Message Date
Jeremias Menichelli
575ac8c645 [DOCS-979] feat(Docs): Generate new markdown files for reference pages (#46727)
In this PR:
- The `llms.ts` script is removed from the pipeline. It was just
iterating over the sections of the SDK JSON files to generate _dummy_
text files for LLMS to consume. But with a lot of inconsistencies and
mistakes.
- There's a new script that builds markdown files from the SDK
definition files.
- The Management API now has a definition file too, it was missing
before.
- On the www project now there are redirects for the reference text
files to the new markdown files in the docs project.
- NPM scripts have received better names so that prebuild ones are
smaller and all are easier to differentiate.
2026-06-09 10:39:55 +02:00
Jeremias Menichelli
f20cd22dc3 docs: improve SDK automation build step on docs (#46163)
# Second try of making a new better process for SDK automation

Instead of building a new pipeline. We will take the lessons learned
form round 1, plus the good design and improvement on DX quality for
drop-in file as a single step required from SDK team and produce almost
identical set of files as used right now to render using the current
pipeline.



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* New reference-content pipeline producing per-library reference
artifacts and integrating into prebuilds, search ingestion, and
rendering (type-aware examples).

* **Documentation**
* Added comprehensive JavaScript SDK v2 reference content and partials
(Auth MFA, passkeys, admin, TypeScript support, filters, modifiers,
Installing, Initializing, Buckets, etc.).

* **Tests & CI**
* Added regression snapshot test and updated workflows to refresh
reference snapshots and ensure spec downloads.

* **Chores**
* Updated ignore rules, build scripts, Makefile targets, and package
lifecycle hooks.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Katerina Skroumpelou <mandarini@users.noreply.github.com>
Co-authored-by: Katerina Skroumpelou <sk.katherine@gmail.com>
2026-06-03 11:46:02 +03:00
Greg Richardson
b539cc0529 feat(docs): return page suggestions in markdown 404 pages (#45439)
Markdown guides (`/docs/guides/**/*.md`) that 404 currently return a
text/plain `Not found` response. Since agents often hallucinate URL
paths, this PR proactively provides page suggestions so that agents can
find the page they are looking forward without further guessing. It uses
the docs Content API to fetch related pages, similar to the [HTML 404
page](https://supabase.com/docs/404):

```
# 404 - Page Not Found

The page `/docs/guides/mcp.md` does not exist.

## You might be looking for...

- [Model context protocol (MCP)](https://supabase.com/docs/guides/getting-started/mcp.md)
- [Building an MCP Server with mcp-lite](https://supabase.com/docs/guides/functions/examples/mcp-server-mcp-lite.md)
- [Model Context Protocol (MCP) Authentication](https://supabase.com/docs/guides/auth/oauth-server/mcp-authentication.md)
- [Deploy MCP servers](https://supabase.com/docs/guides/getting-started/byo-mcp.md)
- [Enabling MCP Server Access](https://supabase.com/docs/guides/self-hosting/enable-mcp.md)

See also: [Changelog](https://supabase.com/changelog.md)
```

## How to test
1. Use curl to fetch a non-existent page with an `.md` extension:

   ```shell
curl -i
https://docs-git-docs-markdown-404-suggestions-supabase.vercel.app/docs/guides/mcp.md
   ```

Confirm that relevant pages are suggested (ballpark - our search algo
needs some improvement). Also confirm that the response has content type
`text/markdown`.

2. Use curl to fetch a non-existent page using the `Accept:
text/markdown` header


   ```shell
   curl -i -H 'Accept: text/markdown' \

https://docs-git-docs-markdown-404-suggestions-supabase.vercel.app/docs/guides/mcp
   ```

    And confirm the same result as 1.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
* 404 pages for missing guides now return a formatted Markdown response
with proper content-type and no-cache headers, and include up to five
related documentation suggestions to help users find relevant content.

* **Chores**
* Build environment now preserves an additional hosting URL variable to
improve build/task consistency.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-05-05 08:40:44 +02:00
Jeremias Menichelli
04d08fbba7 fix(Docs): Add cache-control and default to HTML content (#43989) 2026-03-19 19:45:15 +01:00
Jeremias Menichelli
8b4bf646fc feat(Docs): Add copy as markdown and AI tools to guide (#43355) 2026-03-04 16:31:02 +01:00
supabase-supabase-autofixer[bot]
720c00e4e0 docs: update js sdk docs (2.95.3) (#42557)
Updates JS sdk documentation following stable release. 
Ran `make` in apps/docs/spec to regenerate tsdoc files.

**Details:**
- **Version:** `2.95.3`
- **Source:** `supabase-js-stable-release`
- **Changes:** Regenerated tsdoc files from latest spec files

🤖 Auto-generated from @supabase/supabase-js stable release.

---------

Co-authored-by: supabase-releaser[bot] <223506987+supabase-releaser[bot]@users.noreply.github.com>
Co-authored-by: Katerina Skroumpelou <sk.katherine@gmail.com>
2026-02-10 12:05:20 +00:00
Ivan Vasilov
e41a3f4fb3 chore: Bump payload vulnerability (#42609)
This PR
- reverts changes made in
https://github.com/supabase/supabase/pull/42568 and
https://github.com/supabase/supabase/pull/42570 because they had some
unneeded changes (`@types/node` bumped to v25+, for example)
- bumps only the vulnerable dependency (which is in `cms` app and it's
not currently used).

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Chores**
  * Adjusted CMS dependencies to earlier versions
  * Optimized documentation API code organization and type handling

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-02-09 15:26:47 +01:00
Ali Waseem
28443251ff fix: updated deployments with unbroken pnpm (#42570)
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

Update lock file changes

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Refactor**
* Reorganized internal imports and improved type compatibility handling
for the AI documentation API to ensure robust operation across different
OpenAI client versions.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-02-06 20:59:45 +00:00
Charis
c740f5ade0 feat(docs): content api allow get requests for caching (#41443)
Content API requests were all accepted via POST (as detailed in the
GraphQL spec) and not amenable to caching.

Now, requests are also accepted via GET (as optionally allowed for query
requests only), and cached.

Also sent the request method to Logflare so we can track the ratio of
GET/POST requests.
2025-12-17 11:46:02 -05:00
Ivan Vasilov
051d31ef07 chore: Bump Typescript to 5.9 (#38945)
* Move typescript version definition to pnpm-workspace.

* Bump typescript to 5.9.

* Minor fixes to satisfy the compiler.

---------

Co-authored-by: Raúl Barroso <code@raulb.dev>
2025-09-23 16:50:54 +02:00
Charis
283b125369 fix: failing type errors in build (#38761)
* fix(www): types for awaited params

* fix(docs): no extraneous exports from route page

* fix(studio): api handler types, no non-handlers allowed in pages
2025-09-17 15:55:38 +10:00
Charis
8cd5e10038 feat: alternate search index for nimbus (#38662)
* feat: alternate search index for nimbus

Create an alternate search index for Nimbus that filters out
feature-flagged pages (equivalent to setting all feature flags to
false).

Notes:
- Creates two new DB tables, `page_nimbus` and `page_section_nimbus`,
  which are filtered versions of `page` and `page_section`
- Makes `nimbus` versions of all the DB search functions
- Refactored the embedding upload script. Changes to make it faster (got
  annoyed by how slow it was when testing...), incorporate retries, and
  produce better summary logs.
- Upload script, when run with the environment variable
  ENABLED_FEATURES_OVERRIDE_DISABLE_ALL, produces and uploads the
  alternate search index
- Changed all the search calls in frontend/API to check for
  `isFeatureEnabled('search:fullIndex')` to determine whether to search
  the full or alternate index

* ci: produce nimbus search indexes on merge

* fix: turn full search index on
2025-09-16 12:37:53 -04:00
Charis
e46ab9c1a2 refactor: reading markdown docs files (#37774)
* refactor: reading markdown docs files

Refactor how Markdown docs files are read:
- Reuses the same logic across search index generation & page generation
- Improves the indexed content for search:
  - Stops removing MDX components, which often contain useful
    information like Admonitions
  - Denormalizes Partials and CodeSamples for more complete content

This is a prerequisite step for implementing the "Copy docs as Markdown"
functionality.

Only touches regular guides for now, not federated ones.

* fix: tailwind build error (#37728)

We changed to default to ESM imports a while ago, which means local
builds are now breaking because the Tailwind uses a require. Changed to
CJS for Tailwind config file. (I have no idea how this has been working
on Vercel all this time.)

* style: prettier
2025-08-13 11:37:14 -04:00
Charis
0c0be801ae chore(docs): add logflare logging (#37310) 2025-07-31 15:10:37 -04:00
Charis
ce14f305ac feat: hybrid search (#37127)
Implement hybrid search for the /docs/api/graphql searchDocs endpoint. Prepend a more descriptive title and introduction to database advisor docs so they rank more highly when directly searched for.
2025-07-14 16:29:01 -04:00
Charis
677e6a8b08 o11y(docs): more descriptive errors (#36892)
Provide more descriptive error messages when fetching a collection fails
so it's easier to debug in Sentry
2025-07-04 20:44:16 +00:00
Charis
d122f289df feat(api gateway logs): add error code explanation (#36315)
Add the ability to look up error code explanation in API Gateway logs.
Also a bunch of GraphQL-related utilities and generated types for
calling the Content API.
2025-06-24 13:18:12 -04:00
Charis
68cb1a1870 feat(content api): add management api references to semantic search (#36289)
* docs: add cursor rule for embedding generation process

Add documentation for cursor IDE about how docs embeddings are generated,
including the workflow for creating and uploading semantic search content.

* feat: improve API reference metadata upload with descriptive content

- Add preembeddings script to run codegen before embedding generation
- Enhance OpenApiReferenceSource to generate more descriptive content including
  parameters, responses, path information, and better structured documentation

* feat: add Management API references to searchDocs GraphQL query

- Add ManagementApiReference GraphQL type and model for API endpoint search results
- Integrate Management API references into global search results
- Update test snapshots and add comprehensive test coverage for Management API search

* style: format
2025-06-18 09:12:03 -04:00
Charis
0c04c17bdf fix(docs): sentry errors do not get sent from vercel edge (#36377)
Sentry errors captured on routes run on Edge are not getting properly
sent. This is apparently a known issue where Vercel closes the process
before Sentry can flush, so the exceptions need to be manually flushed:

https://github.com/getsentry/sentry-javascript/issues/9626
2025-06-17 12:49:09 -04:00
Charis
b95c759f25 fix(content api): restrict vercel edge function regions (#36405) 2025-06-16 09:19:38 -04:00
Charis
fba3f7bd45 feat(docs): add error code filtering to GraphQL errors endpoint (#36284)
- Add support for filtering errors by specific error codes
- Implement `errors` query that accepts array of error code IDs
- Add tests for error code filtering functionality
- Update GraphQL schema with new error filtering capabilities
2025-06-10 10:55:19 -04:00
Charis
4e916fc16a feat(graphql): add paginated errors collection query (#36149)
* feat(graphql): add paginated errors collection query

- Add new GraphQL query field 'errors' with cursor-based pagination

- Add UUID id column to content.error table for cursor pagination

- Implement error collection resolver with forward/backward pagination

- Add comprehensive test suite for pagination functionality

- Update database types and schema to support new error collection

- Add utility functions for handling collection queries and errors

- Add seed data for testing pagination scenarios

This change allows clients to efficiently paginate through error codes using cursor-based pagination, supporting both forward and backward traversal. The implementation follows the Relay connection specification and includes proper error handling and type safety.

* docs(graphql): add comprehensive GraphQL architecture documentation

Add detailed documentation for the docs GraphQL endpoint architecture, including:
- Modular query pattern and folder structure
- Step-by-step guide for creating new top-level queries
- Best practices for error handling, field optimization, and testing
- Code examples for schemas, models, resolvers, and tests

* feat(graphql): add service filtering to errors collection query

Enable filtering error codes by Supabase service in the GraphQL errors collection:
- Add optional service argument to errors query resolver
- Update error model to support service-based filtering in database queries
- Maintain pagination compatibility with service filtering
- Add comprehensive tests for service filtering with and without pagination

* feat(graphql): add service filtering and fix cursor encoding for errors collection

- Add service parameter to errors GraphQL query for filtering by Supabase service
- Implement base64 encoding/decoding for pagination cursors in error resolver
- Fix test cursor encoding to match resolver implementation
- Update GraphQL schema snapshot to reflect new service filter field

* docs(graphql): fix codegen instruction
2025-06-09 10:24:17 -04:00
Charis
3158807579 ci(docs): sync script (#36001)
Add a script for syncing error codes from the repo to the database. This
is part of the newly created rootSync script, where all sync scripts
should be moved eventually.
2025-06-05 12:28:45 -04:00
Charis
cf3ecc93eb chore(docs): turn on strictNullChecks (#36180)
strictNullChecks was off for docs, which lets errors slip through and
leads to incorrect required/optional typing on Zod-inferred types. This
PR enables strictNullChecks and fixes all the existing violations.
2025-06-04 17:05:37 -04:00
Charis
aba0095bd7 feat(content api): add error endpoint (#35941)
* feat(content api): add error endpoint

Add an endpoint to return the details of a Supabase error, given the
error code and service.

Schema additions:

```graphql
type RootQueryType {
  "...previous root queries"

  """Get the details of an error code returned from a Supabase service"""
  error(code: String!, service: Service!): Error
}

"""An error returned by a Supabase service"""
type Error {
  """
  The unique code identifying the error. The code is stable, and can be used for string matching during error handling.
  """
  code: String!

  """The Supabase service that returns this error."""
  service: Service!

  """The HTTP status code returned with this error."""
  httpStatusCode: Int

  """
  A human-readable message describing the error. The message is not stable, and should not be used for string matching during error handling. Use the code instead.
  """
  message: String
}

enum Service {
  AUTH
  REALTIME
  STORAGE
}
```

* test(content api): add tests for top-level query `error`
2025-05-29 15:39:47 -04:00
Charis
8aea2cd6c7 seo(docs): canonical links for reference pages (#35977)
To avoid content duplication warnings, direct all canonical links for
reference pages to the newest library version.
2025-05-28 10:51:32 -04:00
Charis
bf3bada7fd test: run supabase locally during test (#35947)
Alter the docs test script so it spins up Supabase locally. Will allow
for end-to-end tests against the local DB.

Also small alteration to one of the test files to silence an annoying
(but intended) error.
2025-05-27 10:00:21 -04:00
Charis
b5921d10cf chore(content api): reduce max depth (#35530)
Reduce max depth for validation from 9 to 5 because we foresee no
legitimate queries that will require anything so deep.
2025-05-20 19:52:32 -04:00
Charis
ffceb79fd6 chore(docs): add sentry monitoring (#35529) 2025-05-20 22:57:34 +00:00
Charis
959f5a4575 fix(content api): bug with returning edges (#35783)
There was a bug when returning edges because it wasn't accounted for
when getting the requested fields info.

Added test cases to catch this.
2025-05-20 15:51:14 -04:00
Charis
ac04e0ddfc test(content api): add prod smoke tests for searchDocs (#35528) 2025-05-20 11:43:14 -04:00
Charis
6ba23ac7c9 fix(docs): crawlers page generation for pages with mdx components (#35629)
# Before

Crawlers pages that used MDX components with defined attributes errored.
Example: /docs/reference/kotlin/installing

# After

The pages do not error.
2025-05-13 09:24:21 -04:00
Ivan Vasilov
0cb08341f6 chore: Bump nextjs for the docs app (#35333)
* Bump all versions of postcss to 8.5.3.

* Run next/codemod on the docs app.

* Move two experimental flags into stable. Add next-mdx-remote as a transpiled package.

* Add extra folders to the clean command in docs.

* Fix type errors in docs test.

* Run prettier on the new files.

* remove turbopack, fix fetch revalidation, fix metadata awaits

Couple of minor fixes:
- Turbopack doesn't work in dev because of known MDX loader limitations
(cannot load functions in MDX plugin config)
- Fetches not cached by default anymore in Next 15 so need to manually
cache the ones we need
- Missing a few awaits for metadata generation with page params

* Bump the graphiql version because headlessui/react is not building with Next 15.

---------

Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com>
2025-05-08 09:27:22 +00:00
Charis
03dcd51700 feat(content api): search result for cli reference (#35488)
## Before

Search results ignored if they are CLI references.

## After

Search results returned for CLI references.
2025-05-06 19:23:40 -04:00
Charis
f57cde2cea feat(content api): add troubleshooting guide search results (#35487) 2025-05-06 19:07:44 -04:00
Charis
badcf17f70 feat(content api): add client library api reference search results (#35484)
* feat(content api): add client library api reference search results

Allow searchDocs results to also return function references from the
client library APIs

* fix(content api): refine language enum handling
2025-05-06 13:11:29 -04:00
Charis
df4b1867b8 feat (content api): add global search query (#35290)
Add a top-level field to search docs globally. Right now this only
returns Markdown guides (not references, GitHub discussions, or partner
pages.

The full GraphQL schema at this point:

```
schema {
  query: RootQueryType
}

type RootQueryType {
  """Get the GraphQL schema for this endpoint"""
  schema: String!

  """Search the Supabase docs for content matching a query string"""
  searchDocs(query: String!, limit: Int): SearchResultCollection
}

"""A collection of search results containing content from Supabase docs"""
type SearchResultCollection {
  """A list of edges containing nodes in this collection"""
  edges: [SearchResultEdge!]!

  """The nodes in this collection, directly accessible"""
  nodes: [SearchResult!]!

  """The total count of items available in this collection"""
  totalCount: Int!
}

"""An edge in a collection of SearchResults"""
type SearchResultEdge {
  """The SearchResult at the end of the edge"""
  node: SearchResult!
}

"""Document that matches a search query"""
interface SearchResult {
  """The title of the matching result"""
  title: String

  """The URL of the matching result"""
  href: String

  """The full content of the matching result"""
  content: String
}
```

Towards DOCS-214
2025-05-05 14:32:10 -04:00
Charis
bf71606db8 refactor (content api): helper classes for errors (#35288)
Splitting out a PR with some helper classes for error handling that will be used
donwnstream.
2025-05-05 14:03:42 -04:00
Charis
9e8107c070 fix (content api): local dev introspection (#35279)
* feat (content api): add top-level schema query

Adds a top-level schema query that returns the stringified GraphQL
schema for this endpoint. Useful for LLMs to access the stringified
schema for prompting and tool calls.

Query shape:

```
query Search {
  schema
}
```

Query response:

```
{
  "data": {
    "schema": "schema {\n  query: RootQueryType\n}\n\ntype RootQueryType
{\n  \"\"\"Get the GraphQL schema for this endpoint\"\"\"\n  schema:
String\n}"
  }
}
```

Towards DOCS-214

* test (content api): add schema snapshot

Add schema snapshot test to prevent unintentional changes to public API
for this endpoint

* fixup! feat (content api): add top-level schema query

* fix (content api): local dev introspection

The validation rules that are used for security in production are
preventing GraphiQL from introspecting the schema in dev. Since this DX
feature is incredibly useful, I'm turning off the complexity and depth
validations for dev GraphiQL only. Local curls, etc., will still have
production-standard validation so it can be tested locally.
2025-04-29 16:00:34 -04:00
Charis
ca1cd24a07 fix (content api): return graphql-spec compliant error (#35202)
GraphQL errors were occasionally returned as normal HTTP status code
errors, switched to using only GraphQL-spec compliant errors for the
/docs/api/graphql endpoint.
2025-04-29 15:51:07 -04:00
Charis
e41d90926b feat (content api): graphql validation (#35191)
Continue building out the docs/api/graphql endpoint by adding more
validation:

-A query depth limiter
- A query complexity limiter

Also added dummy (empty) root resolver and schema, plus a dev-only
GraphiQL page for better DX.

Endpoint should still return a 404 for now as there is no resolver.
2025-04-29 15:27:21 -04:00
Charis
a0f5c798df feat(content api): add dummy api/graphql route (#35141)
The first PR in a series to build out the Content API. Adds a dummy
GraphQL route with some tests: for now all this does is validate the
request body and return a 404.
2025-04-29 13:02:36 -04:00
Charis
9d9fdcd9fc feat (docs): on-demand revalidation for graphql and wrappers (#35177)
Before:

Revalidation was turned off entirely for wrappers pages, and done daily for GraphQL pages.

After:

Revalidation is via tag. There is an /api/revalidate endpoint that is used by GitHub Actions on the federated repos to trigger the revalidation. This decreases the number of unnecessary page generations by Vercel, and gives the maintainers of federated repos more fine-grained control over when to reploy their docs (see the docs deployment playbook for more info).
2025-04-24 14:59:38 -04:00
Charis
39a12342ea fix (docs): middleware rewrites for reference pages (#35201)
Before:

There was a bug with middleware rewrites for reference pages without
crawler versions (basically all references except the client SDKs).
There was a branch that was not handled (the requesting user agent is a
a bot, but the reference is not a client SDK), so it failed through to
the base case of NextResponse.next(), which 404s as that page does not
exist for a path like /reference/api/v1-deploy-a-function

After:

Fixed the branch. If all of the following are true:

- Is a reference page
- Requesting user agent is a bot
- Reference is not a client SDK

Then it should follow the same path as a non-bot request, because there
is no bot-specific version. That means it should be rewritten to teh
slugless page: /reference/api/v1-deploya-function => /reference/api
2025-04-22 10:14:02 -04:00
Charis
3f08a033d9 fix: autofix action (#30421)
Autofix action is failing with error message:

```
fatal: You are not currently on a branch.
To push the history leading to the current (detached HEAD)
state now, use

    git push origin HEAD:<name-of-remote-branch>
```

This is because the checkout action on a PR by default checks out the merge commit, which is not a branch. Instead, check out [`github.head_ref`](https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#github-context), which will point to the source of the PR.

---------

Co-authored-by: github-tidy-bot <github-tidy-bot@supabase.com>
2024-11-11 16:18:42 -05:00
Charis
762c52b2f1 fix(docs): error handling in revalidate api (#29402) 2024-09-20 12:14:54 -04:00
Charis
dfda9da26d feat(docs): add revalidation api route (#29378)
Add a route for manually revalidating cache contents by tag.

The route is protected by authentication to prevent abuse. Automated
actions in CI should be set up with a basic API key, which has a rate
limit of 6 hours between changes. Overriding is possible with an
override key, which should be used as an escape hatch.

Usage:
- API key provided in header `Authorization: Bearer <KEY>`
- Body has shape `{ tags: string[] }`
2024-09-19 14:28:07 -04:00
Charis
5d2bdc9efb refactor(docs): move last pages over to app router (#29293)
The end of the Great Migration is here!!!

Moves the last pages over, deleting pages like the FAQ that we don't use
and that contain duplicated information anyway.

Dev secret auth page URL had to change as App Router doesn't like the
leading underscores in the path.

Also fixes the not-found recommendations to use the proper Next.js
not-found page so it will return a 404 as it should. (I was under the
erroneous impression that I couldn't get the pathname in not-found.tsx,
that is not true, so this works better.)
2024-09-13 13:28:15 -04:00
Charis
84a8fa7ac3 refactor(docs): migrate cli reference to app router (#29117) 2024-09-06 09:22:25 -04:00
Charis
e67c219120 fix(docs): api crawler routes (#28614) 2024-08-14 12:16:02 -04:00