Commit Graph

8 Commits

Author SHA1 Message Date
Alaister Young cb34acd45c [GROWTH-773] chore(www): serve llms.txt content via API routes (#44897)
The docs build had a fragile implicit dependency on www's filesystem
(`../../../apps/www/public/llms`), flagged by the docs team in #44670.
Rather than formalising that dependency with a shared package, this PR
eliminates it entirely by making www the sole owner of llms content
assembly.

**How it works now:**

`/llms/[slug]` handles all `/llms/*.txt` requests via a 3-step cascade:
1. Dynamic content — `pricing.txt` generated at request time from
`shared-data` imports
2. Local file — product overviews read from `data/llms/`
3. Docs proxy — reference docs (guides, js, dart, etc.) fetched from the
docs app

No hardcoded slug lists, so adding new content just works.

**What changed:**

- `apps/docs/scripts/llms.ts` trimmed to only generate per-source
reference files — www now owns `llms.txt`, `llms-full.txt`, and product
overviews
- Removed `generateLlmsPricing.mjs` build script — pricing generated
dynamically from `shared-data`
- Removed llms rewrites from `rewrites.js` — routes handle everything
with consistent `Cache-Control: public, s-maxage=3600,
stale-while-revalidate=86400`
- Product overview `.txt` files moved from `public/llms/` → `data/llms/`
so all requests go through routes for consistent caching

**Docs team concerns from GROWTH-773:**

| Concern | Resolution |
|---------|-----------|
| Docs build depends on www files at a fragile relative path | Path
removed — docs no longer reads from www |
| www restructuring breaks docs with no obvious connection | Eliminated
— no cross-app filesystem dependency |
| No build order enforcement between www and docs | Not needed — docs
doesn't depend on www's build output |

## To test

- `curl <preview>/llms.txt` — markdown index with doc + product overview
links
- `curl <preview>/llms-full.txt` — combined product overviews + docs
content
- `curl <preview>/llms/pricing.txt` — dynamically generated pricing
tables
- `curl <preview>/llms/auth.txt` — product overview from local file
- `curl <preview>/llms/guides.txt` — proxied from docs app
- `curl <preview>/llms/nonexistent.txt` — 404
- Verify `Cache-Control` header on all responses

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-04-15 22:45:01 +09:00
Pamela Chia 2a9555d459 feat(docs,www): make supabase.com machine-readable for LLM agents (#44670)
## Summary

Makes supabase.com machine-readable for LLM agents and AI crawlers. Adds
a combined `llms-full.txt` (product overview + docs), curated product
overview `.txt` files, auto-generated pricing content, and updates the
`llms.txt` index to reference everything.

**Why:** supabase.com had `llms.txt` pointing to per-SDK doc files, but
no `llms-full.txt` (every competitor has one), no machine-readable
marketing content, and no pricing data agents could parse. Agents
evaluating Supabase got docs but no product overview or pricing, leading
to inaccurate comparisons.

## What's new

### `llms-full.txt` (auto-generated, combines www + docs)
- Product Overview section (~500 lines): homepage, all 6 products,
pricing
- Documentation section (~122K lines): guides, SDK references, CLI
reference
- 4.4MB total, regenerated on every docs deploy
- Reads product `.txt` files from `apps/www/public/llms/` at build time

### Product overview `.txt` files (`apps/www/public/llms/`)
- Curated summaries: homepage, database, auth, storage, edge functions,
realtime, vector
- `pricing.txt` is auto-generated from `packages/shared-data` (plans,
pricing, compute add-ons) via `generateLlmsPricing.mjs`, includes full
feature comparison matrix
- Other product files are hand-maintained (these pages change ~1x/year
per git history)
- Reminder comments added to all 7 marketing page source files

### `llms.txt` index (auto-generated)
- Two sections: Documentation (existing SDK/guide links) and Product
Overview (marketing page links)
- Links to `llms-full.txt` for bulk ingestion

### Rewrite changes
- Added `/llms-full.txt` rewrite to docs app
- Scoped `/llms/*.txt` wildcard to only match docs source slugs (guides,
js, dart, etc.), so marketing `.txt` files in `www/public/llms/` are
served directly

## Changes

- `apps/docs/scripts/llms.ts`: generate `llms-full.txt` combining www
product content + docs, update `llms.txt` index with marketing links
- `apps/www/lib/rewrites.js`: add `llms-full.txt` rewrite, scope docs
proxy to known slugs
- `apps/www/public/llms/*.txt`: 8 product overview files (7
hand-curated, 1 auto-generated)
- `apps/www/scripts/generateLlmsPricing.mjs`: build script generating
pricing.txt from shared-data; uses `getPlanValue()` guard in
`buildAddOnsSection` and `buildFeatureComparisonSection` to handle
missing plan keys defensively
- `apps/www/package.json`: add pricing generation to content:build
- `apps/www/pages/*.tsx`: reminder comments for LLM content updates

## Testing

Tested locally:
- [x] `pnpm run build:llms` generates combined `llms-full.txt` (4.4MB)
with Product Overview + Documentation sections
- [x] `llms.txt` index has Documentation + Product Overview sections
with `llms-full.txt` reference
- [x] `pricing.txt` auto-generated from shared-data with correct plan
tiers, compute add-ons, disk pricing, and feature comparison
- [x] Scoped rewrite regex matches docs slugs but not marketing slugs
- [x] Marketing `.txt` files served from `public/`

Post-deploy verification:
- [ ] `curl https://supabase.com/llms-full.txt` returns combined product
+ docs content
- [ ] `curl https://supabase.com/llms/database.txt` returns product
overview (not proxied to docs)
- [ ] `curl https://supabase.com/llms/guides.txt` still proxies to docs
app
- [ ] `curl https://supabase.com/llms/pricing.txt` returns
auto-generated pricing

## Maintenance

| Content | Auto-updates? | Trigger |
|---------|--------------|---------|
| `llms-full.txt` | Yes | Every docs deploy |
| `llms.txt` index | Yes | Every docs deploy |
| `pricing.txt` | Yes | Every www build (reads from shared-data) |
| Product `.txt` files (7) | No | ~1x/year, reminder comments in source
pages |

## Linear

- fixes GROWTH-758

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

* **Documentation**
* Added comprehensive AI-friendly product overviews (Auth, Database,
Edge Functions, Realtime, Storage, Vector) and a detailed pricing
document with plan comparisons, add-ons, disk tiers, and feature tables
* Added a consolidated "full" markdown output that combines curated
product overview content with per-source documentation

* **Chores**
* Build now generates the richer documentation outputs and pricing
automatically
* Improved routing so only scoped documentation .txt assets are proxied
while others are served directly
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-04-15 00:48:35 +09:00
Charis f9ea453fc6 feat(docs): make page title customizable via feature flag (#39415) 2025-10-10 10:21:09 -04:00
Charis ec66a5d096 fix: hide hidden pages from llms.txt (#38533)
Pages that are disabled in navigation/site rendering are still shown in
llms.txt. This change filters those pages out of the llms.txt build as
well.

Co-authored-by: Chris Chinchilla <chris.ward@supabase.io>
2025-09-09 10:47:27 -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 f58eead769 chore(docs): clean up environment variables (#36036)
Our environment variables are a bit of a mess, so cleaning them up:

- We have duplicate environment variables that resolve to the same thing
but just have different names, deduplicating all of these
- We have a .env.development (for publicly safe variables) and a
.env.example, we
really only need one
- Privately, we have a .env (for running scripts) and a .env.local (for
Next.js). Changing the dotenv source for scripts, so again we only need
one
2025-05-29 16:35:26 -04:00
Charis 33b9e1ed29 chore(docs): convert all scripts to esm (#35996)
Scripts currently use CJS, which is causing a bit of a mess when trying
to use shared utilities from the app. Converting everything to ESM so
there are fewer conflicts when adding new scripts going forward.
2025-05-29 15:44:55 -04:00
Charis 46a0e80a10 feat: llms.txt (#33780)
* feat: llms.txt

* feat: split llms.txt into multiple files

We have too many docs, so the concatenated text file uses an unreasonable amount of tokens. Chunk it up a little so it's more usable.
2025-02-24 15:18:51 -05:00