Skip to content

Commit fc886ed

Browse files
ikhareConvex, Inc.
authored and
Convex, Inc.
committed
Link to more components from relevant places (#36504)
Create a new card type that highlights components in docs. Use it to link to relevant components from various parts of the doc. GitOrigin-RevId: 3471b7b2304ef792540edca2005155f349f63c8e
1 parent d83e2a5 commit fc886ed

File tree

6 files changed

+213
-15
lines changed

6 files changed

+213
-15
lines changed

npm-packages/docs/docs/agents.mdx

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,25 @@ The [Agent](https://www.convex.dev/components/agent) and
2525
[Workflow](https://www.convex.dev/components/workflow) components can be used
2626
together to create powerful long running agents with memory.
2727

28+
import { ComponentCardList } from "@site/src/components/ComponentCard";
29+
30+
<ComponentCardList
31+
items={[
32+
{
33+
title: "Agent",
34+
description:
35+
"Agents organize your AI workflows into units, with message history and vector search built in.",
36+
href: "https://www.convex.dev/components/agent",
37+
},
38+
{
39+
title: "Workflow",
40+
description:
41+
"Simplify programming long running code flows. Workflows execute durably with configurable retries and delays.",
42+
href: "https://www.convex.dev/components/workflow",
43+
},
44+
]}
45+
/>
46+
2847
Learn more by reading:
2948
[AI Agents with Built-in Memory](https://stack.convex.dev/ai-agents).
3049

@@ -90,16 +109,25 @@ export const supportAgentWorkflow = workflow.define({
90109
Convex also provides other components to help you build reliable AI
91110
applications.
92111

93-
The
94-
[Persistent Text Streaming](https://www.convex.dev/components/persistent-text-streaming)
95-
component provides a React hook for streaming text from HTTP actions while
96-
simultaneously storing the data in the database. This persistence allows the
97-
text to be accessed after the stream ends or by other users.
98-
99-
The [Action Retrier](https://www.convex.dev/components/retrier) Component is
100-
useful for one of flaky AI calls that you want to automatically retry. It will
101-
run the action and retry it on failure, sleeping with exponential backoff, until
102-
the action succeeds or the maximum number of retries is reached.
103-
104-
The [Workpool](https://www.convex.dev/components/workpool) Component lets you
105-
create tiers of parallelism to handle large number of external requests.
112+
<ComponentCardList
113+
items={[
114+
{
115+
title: "Persistent Text Streaming",
116+
description:
117+
"Stream text from HTTP actions while storing data in the database, enabling access after the stream ends or by other users.",
118+
href: "https://www.convex.dev/components/persistent-text-streaming",
119+
},
120+
{
121+
title: "Action Retrier",
122+
description:
123+
"Add reliability to unreliable external service calls. Retry idempotent calls with exponential backoff until success.",
124+
href: "https://www.convex.dev/components/retrier",
125+
},
126+
{
127+
title: "Workpool",
128+
description:
129+
"Create tiers of parallelism to manage and prioritize large numbers of external requests efficiently.",
130+
href: "https://www.convex.dev/components/workpool",
131+
},
132+
]}
133+
/>

npm-packages/docs/docs/cspell.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"codegen",
2121
"convexapp",
2222
"convexmobile",
23+
"cronspec",
2324
"dall",
2425
"Dall",
2526
"Daria",
@@ -114,8 +115,8 @@
114115
"venv",
115116
"vueuse",
116117
"webapps",
117-
"websockets",
118118
"webm",
119+
"websockets",
119120
"whsec",
120121
"Workpool",
121122
"yourclientid",

npm-packages/docs/docs/database/writing-data.mdx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import insertExample from "!!raw-loader!@site/../private-demos/snippets/convex/w
77
import patchExample from "!!raw-loader!@site/../private-demos/snippets/convex/writingDataPatch.ts";
88
import replaceExample from "!!raw-loader!@site/../private-demos/snippets/convex/writingDataReplace.ts";
99
import deleteExample from "!!raw-loader!@site/../private-demos/snippets/convex/writingDataDelete.ts";
10+
import { ComponentCardList } from "@site/src/components/ComponentCard";
1011

1112
[Mutations](/docs/functions/mutation-functions.mdx) can insert, update, and
1213
remove data from database tables.
@@ -129,6 +130,22 @@ export const bulkInsertProducts = mutation({
129130
});
130131
````
131132

133+
## Migrations
134+
135+
Database migrations are done through the migration component. The component is
136+
designed to run online migrations to safely evolve your database schema over
137+
time. It allows you to resume from failures, and validate changes with dry runs.
138+
139+
<ComponentCardList
140+
items={[
141+
{
142+
title: "Migrations",
143+
description: "Framework for long running data migrations of live data.",
144+
href: "https://www.convex.dev/components/migrations",
145+
},
146+
]}
147+
/>
148+
132149
## Write performance and limits
133150

134151
To prevent accidental writes of large amounts of records, queries and mutations

npm-packages/docs/docs/scheduling.mdx

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ hide_table_of_contents: true
44
pagination_prev: auth
55
---
66

7+
import { ComponentCardList } from "@site/src/components/ComponentCard";
8+
79
Convex lets you easily schedule a function to run once or repeatedly in the
810
future. This allows you to build durable workflows like sending a welcome email
911
a day after someone joins or regularly reconciling your accounts with Stripe.
@@ -15,4 +17,39 @@ Convex provides two different features for scheduling:
1517
- [Cron Jobs](/docs/scheduling/cron-jobs.mdx) schedule functions to run on a
1618
recurring basis, such as daily.
1719

20+
## Durable function components
21+
22+
Built-in scheduled functions and crons work well for simpler apps and workflows.
23+
If you're operating at high scale or need more specific guarantees, use the
24+
following higher-level [components](/docs/components.mdx) for durable functions.
25+
26+
<ComponentCardList
27+
items={[
28+
{
29+
title: "Workpool",
30+
description:
31+
"Workpool give critical tasks priority by organizing async operations into separate, customizable queues.",
32+
href: "https://www.convex.dev/components/workpool",
33+
},
34+
{
35+
title: "Workflow",
36+
description:
37+
"Simplify programming long running code flows. Workflows execute durably with configurable retries and delays.",
38+
href: "https://www.convex.dev/components/workflow",
39+
},
40+
{
41+
title: "Action Retrier",
42+
description:
43+
"Add reliability to an unreliable external service. Retry idempotent calls a set number of times.",
44+
href: "https://www.convex.dev/components/retrier",
45+
},
46+
{
47+
title: "Crons",
48+
description:
49+
"Use cronspec to run functions on a repeated schedule at runtime.",
50+
href: "https://www.convex.dev/components/crons",
51+
},
52+
]}
53+
/>
54+
1855
<StackPosts query="scheduler" />
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import React from "react";
2+
import Link from "@docusaurus/Link";
3+
import Heading from "@theme/Heading";
4+
5+
type ComponentCardItem = {
6+
href?: string;
7+
title: string;
8+
description: string;
9+
};
10+
11+
const ComponentIcon = () => (
12+
<div className="component-card-header">
13+
<svg
14+
width="15"
15+
height="15"
16+
viewBox="-1 0 13 10"
17+
fill="none"
18+
xmlns="http://www.w3.org/2000/svg"
19+
className="component-card-icon"
20+
>
21+
<path
22+
d="M9.00954 3.1018C9.00954 3.25833 9.08285 3.40583 9.20762 3.50035C9.33239 3.59487 9.49423 3.62551 9.64491 3.58313C9.764 3.54963 9.88902 3.53335 10.0308 3.53335H10.0361C10.8473 3.53335 11.5054 4.19146 11.5054 5.00263C11.5054 5.81381 10.8473 6.47192 10.0361 6.47192C9.90304 6.47192 9.77217 6.45267 9.64491 6.41688C9.49423 6.3745 9.33239 6.40513 9.20762 6.49965C9.08285 6.59417 9.00954 6.74167 9.00954 6.8982V8.75208C9.00954 9.02823 8.78568 9.25208 8.50954 9.25208H1.00537C0.729228 9.25208 0.505371 9.02823 0.505371 8.75209V1.24792C0.505371 0.971774 0.729229 0.747917 1.00537 0.747917H2.9422C2.873 1.22601 2.93994 1.69202 3.15997 2.08387C3.47318 2.64168 4.05361 2.96989 4.77062 2.96989C5.49213 2.96989 6.05944 2.6369 6.35615 2.07137C6.56128 1.68036 6.61652 1.21869 6.54991 0.747917H8.50954C8.78568 0.747917 9.00954 0.971775 9.00954 1.24792V3.1018Z"
23+
stroke="currentColor"
24+
strokeLinejoin="round"
25+
/>
26+
</svg>
27+
<span className="component-card-label">Convex component</span>
28+
</div>
29+
);
30+
31+
export function ComponentCard({ item }: { item: ComponentCardItem }) {
32+
const CardWrapper = item.href ? Link : "div";
33+
34+
return (
35+
<CardWrapper
36+
{...(item.href ? { href: item.href } : {})}
37+
className="component-card"
38+
>
39+
<div className="component-card-content">
40+
<ComponentIcon />
41+
<Heading as="h3" className="component-card-title">
42+
{item.title}
43+
</Heading>
44+
<p className="component-card-description">{item.description}</p>
45+
</div>
46+
</CardWrapper>
47+
);
48+
}
49+
50+
export function ComponentCardList({ items }: { items: ComponentCardItem[] }) {
51+
return (
52+
<div className="component-cards">
53+
{items.map((item, index) => (
54+
<ComponentCard key={index} item={item} />
55+
))}
56+
</div>
57+
);
58+
}

npm-packages/docs/src/css/custom.css

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,65 @@ article code {
366366

367367
.component-cards {
368368
display: grid;
369+
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
370+
gap: 1.5rem;
371+
margin: 2rem 0;
372+
}
373+
374+
.component-card {
375+
display: block;
376+
padding: 1.5rem;
377+
border-radius: var(--ifm-card-border-radius);
378+
text-decoration: none;
379+
border: 1px solid var(--ifm-toc-border-color);
380+
background: var(--ifm-background-color);
381+
min-height: 130px;
382+
box-shadow: none;
383+
}
384+
385+
.component-card:hover {
386+
box-shadow: none;
387+
background-color: var(--ifm-menu-color-background-active);
388+
color: var(--ifm-font-color-base);
389+
text-decoration: none;
390+
}
391+
392+
.component-card-content {
393+
display: flex;
394+
flex-direction: column;
369395
gap: 1rem;
370-
margin: 1.5rem 0 2.5rem;
396+
}
397+
398+
.component-card-header {
399+
display: flex;
400+
align-items: center;
401+
gap: 0.5rem;
402+
color: var(--ifm-color-emphasis-600);
403+
}
404+
405+
.component-card-icon {
406+
color: var(--ifm-navbar-link-color);
407+
flex-shrink: 0;
408+
}
409+
410+
.component-card-label {
411+
font-size: 0.75rem;
412+
text-transform: uppercase;
413+
letter-spacing: 0.05em;
414+
font-weight: 500;
415+
}
416+
417+
.component-card-title {
418+
margin: 0;
419+
font-size: 1.125rem;
420+
color: var(--ifm-heading-color);
421+
}
422+
423+
.component-card-description {
424+
margin: 0;
425+
color: var(--ifm-color-emphasis-700);
426+
line-height: 1.5;
427+
font-size: 1rem;
371428
}
372429

373430
/* This magic number 462 is the size of the article div container as rendered */

0 commit comments

Comments
 (0)