## Summary - Re-apply the Algolia docs search migration after the previous PR was merged and reverted. - Keep the existing Fumadocs search UI while using Algolia API when search keys are configured, with `/api/search` fallback for local development and tests. - Add a first-party Algolia index builder/sync script that creates section-sized docs records from MDX/OpenAPI/toolkit/changelog content, configures index relevance settings, and replaces index objects without relying on Algolia Crawler. - Add Algolia Insights view/click events and a terminal search relevance test script. - Clean search breadcrumbs so results show labels like `Toolkit` and `Cookbook` instead of duplicated `toolkits > Gmail` formatting. ## Tests - `cd docs && bun run types:check` - `cd docs && bun run sync:search --dry-run` - `cd docs && bunx eslint components/custom-search-dialog.tsx lib/search-index.ts scripts/sync-algolia-search.ts scripts/test-algolia-search.ts` ## Notes - Live Algolia sync requires `ALGOLIA_ADMIN_API_KEY`. - Live search relevance tests require `ALGOLIA_SEARCH_API_KEY` or `NEXT_PUBLIC_ALGOLIA_SEARCH_API_KEY`.
2.9 KiB
Composio Docs
Documentation site for Composio, built with Fumadocs.
Getting Started
bun install
bun run dev
Open http://localhost:3000.
Project Structure
docs/
├── app/ # Next.js app router
├── content/ # MDX content
│ ├── docs/
│ ├── examples/
│ ├── changelog/
│ └── reference/
├── components/ # React components
├── lib/ # Utilities
└── public/ # Static assets
Adding Content
Create an .mdx file in content/, add frontmatter, then add to meta.json:
---
title: Page Title
description: Brief description
---
Content here...
Components
<Tabs items={['Python', 'TypeScript']}>
<Tab value="Python">...</Tab>
<Tab value="TypeScript">...</Tab>
</Tabs>
<Callout type="info">Note</Callout>
<Cards>
<Card title="Title" href="/path" />
</Cards>
Sidebar
Each folder has meta.json for ordering:
{
"pages": ["page-one", "page-two"]
}
TypeScript Code Blocks
All TypeScript code blocks in MDX files are type-checked at build time using Twoslash. This ensures docs stay in sync with the SDK.
- Use
// @noErrorsto skip checking for partial snippets - Use
// ---cut---to hide setup code from output - Run
bun run buildlocally to validate before pushing
See CLAUDE.md for detailed patterns and troubleshooting.
Search
Docs search uses Algolia when NEXT_PUBLIC_ALGOLIA_SEARCH_API_KEY is set; otherwise it falls back to the local Fumadocs /api/search endpoint for development and tests. The sync script builds a first-party index from MDX/OpenAPI/toolkit data (no crawler required), splits long pages into section-sized records, configures searchable attributes/custom ranking/distinct, requests clickAnalytics, and sends search result view/click events with search-insights.
NEXT_PUBLIC_ALGOLIA_APP_ID=62HI9PQZ1L # optional; default shown
NEXT_PUBLIC_ALGOLIA_SEARCH_API_KEY=...
NEXT_PUBLIC_ALGOLIA_INDEX_NAME=docs_composio_dev_62hi9pqz1l_pages # optional; default shown
Sync the Algolia index with an admin key:
ALGOLIA_APP_ID=62HI9PQZ1L
ALGOLIA_ADMIN_API_KEY=...
ALGOLIA_INDEX_NAME=docs_composio_dev_62hi9pqz1l_pages bun run sync:search
Preview the generated records or test live relevance:
bun run sync:search --dry-run --samples
ALGOLIA_SEARCH_API_KEY=... bun run test:search "oauth auth config" "gmail send email"
Commands
| Command | Description |
|---|---|
bun run dev |
Dev server |
bun run build |
Production build (validates TS code blocks) |
bun run types:check |
Type check |
bun run sync:search |
Sync docs search records to Algolia |
bun run test:search |
Query the configured Algolia index from the terminal |