diff --git a/apps/nextra/next.config.mjs b/apps/nextra/next.config.mjs index f075ce696..ca3ccc19b 100644 --- a/apps/nextra/next.config.mjs +++ b/apps/nextra/next.config.mjs @@ -407,6 +407,12 @@ export default withBundleAnalyzer( destination: "/en/build/indexer/indexer-sdk/documentation/setup", permanent: true, }, + { + source: "/indexer/indexer-sdk/documentation/define-schema", + destination: + "/en/build/indexer/indexer-sdk/documentation/define-schema", + permanent: true, + }, { source: "/indexer/indexer-sdk/documentation/create-processor", destination: diff --git a/apps/nextra/pages/en/build/indexer/indexer-sdk/documentation/_meta.tsx b/apps/nextra/pages/en/build/indexer/indexer-sdk/documentation/_meta.tsx index 2ea78a2d2..e1e57a819 100644 --- a/apps/nextra/pages/en/build/indexer/indexer-sdk/documentation/_meta.tsx +++ b/apps/nextra/pages/en/build/indexer/indexer-sdk/documentation/_meta.tsx @@ -1,5 +1,8 @@ export default { setup: { title: "Initial Setup" }, + "define-schema": { + title: "Defining a Data Schema", + }, "create-processor": { title: "Create a Processor", }, diff --git a/apps/nextra/pages/en/build/indexer/indexer-sdk/documentation/define-schema.mdx b/apps/nextra/pages/en/build/indexer/indexer-sdk/documentation/define-schema.mdx new file mode 100644 index 000000000..95ee3ba61 --- /dev/null +++ b/apps/nextra/pages/en/build/indexer/indexer-sdk/documentation/define-schema.mdx @@ -0,0 +1,26 @@ +--- +title: "Defining a Data Schema" +--- + +# Defining a Data Schema + +The first step with indexing is choosing a database and defining a schema for the data that you want to store. + +## Schema Considerations +When designing an indexer data schema, consider the following: +- Customizability: A schema serves as an interface for your dApp to access data tailored to your specific contract or application. +Ensure your schema is customized to meet your dApp's unique requirements. +- Query Optimization: A well-designed schema can enable more efficient data retrieval, supporting advanced operations such as aggregations, complex filtering, and table joins. +- Enhanced Performance: Schema design can significantly improve your dApp's performance. +By using the indexer, a single indexer query can often replace multiple queries to the fullnode. + +## Aptos Core Processors +All data exposed by the [Indexer API](../../aptos-hosted.mdx) is initially indexed using custom processors. +Each core processor indexes a specific type of data. +You can explore the [full list of processors](https://github.com/aptos-labs/aptos-indexer-processors/tree/main/rust/sdk-processor/src/processors) and the [complete indexer data schema](https://github.com/aptos-labs/aptos-indexer-processors/blob/main/rust/processor/src/db/postgres/schema.rs). + +The Aptos core processors and the [Quickstart Guide](../quickstart.mdx) use [PostgreSQL](https://www.postgresql.org/) as the database and [Diesel](https://diesel.rs/) as the ORM. +However, you are free to choose any database or ORM that fits your needs. +Popular alternatives include [SeaORM](https://www.sea-ql.org/SeaORM/) and [SQLx](https://github.com/launchbadge/sqlx). +Setting up a database and using an ORM is beyond the scope of these tutorials. +If you need guidance, refer to the tutorials linked above for more information.