@@ -5,6 +5,7 @@ pagination_prev: search
55---
66
77import { ComponentCardList } from " @site/src/ComponentCardList.tsx" ;
8+ import { LargeCardList } from " @site/src/QuickstartsList.tsx" ;
89
910<span className = " convex-hero" >
1011 Convex Components package up code and data in a sandbox that allows you to
@@ -16,23 +17,38 @@ them is always safe. They can't read your app's tables or call your app's
1617functions unless you pass them in explicitly.
1718
1819You can read about the full vision in
19- [ Convex: The Software-Defined Database] ( https://stack.convex.dev/the-software-defined-database#introducing-convex-components )
20+ [ Convex: The Software-Defined Database] ( https://stack.convex.dev/the-software-defined-database#introducing-convex-components ) .
2021
21- The Convex team has built a few components that add new features to your
22- backend. You'll eventually be able to author your own components to use within
23- your project and to share with the community, but we haven't stabilized and
24- documented the authoring APIs yet .
22+ Components can be installed from NPM or from a local folder. Once installed,
23+ they have their own database tables and isolated function execution environment.
24+ Check out the full directory of components on the
25+ [ Convex website ] ( https://convex.dev/components ) .
2526
26- Each component is installed as its own independent library from NPM. Check out
27- the component's README for installation and usage instructions. You can see the
28- full directory on the [ Convex website] ( https://convex.dev/components ) .
29-
30- <CardLink
31- className = " convex-hero-card"
32- item = { {
33- href: " https://convex.dev/components" ,
34- label: " Full Components Directory" ,
35- }}
27+ <LargeCardList
28+ items = { [
29+ {
30+ title: " Understanding components" ,
31+ description:
32+ " Explore the concepts behind and build a mental model for how components work." ,
33+ href: " /components/understanding" ,
34+ },
35+ {
36+ title: " Using components" ,
37+ description:
38+ " Learn about useful components and how to use them in your application." ,
39+ href: " /components/using" ,
40+ },
41+ {
42+ title: " Authoring components" ,
43+ description: " Learn how to write and publish a component." ,
44+ href: " /components/authoring" ,
45+ },
46+ {
47+ title: " Components Directory" ,
48+ description: " List of all components." ,
49+ href: " https://convex.dev/components" ,
50+ },
51+ ]}
3652/>
3753
3854## Durable Functions
@@ -57,12 +73,6 @@ full directory on the [Convex website](https://convex.dev/components).
5773 label: " Crons" ,
5874 description: " Dynamic runtime cron management" ,
5975 },
60- {
61- type: " link" ,
62- href: " https://www.convex.dev/components/retrier" ,
63- label: " Action Retrier" ,
64- description: " Retry failed external calls automatically" ,
65- },
6676 ]}
6777/>
6878
@@ -88,12 +98,6 @@ full directory on the [Convex website](https://convex.dev/components).
8898 label: " Aggregate" ,
8999 description: " Efficient sums and counts" ,
90100 },
91- {
92- type: " link" ,
93- href: " https://www.convex.dev/components/geospatial" ,
94- label: " Geospatial (Beta)" ,
95- description: " Store and search locations" ,
96- },
97101 ]}
98102/>
99103
@@ -150,12 +154,6 @@ full directory on the [Convex website](https://convex.dev/components).
150154 label: " AI Agent" ,
151155 description: " Define agents with tools and memory" ,
152156 },
153- {
154- type: " link" ,
155- href: " https://www.convex.dev/components/persistent-text-streaming" ,
156- label: " Persistent Text Streaming" ,
157- description: " Stream and store text data" ,
158- },
159157 {
160158 type: " link" ,
161159 href: " https://www.convex.dev/components/rate-limiter" ,
@@ -170,77 +168,3 @@ full directory on the [Convex website](https://convex.dev/components).
170168 },
171169 ]}
172170/>
173-
174- <Admonition type = " caution" title = " The component authoring APIs are in Beta" >
175- The underlying authoring APIs for components are still in flux. The Convex
176- team authored components listed below will be kept up to date as the APIs
177- change.
178- </Admonition >
179-
180- ## Understanding Components
181-
182- Components can be thought of as a combination of concepts from frontend
183- components, third party APIs, and both monolith and service-oriented
184- architectures.
185-
186- ### Data
187-
188- Similar to frontend components, Convex Components encapsulate state and behavior
189- and allow exposing a clean interface. However, instead of just storing state in
190- memory, these can have internal state machines that can persist between user
191- sessions, span users, and change in response to external inputs, such as
192- webhooks. Components can store data in a few ways:
193-
194- - Database tables with their own schema validation definitions. Since Convex is
195- realtime by default, data reads are automatically reactive, and writes commit
196- transactionally.
197- - File storage, independent of the main app's file storage.
198- - Durable functions via the built-in function scheduler. Components can reliably
199- schedule functions to run in the future and pass along state.
200-
201- Typically, libraries require configuring a third party service to add stateful
202- off-the-shelf functionality, which lack the transactional guarantees that come
203- from storing state in the same database.
204-
205- ### Isolation
206-
207- Similar to regular npm libraries, Convex Components include functions, type
208- safety, and are called from your code. However, they also provide extra
209- guarantees.
210-
211- - Similar to a third-party API, components can't read data for which you don't
212- provide access. This includes database tables, file storage, environment
213- variables, scheduled functions, etc.
214- - Similar to service-oriented architecture, functions in components are run in
215- an isolated environment, so they can't read or write global variables or patch
216- system behavior.
217- - Similar to a monolith architecture, data changes commit transactionally across
218- calls to components, without having to reason about complicated distributed
219- commit protocols or data inconsistencies. You'll never have a component commit
220- data but have the calling code roll back.
221- - In addition, each mutation call to a component is a sub-mutation isolated from
222- other calls, allowing you to safely catch errors thrown by components. It also
223- allows component authors to easily reason about state changes without races,
224- and trust that a thrown exception will always roll back the Component's
225- sub-mutation. [ Read more] ( /components/using.mdx#transactions ) .
226-
227- ### Encapsulation
228-
229- Being able to reason about your code is essential to scaling a codebase.
230- Components allow you to reason about API boundaries and abstractions.
231-
232- - The transactional guarantees discussed above allows authors and users of
233- components to reason locally about data changes.
234- - Components expose an explicit API, not direct database table access. Data
235- invariants can be enforced in code, within the abstraction boundary. For
236- example, the [ aggregate component] ( https://convex.dev/components/aggregate )
237- can internally denormalize data, the
238- [ rate limiter] ( https://convex.dev/components/rate-limiter ) component can shard
239- its data, and the
240- [ push notification] ( https://convex.dev/components/push-notifications )
241- component can internally batch API requests, while maintaining simple
242- interfaces.
243- - Runtime validation ensures all data that cross a component boundary are
244- validated: both arguments and return values. As with normal Convex functions,
245- the validators also specify the TypeScript types, providing end-to-end typing
246- with runtime guarantees.
0 commit comments