Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
docs: SEO improvements - OG images, robots.txt, and CLAUDE.md restructure (#2478)
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Sushmitha Mallesh committed
Jan 27, 2026 at 23:29 UTC
48f2698337c4b87741dcffff076dcdac492dfc75
24 files changed
+501
-150
docs/.claude/context/fumadocs.md
new
+74
@@ -0,0 +1,74 @@
1
+# Fumadocs Framework
2
+
3
+Composio docs is built with [Fumadocs](https://fumadocs.dev/), a Next.js-based documentation framework.
4
+
5
+## Key Files
6
+
7
+| File | Purpose |
8
+|------|---------|
9
+| `source.config.ts` | MDX collections and schema definitions |
10
+| `lib/source.ts` | Source loaders and utility functions |
11
+| `app/(home)/layout.tsx` | Home layout with navigation |
12
+| `app/docs/layout.tsx` | Docs layout with sidebar |
13
+| `app/global.css` | All custom styles and design tokens |
14
+| `mdx-components.tsx` | MDX component registration |
15
+
16
+## Design Tokens
17
+
18
+```css
19
+--composio-orange: #ea580c /* Brand accent color */
20
+--composio-sidebar: #f7f5f2 /* Light sidebar */
21
+--composio-sidebar: #252220 /* Dark sidebar */
22
+--font-sans: 'Inter' /* Body text */
23
+--font-mono: 'IBM Plex Mono' /* Code blocks */
24
+```
25
+
26
+## Content Structure
27
+
28
+```
29
+content/
30
+├── docs/ # Main documentation
31
+├── examples/ # Example guides
32
+├── changelog/ # Release notes
33
+└── reference/ # SDK & API reference
34
+```
35
+
36
+## MDX Components
37
+
38
+Available globally without imports:
39
+
40
+- `Tabs`, `Tab`, `TabsList`, `TabsTrigger`, `TabsContent`
41
+- `Accordion`, `Accordions`
42
+- `Callout`
43
+- `Step`, `Steps`
44
+- `Card`, `Cards`
45
+- `ProviderCard`, `ProviderGrid`
46
+- `FrameworkSelector`, `QuickstartFlow`, `FrameworkOption`
47
+- `IntegrationTabs`, `IntegrationContent`
48
+- `ToolTypeFlow`, `ToolTypeOption`
49
+- `Figure`, `Video`
50
+- `CapabilityCard`, `CapabilityList`
51
+- `ToolkitsLanding`
52
+- `StepTitle`
53
+- Lucide icons: `ShieldCheck`, `RouteIcon`, `Key`, `Wrench`, `Database`, `Zap`, `Rocket`, `Code`, `Blocks`, `Plug`, `Play`, `Terminal`, `Palette`, `BookOpen`
54
+
55
+## Deployment
56
+
57
+- **Platform**: Vercel
58
+- **Project**: `composio/docs`
59
+- **Root directory**: `docs` (monorepo subfolder)
60
+- **Build**: `bun install` and `bun run build`
61
+
62
+## Common Gotchas
63
+
64
+1. **CSS variables**: Use `var(--composio-orange)` not `var(--orange)`. Check `global.css` for defined variables.
65
+
66
+2. **Date format**: Changelog dates must be YYYY-MM-DD format (validated in schema and runtime).
67
+
68
+3. **Toolkits data**: `public/data/toolkits.json` must exist - errors are thrown, not silently ignored.
69
+
70
+4. **Root directory on Vercel**: Set to `docs` with "Include files outside root directory" DISABLED.
71
+
72
+5. **Mobile nav**: Always test CSS changes on mobile. Fumadocs uses different nav patterns (dropdown on mobile, horizontal on desktop). Avoid absolute positioning or pseudo-elements that assume horizontal layout.
73
+
74
+6. **Twoslash in dev**: Twoslash is disabled in `bun dev` due to heap memory issues. Run `bun run build` locally to catch type errors. See `.claude/context/twoslash.md`.
docs/.claude/context/sdk-reference.md
new
+25
@@ -0,0 +1,25 @@
1
+# SDK Reference Documentation
2
+
3
+Auto-generated SDK documentation from source code.
4
+
5
+## TypeScript SDK
6
+
7
+| Item | Path |
8
+|------|------|
9
+| Source | `ts/packages/core/src/models/*.ts` (JSDoc comments) |
10
+| Generator | `ts/packages/core/scripts/generate-docs.ts` |
11
+| Output | `content/reference/sdk-reference/typescript/` |
12
+| Regenerate | `pnpm --filter @composio/core generate:docs` |
13
+
14
+## Python SDK
15
+
16
+| Item | Path |
17
+|------|------|
18
+| Source | `python/composio/**/*.py` (docstrings) |
19
+| Generator | `python/scripts/generate-docs.py` (uses griffe) |
20
+| Output | `content/reference/sdk-reference/python/` |
21
+| Regenerate | `cd python && uv run --with griffe python scripts/generate-docs.py` |
22
+
23
+## CI Integration
24
+
25
+CI auto-generates on changes to `ts/packages/core/src/**` or `python/composio/**` via `.github/workflows/generate-sdk-docs.yml`.
docs/.claude/context/twoslash.md
new
+103
@@ -0,0 +1,103 @@
1
+# Twoslash - TypeScript Code Block Type Checking
2
+
3
+**ALL TypeScript code blocks are type-checked at build time.** This ensures documentation stays in sync with the SDK.
4
+
5
+> **Note**: This only validates TypeScript (`ts`, `typescript`, `tsx`) code blocks. Python code blocks are NOT type-checked.
6
+
7
+## Key Features
8
+
9
+- **Default on**: All TypeScript blocks are validated. No annotation needed.
10
+- **Build-time validation**: Type errors fail the build.
11
+- **CI enforcement**: `.github/workflows/docs-typescript-check.yml` runs on PRs to docs/
12
+- **Disabled in dev**: Twoslash is disabled during `bun dev` to prevent heap memory issues. It only runs during `bun run build` / CI.
13
+
14
+## Exclusions
15
+
16
+- **Reference docs** (`/content/reference/`): Excluded from Twoslash via collection-level `mdxOptions` in `source.config.ts`. These are auto-generated and don't need type checking.
17
+
18
+## Common Patterns
19
+
20
+### Basic snippet with setup code (hidden from output)
21
+
22
+````md
23
+```typescript
24
+import { Composio } from '@composio/core';
25
+const composio = new Composio({ apiKey: 'key' });
26
+const userId = 'user_123';
27
+// ---cut---
28
+// Only code below this line is shown in docs
29
+const tools = await composio.tools.get(userId, { toolkits: ['GITHUB'] });
30
+```
31
+````
32
+
33
+### Using SDK-exported types for callbacks
34
+
35
+The SDK exports types for modifiers - use them instead of inline type annotations:
36
+
37
+````md
38
+```typescript
39
+import { Composio, TransformToolSchemaModifier } from '@composio/core';
40
+
41
+const modifySchema: TransformToolSchemaModifier = ({ toolSlug, toolkitSlug, schema }) => {
42
+ // TypeScript infers all parameter types!
43
+ return schema;
44
+};
45
+```
46
+````
47
+
48
+Available modifier types from `@composio/core`:
49
+- `beforeExecuteModifier` - for `beforeExecute` callbacks
50
+- `afterExecuteModifier` - for `afterExecute` callbacks
51
+- `TransformToolSchemaModifier` - for `modifySchema` callbacks
52
+
53
+### Skip type checking (for partial snippets or external deps)
54
+
55
+````md
56
+```typescript
57
+// @noErrors
58
+import { SomeExternalThing } from 'not-installed-package';
59
+```
60
+````
61
+
62
+### Declare external variables in hidden section
63
+
64
+When code uses variables that aren't defined in the snippet, declare them before the cut:
65
+
66
+````md
67
+```typescript
68
+import { Composio } from '@composio/core';
69
+
70
+declare const composio: Composio;
71
+declare const userId: string;
72
+// ---cut---
73
+const tools = await composio.tools.get(userId, { toolkits: ['GITHUB'] });
74
+```
75
+````
76
+
77
+## Annotations
78
+
79
+| Annotation | Purpose |
80
+|------------|---------|
81
+| `// ---cut---` | Hide code above from output (but include for compilation) |
82
+| `// @noErrors` | Skip all type checking for this block |
83
+| `// @errors: 2322` | Expect specific error code (won't fail build) |
84
+| `// ^?` | Show type on hover at that position |
85
+
86
+## Configuration
87
+
88
+- **Config**: `source.config.ts` - `transformerTwoslash({ explicitTrigger: false })`
89
+- **SDK packages**: Installed as devDependencies for import resolution
90
+- **Reference exclusion**: Uses `applyMdxPreset` with custom `rehypeCodeOptions` (no twoslash transformer)
91
+
92
+## Troubleshooting
93
+
94
+| Problem | Solution |
95
+|---------|----------|
96
+| Import fails | Ensure the package is in `devDependencies` |
97
+| External dependency | Use `// @noErrors` for examples with packages not in package.json |
98
+| Setup code needed | Use `// ---cut---` to add imports/declarations that compile but aren't shown |
99
+| Error code 2304 | "Cannot find name" - declare the variable in hidden section |
100
+| Error code 2322 | Type mismatch - fix the types or use SDK-exported types |
101
+| Callback types | Prefer importing SDK types over inline `{ foo: string }` annotations |
102
+
103
+Always run `bun run build` locally to validate all code blocks before pushing.
docs/.claude/guides/changelog.md
renamed
docs/.gitignore
+3
@@ -25,3 +25,6 @@ yarn-error.log*
25
.vercel
26
next-env.d.ts
27
next-env.d.ts.cache
28
+
29
+# Claude local settings (permissions are user-specific)
30
+.claude/settings.local.json
docs/CLAUDE.md
+56
-131
@@ -1,134 +1,59 @@
1
-# Fumadocs - Composio Documentation
2
-
3
-## Project Overview
4
-This is the Composio documentation site built with Fumadocs (Next.js-based docs framework).
5
-
6
-## Key Files
7
-- `app/global.css` - All custom styles and design tokens
8
-- `source.config.ts` - MDX collections and schema definitions
9
-- `lib/source.ts` - Source loaders and utility functions
10
-- `app/(home)/layout.tsx` - Home layout with navigation
11
-- `app/docs/layout.tsx` - Docs layout with sidebar
12
-
13
-## Design Tokens
14
-- `--composio-orange: #ea580c` - Brand accent color
15
-- `--composio-sidebar: #f7f5f2` (light) / `#252220` (dark)
16
-- `--font-sans: 'Inter'` - Body text
17
-- `--font-mono: 'IBM Plex Mono'` - Code blocks
18
-
19
-## SDK Reference Docs
20
-Auto-generated SDK documentation from source code.
21
-
22
-### TypeScript SDK
23
-- **Source**: `ts/packages/core/src/models/*.ts` (JSDoc comments)
24
-- **Generator**: `ts/packages/core/scripts/generate-docs.ts`
25
-- **Output**: `content/reference/sdk-reference/typescript/`
26
-- **Regenerate**: `pnpm --filter @composio/core generate:docs`
27
-
28
-### Python SDK
29
-- **Source**: `python/composio/**/*.py` (docstrings)
30
-- **Generator**: `python/scripts/generate-docs.py` (uses griffe)
31
-- **Output**: `content/reference/sdk-reference/python/`
32
-- **Regenerate**: `cd python && uv run --with griffe python scripts/generate-docs.py`
33
-
34
-CI auto-generates on changes to `ts/packages/core/src/**` or `python/composio/**` via `.github/workflows/generate-sdk-docs.yml`.
35
-
36
-## Common Gotchas
37
-1. **CSS variables**: Use `var(--composio-orange)` not `var(--orange)`. Check `global.css` for defined variables.
38
-2. **Date format**: Changelog dates must be YYYY-MM-DD format (validated in schema and runtime)
39
-3. **Toolkits data**: `public/data/toolkits.json` must exist - errors are thrown, not silently ignored
40
-4. **Root directory on Vercel**: Set to `docs` with "Include files outside root directory" DISABLED
41
-5. **Mobile nav**: Always test CSS changes on mobile. Fumadocs uses different nav patterns (dropdown on mobile, horizontal on desktop). Avoid absolute positioning or pseudo-elements that assume horizontal layout.
42
-6. **Twoslash in dev**: Twoslash is disabled in `bun dev` due to heap memory issues (loads full TypeScript compiler). Type checking only runs during `bun run build`. Run build locally to catch type errors before pushing.
43
-
44
-## Twoslash - TypeScript Code Block Type Checking
45
-
46
-**ALL TypeScript code blocks are type-checked at build time.** This ensures documentation stays in sync with the SDK.
47
-
48
-> **Note**: This only validates TypeScript (`ts`, `typescript`, `tsx`) code blocks. Python code blocks are NOT type-checked.
49
-
50
-### Key features
51
-- **Default on**: All TypeScript blocks are validated. No annotation needed.
52
-- **Build-time validation**: Type errors fail the build.
53
-- **CI enforcement**: `.github/workflows/docs-typescript-check.yml` runs on PRs to docs/
54
-- **Disabled in dev**: Twoslash is disabled during `bun dev` to prevent heap memory issues. It only runs during `bun run build` / CI.
55
-
56
-### Exclusions
57
-- **Reference docs** (`/content/reference/`): Excluded from Twoslash via collection-level `mdxOptions` in `source.config.ts`. These are auto-generated and don't need type checking.
58
-
59
-### Common patterns
60
-
61
-**Basic snippet with setup code (hidden from output):**
62
-````md
63
-```typescript
64
-import { Composio } from '@composio/core';
65
-const composio = new Composio({ apiKey: 'key' });
66
-const userId = 'user_123';
67
-// ---cut---
68
-// Only code below this line is shown in docs
69
-const tools = await composio.tools.get(userId, { toolkits: ['GITHUB'] });
70
-```
71
-````
72
-
73
-**Using SDK-exported types for callbacks:**
74
-The SDK exports types for modifiers - use them instead of inline type annotations:
75
-````md
76
-```typescript
77
-import { Composio, TransformToolSchemaModifier } from '@composio/core';
78
-
79
-const modifySchema: TransformToolSchemaModifier = ({ toolSlug, toolkitSlug, schema }) => {
80
- // TypeScript infers all parameter types!
81
- return schema;
82
-};
1
+# Composio Documentation
2
+
3
+Documentation site for Composio, built with [Fumadocs](https://fumadocs.dev/).
4
+
5
+## Quick Reference
6
+
7
+```bash
8
+bun install # Install dependencies
9
+bun run dev # Dev server (http://localhost:3000)
10
+bun run build # Production build (validates TS code blocks)
11
+bun run types:check # Type check
12
```
84
-````
85
-
86
-Available modifier types from `@composio/core`:
87
-- `beforeExecuteModifier` - for `beforeExecute` callbacks
88
-- `afterExecuteModifier` - for `afterExecute` callbacks
89
-- `TransformToolSchemaModifier` - for `modifySchema` callbacks
90
-
91
-**Skip type checking (for partial snippets or external deps):**
92
-````md
93
-```typescript
94
-// @noErrors
95
-import { SomeExternalThing } from 'not-installed-package';
13
+
14
+## Project Structure
15
+
16
```
97
-````
98
-
99
-**Declare external variables in hidden section:**
100
-When code uses variables that aren't defined in the snippet, declare them before the cut:
101
-````md
102
-```typescript
103
-import { Composio } from '@composio/core';
104
-
105
-declare const composio: Composio;
106
-declare const userId: string;
107
-// ---cut---
108
-const tools = await composio.tools.get(userId, { toolkits: ['GITHUB'] });
17
+docs/
18
+├── app/ # Next.js app router
19
+├── content/ # MDX content
20
+│ ├── docs/ # Main documentation
21
+│ ├── examples/ # Example guides
22
+│ ├── changelog/ # Release notes
23
+│ └── reference/ # SDK & API reference
24
+├── components/ # React components
25
+├── lib/ # Utilities
26
+├── public/ # Static assets
27
+└── .claude/ # Claude context (see below)
28
```
110
-````
111
-
112
-### Annotations
113
-- `// ---cut---` - Hide code above from output (but include for compilation)
114
-- `// @noErrors` - Skip all type checking for this block
115
-- `// @errors: 2322` - Expect specific error code (won't fail build)
116
-- `// ^?` - Show type on hover at that position
117
-
118
-### Configuration
119
-- **Config**: `source.config.ts` - `transformerTwoslash({ explicitTrigger: false })`
120
-- **SDK packages**: Installed as devDependencies for import resolution
121
-- **Reference exclusion**: Uses `applyMdxPreset` with custom `rehypeCodeOptions` (no twoslash transformer)
122
-
123
-### Troubleshooting
124
-- If imports fail, ensure the package is in `devDependencies`
125
-- Use `// @noErrors` for examples with external dependencies not in package.json
126
-- Use `// ---cut---` to add setup code (imports, variable declarations) that compiles but isn't shown
127
-- Check CI logs for specific error codes (e.g., 2304 = cannot find name, 2322 = type mismatch)
128
-- For callback types, prefer importing SDK types over inline `{ foo: string; bar: any }` annotations
129
-- Run `bun run build` locally to validate all code blocks before pushing
130
-
131
-## Deployment
132
-- Vercel project: `composio/docs`
133
-- Uses `bun install` and `bun run build`
134
-- Root directory: `docs` (this is a monorepo subfolder)
29
+
30
+## Claude Context
31
+
32
+Detailed documentation for Claude is organized in `.claude/`:
33
+
34
+### Context (Domain Knowledge)
35
+- [fumadocs.md](.claude/context/fumadocs.md) - Framework patterns, design tokens, MDX components
36
+- [twoslash.md](.claude/context/twoslash.md) - TypeScript code block type checking
37
+- [sdk-reference.md](.claude/context/sdk-reference.md) - SDK doc generation
38
+
39
+### Guides (How-To)
40
+- [changelog.md](.claude/guides/changelog.md) - Writing changelog entries
41
+
42
+### Decisions (ADRs)
43
+- [toolkits.md](.claude/decisions/toolkits.md) - Toolkits page implementation
44
+- [examples.md](.claude/decisions/examples.md) - Examples page plan
45
+- [feedback.md](.claude/decisions/feedback.md) - Feedback system
46
+
47
+## Key Rules
48
+
49
+1. **TypeScript code blocks are type-checked** - All TS code in MDX is validated at build time. See [twoslash.md](.claude/context/twoslash.md).
50
+
51
+2. **Run build before pushing** - `bun run build` catches type errors that `bun dev` misses.
52
+
53
+3. **CSS variables** - Use `var(--composio-orange)` not `var(--orange)`. Check `app/global.css`.
54
+
55
+4. **Date format** - Changelog dates must be YYYY-MM-DD format.
56
+
57
+5. **Toolkits data** - `public/data/toolkits.json` must exist; errors are thrown, not ignored.
58
+
59
+6. **Test on mobile** - Fumadocs nav differs on mobile. Avoid assumptions about horizontal layout.
docs/app/(home)/docs/[[...slug]]/page.tsx
+6
-4
@@ -1,4 +1,4 @@
1
-import { getPageImage, source } from '@/lib/source';
1
+import { getOgImageUrl, source } from '@/lib/source';
2
import {
3
DocsBody,
4
DocsPage,
@@ -46,11 +46,13 @@ export async function generateMetadata(
46
const page = source.getPage(params.slug);
47
if (!page) notFound();
48
49
+ const ogImage = getOgImageUrl('docs', page.slugs, page.data.title, page.data.description);
50
+
51
return {
52
title: page.data.title,
53
description: page.data.description,
52
- openGraph: {
53
- images: getPageImage(page).url,
54
- },
54
+ alternates: { canonical: page.url },
55
+ openGraph: { images: [ogImage] },
56
+ twitter: { card: 'summary_large_image', images: [ogImage] },
57
};
58
}
docs/app/(home)/docs/changelog/[...slug]/page.tsx
+8
-2
@@ -1,4 +1,4 @@
1
-import { changelogEntries, formatDate, dateToSlug, slugToDate } from '@/lib/source';
1
+import { changelogEntries, formatDate, dateToSlug, slugToDate, getOgImageUrl } from '@/lib/source';
2
import { getMDXComponents } from '@/mdx-components';
3
import {
4
DocsBody,
@@ -95,8 +95,14 @@ export async function generateMetadata({ params }: PageProps) {
95
? matchingEntries[0].title
96
: `Changelog - ${formatDate(dateStr)}`;
97
98
+ const description = `Updates from ${formatDate(dateStr)}`;
99
+ const ogImage = getOgImageUrl('docs', ['changelog', ...slug], title, description);
100
+
101
return {
102
title: `${title} | Composio Changelog`,
100
- description: `Updates from ${formatDate(dateStr)}`,
103
+ description,
104
+ alternates: { canonical: `/docs/changelog/${slug.join('/')}` },
105
+ openGraph: { images: [ogImage] },
106
+ twitter: { card: 'summary_large_image', images: [ogImage] },
107
};
108
}
docs/app/(home)/examples/[[...slug]]/page.tsx
+1
-1
@@ -3,4 +3,4 @@ import { createDocsPage, createGenerateStaticParams, createGenerateMetadata } fr
3
4
export default createDocsPage(examplesSource);
5
export const generateStaticParams = createGenerateStaticParams(examplesSource);
6
-export const generateMetadata = createGenerateMetadata(examplesSource);
6
+export const generateMetadata = createGenerateMetadata(examplesSource, 'examples');
docs/app/(home)/reference/[[...slug]]/page.tsx
+6
-1
@@ -1,5 +1,5 @@
1
import type { ComponentType } from 'react';
2
-import { referenceSource } from '@/lib/source';
2
+import { referenceSource, getOgImageUrl } from '@/lib/source';
3
import { APIPage } from '@/components/api-page';
4
import {
5
DocsBody,
@@ -75,8 +75,13 @@ export async function generateMetadata({
75
const page = referenceSource.getPage(slug);
76
if (!page) notFound();
77
78
+ const ogImage = getOgImageUrl('reference', page.slugs, page.data.title, page.data.description);
79
+
80
return {
81
title: page.data.title,
82
description: page.data.description,
83
+ alternates: { canonical: page.url },
84
+ openGraph: { images: [ogImage] },
85
+ twitter: { card: 'summary_large_image', images: [ogImage] },
86
};
87
}
docs/app/(home)/toolkits/[[...slug]]/page.tsx
+15
-2
@@ -1,4 +1,4 @@
1
-import { toolkitsSource } from '@/lib/source';
1
+import { toolkitsSource, getOgImageUrl } from '@/lib/source';
2
import { notFound } from 'next/navigation';
3
import { getMDXComponents } from '@/mdx-components';
4
import { ToolkitDetail } from '@/components/toolkits/toolkit-detail';
@@ -133,18 +133,26 @@ export async function generateMetadata({ params }: { params: Promise<{ slug?: st
133
134
// Index page
135
if (!slug || slug.length === 0) {
136
+ const ogImage = getOgImageUrl('toolkits', [], 'Toolkits', 'Browse all toolkits supported by Composio');
137
return {
138
title: 'Toolkits',
139
description: 'Browse all toolkits supported by Composio',
140
+ alternates: { canonical: '/toolkits' },
141
+ openGraph: { images: [ogImage] },
142
+ twitter: { card: 'summary_large_image', images: [ogImage] },
143
};
144
}
145
146
// Check MDX first
147
const page = toolkitsSource.getPage(slug);
148
if (page) {
149
+ const ogImage = getOgImageUrl('toolkits', slug, page.data.title, page.data.description);
150
return {
151
title: page.data.title,
152
description: page.data.description,
153
+ alternates: { canonical: page.url },
154
+ openGraph: { images: [ogImage] },
155
+ twitter: { card: 'summary_large_image', images: [ogImage] },
156
};
157
}
158
@@ -153,9 +161,14 @@ export async function generateMetadata({ params }: { params: Promise<{ slug?: st
161
const toolkits = await getToolkits();
162
const toolkit = toolkits.find((t) => t.slug === slug[0]);
163
if (toolkit) {
164
+ const title = `${toolkit.name?.trim() || toolkit.slug} - Composio Toolkit`;
165
+ const ogImage = getOgImageUrl('toolkits', slug, title, toolkit.description);
166
return {
157
- title: `${toolkit.name?.trim() || toolkit.slug} - Composio Toolkit`,
167
+ title,
168
description: toolkit.description,
169
+ alternates: { canonical: `/toolkits/${toolkit.slug}` },
170
+ openGraph: { images: [ogImage] },
171
+ twitter: { card: 'summary_large_image', images: [ogImage] },
172
};
173
}
174
}
docs/app/og/docs/[...slug]/route.tsx
+3
-3
@@ -1,4 +1,4 @@
1
-import { getPageImage, source } from '@/lib/source';
1
+import { source } from '@/lib/source';
2
import { notFound } from 'next/navigation';
3
import { ImageResponse } from 'next/og';
4
import { generate as DefaultImage } from 'fumadocs-ui/og';
@@ -7,7 +7,7 @@ export const revalidate = false;
7
8
export async function GET(
9
_req: Request,
10
- { params }: RouteContext<'/og/docs/[...slug]'>,
10
+ { params }: { params: Promise<{ slug: string[] }> },
11
) {
12
const { slug } = await params;
13
const page = source.getPage(slug.slice(0, -1));
@@ -28,6 +28,6 @@ export async function GET(
28
29
export function generateStaticParams() {
30
return source.getPages().map((page) => ({
31
- slug: getPageImage(page).segments,
31
+ slug: [...page.slugs, 'image.png'],
32
}));
33
}
docs/app/og/examples/[...slug]/route.tsx
new
+33
@@ -0,0 +1,33 @@
1
+import { examplesSource } from '@/lib/source';
2
+import { notFound } from 'next/navigation';
3
+import { ImageResponse } from 'next/og';
4
+import { generate as DefaultImage } from 'fumadocs-ui/og';
5
+
6
+export const revalidate = false;
7
+
8
+export async function GET(
9
+ _req: Request,
10
+ { params }: { params: Promise<{ slug: string[] }> },
11
+) {
12
+ const { slug } = await params;
13
+ const page = examplesSource.getPage(slug.slice(0, -1));
14
+ if (!page) notFound();
15
+
16
+ return new ImageResponse(
17
+ <DefaultImage
18
+ title={page.data.title}
19
+ description={page.data.description}
20
+ site="Composio"
21
+ />,
22
+ {
23
+ width: 1200,
24
+ height: 630,
25
+ },
26
+ );
27
+}
28
+
29
+export function generateStaticParams() {
30
+ return examplesSource.getPages().map((page) => ({
31
+ slug: [...page.slugs, 'image.png'],
32
+ }));
33
+}
docs/app/og/reference/[...slug]/route.tsx
new
+33
@@ -0,0 +1,33 @@
1
+import { referenceSource } from '@/lib/source';
2
+import { notFound } from 'next/navigation';
3
+import { ImageResponse } from 'next/og';
4
+import { generate as DefaultImage } from 'fumadocs-ui/og';
5
+
6
+export const revalidate = false;
7
+
8
+export async function GET(
9
+ _req: Request,
10
+ { params }: { params: Promise<{ slug: string[] }> },
11
+) {
12
+ const { slug } = await params;
13
+ const page = referenceSource.getPage(slug.slice(0, -1));
14
+ if (!page) notFound();
15
+
16
+ return new ImageResponse(
17
+ <DefaultImage
18
+ title={page.data.title}
19
+ description={page.data.description}
20
+ site="Composio"
21
+ />,
22
+ {
23
+ width: 1200,
24
+ height: 630,
25
+ },
26
+ );
27
+}
28
+
29
+export function generateStaticParams() {
30
+ return referenceSource.getPages().map((page) => ({
31
+ slug: [...page.slugs, 'image.png'],
32
+ }));
33
+}
docs/app/og/toolkits/[...slug]/route.tsx
new
+97
@@ -0,0 +1,97 @@
1
+import { toolkitsSource } from '@/lib/source';
2
+import { notFound } from 'next/navigation';
3
+import { ImageResponse } from 'next/og';
4
+import { generate as DefaultImage } from 'fumadocs-ui/og';
5
+import { readFile } from 'fs/promises';
6
+import { join } from 'path';
7
+import type { Toolkit } from '@/types/toolkit';
8
+
9
+export const revalidate = false;
10
+
11
+async function getToolkits(): Promise<Toolkit[]> {
12
+ const filePath = join(process.cwd(), 'public/data/toolkits.json');
13
+ try {
14
+ const data = await readFile(filePath, 'utf-8');
15
+ return JSON.parse(data) as Toolkit[];
16
+ } catch {
17
+ return [];
18
+ }
19
+}
20
+
21
+export async function GET(
22
+ _req: Request,
23
+ { params }: { params: Promise<{ slug: string[] }> },
24
+) {
25
+ const { slug } = await params;
26
+ const pageSlug = slug.slice(0, -1); // Remove 'image.png'
27
+
28
+ // Check MDX first
29
+ const page = toolkitsSource.getPage(pageSlug);
30
+ if (page) {
31
+ return new ImageResponse(
32
+ <DefaultImage
33
+ title={page.data.title}
34
+ description={page.data.description}
35
+ site="Composio"
36
+ />,
37
+ {
38
+ width: 1200,
39
+ height: 630,
40
+ },
41
+ );
42
+ }
43
+
44
+ // Check JSON toolkit
45
+ if (pageSlug.length === 1) {
46
+ const toolkits = await getToolkits();
47
+ const toolkit = toolkits.find((t) => t.slug === pageSlug[0]);
48
+ if (toolkit) {
49
+ return new ImageResponse(
50
+ <DefaultImage
51
+ title={`${toolkit.name?.trim() || toolkit.slug}`}
52
+ description={toolkit.description || 'Composio Toolkit'}
53
+ site="Composio"
54
+ />,
55
+ {
56
+ width: 1200,
57
+ height: 630,
58
+ },
59
+ );
60
+ }
61
+ }
62
+
63
+ // Index page
64
+ if (pageSlug.length === 0) {
65
+ return new ImageResponse(
66
+ <DefaultImage
67
+ title="Toolkits"
68
+ description="Browse all toolkits supported by Composio"
69
+ site="Composio"
70
+ />,
71
+ {
72
+ width: 1200,
73
+ height: 630,
74
+ },
75
+ );
76
+ }
77
+
78
+ notFound();
79
+}
80
+
81
+export async function generateStaticParams() {
82
+ // MDX pages
83
+ const mdxParams = toolkitsSource.getPages().map((page) => ({
84
+ slug: [...page.slugs, 'image.png'],
85
+ }));
86
+
87
+ // JSON toolkit pages
88
+ const toolkits = await getToolkits();
89
+ const jsonParams = toolkits.map((toolkit) => ({
90
+ slug: [toolkit.slug, 'image.png'],
91
+ }));
92
+
93
+ // Index page
94
+ const indexParam = { slug: ['image.png'] };
95
+
96
+ return [indexParam, ...mdxParams, ...jsonParams];
97
+}
docs/content/examples/vercel-chat.mdx
+5
-5
@@ -24,7 +24,7 @@ respective auth configs. Learn how to create auth configs [here](/docs/authentic
24
Once done, your auth configs will be available in the [Composio dashboard](https://app.composio.dev/integrations).
25
26
27
- <img src="../../../../assets/images/examples/auth-configs.png" alt="Auth configs" />
27
+ <img src="/assets/images/examples/auth-configs.png" alt="Auth configs" />
28
29
30
### Save auth config IDs to environment variables
@@ -62,7 +62,7 @@ list the toolkits and their connection status, we create a Next.js API route to
62
fetch the toolkits using Composio SDK.
63
64
65
- <img src="../../../../assets/images/examples/toolkits.png" />
65
+ <img src="/assets/images/examples/toolkits.png" alt="Toolkits list with connection status" />
66
67
68
### 1. Listing connected accounts
@@ -131,7 +131,7 @@ Users need to connect and disconnect their accounts from the chatbot to enable t
131
When a user wants to connect their account, we create a connection request that redirects them to the OAuth provider:
132
133
134
- <img src="../../../../assets/images/examples/create-connection.png" />
134
+ <img src="/assets/images/examples/create-connection.png" alt="Create connection dialog" />
135
136
137
```typescript app/api/connections/initiate/route.ts
@@ -159,7 +159,7 @@ export async function POST(request: Request) {
159
After initiating a connection, we need to wait for the OAuth flow to complete. We check the connection status to know when it's ready to use:
160
161
162
- <img src="../../../../assets/images/examples/connection-status.png" />
162
+ <img src="/assets/images/examples/connection-status.png" alt="Connection status indicator" />
163
164
165
```typescript app/api/connections/status/route.ts
@@ -269,7 +269,7 @@ export async function POST(request: Request) {
269
By default, tool calls appear as raw JSON in the chat interface. To create a better user experience, we can build custom components that display tool calls with proper formatting and loading states.
270
271
272
- <img src="../../../../assets/images/examples/custom-tool-component.png" />
272
+ <img src="/assets/images/examples/custom-tool-component.png" alt="Custom tool call component" />
273
274
275
You can find the `ToolCall` component at `components/tool-call.tsx`. Here's how to integrate it into your message rendering:
docs/lib/create-docs-page.tsx
+12
-1
@@ -8,6 +8,7 @@ import { getMDXComponents } from '@/mdx-components';
8
import type { Metadata } from 'next';
9
import { createRelativeLink } from 'fumadocs-ui/mdx';
10
import { PageActions } from '@/components/page-actions';
11
+import { getOgImageUrl } from '@/lib/source';
12
13
// eslint-disable-next-line @typescript-eslint/no-explicit-any
14
type Source = any;
@@ -42,7 +43,7 @@ export function createGenerateStaticParams(source: Source) {
43
};
44
}
45
45
-export function createGenerateMetadata(source: Source) {
46
+export function createGenerateMetadata(source: Source, section: string = 'docs') {
47
return async function generateMetadata({
48
params,
49
}: {
@@ -52,9 +53,19 @@ export function createGenerateMetadata(source: Source) {
53
const page = source.getPage(slug);
54
if (!page) notFound();
55
56
+ const ogImage = getOgImageUrl(section, page.slugs, page.data.title, page.data.description);
57
+
58
return {
59
title: page.data.title,
60
description: page.data.description,
61
+ alternates: { canonical: page.url },
62
+ openGraph: {
63
+ images: [ogImage],
64
+ },
65
+ twitter: {
66
+ card: 'summary_large_image',
67
+ images: [ogImage],
68
+ },
69
};
70
};
71
}
docs/lib/source.ts
+11
@@ -49,6 +49,17 @@ export function getPageImage(page: InferPageType<typeof source>) {
49
};
50
}
51
52
+/**
53
+ * Generate OG image URL for any page section
54
+ */
55
+export function getOgImageUrl(section: string, slugs: string[], title?: string, description?: string): string {
56
+ const params = new URLSearchParams();
57
+ if (title) params.set('title', title);
58
+ if (description) params.set('description', description);
59
+ const query = params.toString() ? `?${params.toString()}` : '';
60
+ return `/og/${section}/${slugs.join('/')}/image.png${query}`;
61
+}
62
+
63
/**
64
* Converts MDX content to clean markdown for AI agents.
65
* Strips JSX components and converts them to plain text equivalents.
docs/public/assets/images/examples/auth-configs.png
Binary files /dev/null and b/docs/public/assets/images/examples/auth-configs.png differ
docs/public/assets/images/examples/connection-status.png
Binary files /dev/null and b/docs/public/assets/images/examples/connection-status.png differ
docs/public/assets/images/examples/create-connection.png
Binary files /dev/null and b/docs/public/assets/images/examples/create-connection.png differ
docs/public/assets/images/examples/custom-tool-component.png
Binary files /dev/null and b/docs/public/assets/images/examples/custom-tool-component.png differ
docs/public/assets/images/examples/toolkits.png
Binary files /dev/null and b/docs/public/assets/images/examples/toolkits.png differ
docs/public/robots.txt
new
+10
@@ -0,0 +1,10 @@
1
+# Composio Docs - https://docs.composio.dev
2
+
3
+User-agent: *
4
+Allow: /
5
+
6
+# Sitemaps
7
+Sitemap: https://docs.composio.dev/sitemap.xml
8
+
9
+# Crawl-delay for politeness (optional, not all bots respect this)
10
+# Crawl-delay: 1