|
1 | 1 | # Components
|
2 | 2 |
|
3 |
| -Harper components are a core Harper concept defined as flexible JavaScript based _extensions_ of the highly extensible core Harper platform. They are executed by Harper directly and have complete access to the Harper [Global APIs](../../technical-details/reference/globals.md) (such as `Resource`, `databases`, and `tables`). |
| 3 | +**Components** are the high-level concept for modules that extend the Harper core platform adding additional functionality. The application you built in the previous section is an example of a component. In addition to applications, components also encompass extensions. |
4 | 4 |
|
5 |
| -A key aspect to components are their extensibility; components can be built on other components. For example, a [Harper Application](../applications/README.md) is a component that uses many other components. The [application template](https://github.com/HarperDB/application-template) demonstrates many of Harper's built-in components such as `rest` (for automatic REST endpoint generation), `graphqlSchema` (for table schema definitions), and many more. |
| 5 | +**Applications** are best defined as the implementation of a specific user-facing feature or functionality. Applications are built on top of extensions and can be thought of as the end product that users interact with. For example, a Next.js application that serves a web interface or an Apollo GraphQL server that provides a GraphQL API are both applications. |
6 | 6 |
|
7 |
| -From management to development, the following pages document everything a developer needs to know about Harper components. |
| 7 | +**Extensions** are the building blocks of the Harper component system. Applications depend on extensions to provide the functionality the application is implementing. For example, the built-in `graphqlSchema` extension enables applications to define their databases and tables using GraphQL schemas. Furthermore, the `@harperdb/nextjs` and `@harperdb/apollo` extensions are the building blocks that provide support for building Next.js and Apollo applications. |
8 | 8 |
|
9 |
| -- [Managing Components](./managing.md) - developing, installing, deploying, and executing Harper components locally and remotely |
10 |
| -- [Technical Reference](./reference.md) - detailed, technical reference for component development |
11 |
| -- [Built-In Components](./built-in.md) - documentation for all of Harper's built-in components (i.e. `rest`) |
| 9 | +All together, the support for implementing a feature is the extension, and the actual implementation of the feature is the application. |
12 | 10 |
|
13 |
| -## Custom Components |
| 11 | +Extensions can also depend on other extensions. For example, the [`@harperdb/apollo`](https://github.com/HarperDB/apollo) extension depends on the built-in `graphqlSchema` extension to create a cache table for Apollo queries. Applications can then use the `@harperdb/apollo` extension to implement an Apollo GraphQL backend server. |
14 | 12 |
|
15 |
| -The following list is all of Harper's officially maintained, custom components. They are all available on npm and GitHub. |
| 13 | +```mermaid |
| 14 | +flowchart TD |
| 15 | + subgraph Applications |
| 16 | + direction TB |
| 17 | + NextJSApp["Next.js App"] |
| 18 | + ApolloApp["Apollo App"] |
| 19 | + CustomResource["Custom Resource"] |
| 20 | + end |
| 21 | +
|
| 22 | + subgraph Extensions |
| 23 | + direction TB |
| 24 | + subgraph Custom |
| 25 | + NextjsExt["@harperdb/nextjs"] |
| 26 | + ApolloExt["@harperdb/apollo"] |
| 27 | + end |
| 28 | + subgraph Built-In |
| 29 | + GraphqlSchema["graphqlSchema"] |
| 30 | + JsResource["jsResource"] |
| 31 | + Rest["rest"] |
| 32 | + end |
| 33 | + end |
| 34 | +
|
| 35 | + subgraph Core |
| 36 | + direction TB |
| 37 | + Database["database"] |
| 38 | + FileSystem["file-system"] |
| 39 | + Networking["networking"] |
| 40 | + end |
| 41 | +
|
| 42 | + NextJSApp --> NextjsExt |
| 43 | + ApolloApp --> ApolloExt |
| 44 | + CustomResource --> JsResource & GraphqlSchema & Rest |
| 45 | +
|
| 46 | + NextjsExt --> Networking |
| 47 | + NextjsExt --> FileSystem |
| 48 | + ApolloExt --> GraphqlSchema |
| 49 | + ApolloExt --> Networking |
| 50 | +
|
| 51 | + GraphqlSchema --> Database |
| 52 | + JsResource --> Database |
| 53 | + Rest --> Networking |
| 54 | +
|
| 55 | +``` |
| 56 | + |
| 57 | +> As of Harper v4.6, a new, **experimental** component system has been introduced called **plugins**. Plugins are a **new iteration of the existing extension system**. They are simultaneously a simplification and an extensibility upgrade. Instead of defining multiple methods (`start` vs `startOnMainThread`, `handleFile` vs `setupFile`, `handleDirectory` vs `setupDirectory`), plugins only have to define a single `handleComponent` method. Plugins are **experimental**, and complete documentation is available on the [Plugin API](./plugins.md) page. In time we plan to deprecate the concept of extensions in favor of plugins, but for now, both are supported. |
| 58 | +
|
| 59 | +Beyond applications and extensions, components are further classified as built-in or custom. **Built-in** components are included with Harper by default and can be directly referenced by their name. The `graphqlSchema`, `rest`, and `jsResource` extensions used in the previous application example are all examples of built-in extensions. **Custom** components must use external references, generally npm or GitHub packages, and are often included as dependencies within the `package.json` of the component. |
| 60 | + |
| 61 | +> Harper maintains a number of custom components that are available on `npm` and `GitHub`, such as the [`@harperdb/nextjs`](https://github.com/HarperDB/nextjs) extension or the [`@harperdb/status-check`](https://github.com/HarperDB/status-check) application. |
| 62 | +
|
| 63 | + |
| 64 | +Harper does not currently include any built-in applications, making "custom applications" a bit redundant. Generally, we just say "application". However, there is a multitude of both built-in and custom extensions, and so the documentation refers to them as such. A complete list of built-in extensions is available in the [Built-In Extensions](./built-in.md) documentation page, and the list of custom extensions and applications is available below. |
| 65 | + |
| 66 | +## Custom Applications |
16 | 67 |
|
17 |
| -- [`@harperdb/nextjs`](https://github.com/HarperDB/nextjs) |
18 |
| -- [`@harperdb/apollo`](https://github.com/HarperDB/apollo) |
19 | 68 | - [`@harperdb/status-check`](https://github.com/HarperDB/status-check)
|
20 | 69 | - [`@harperdb/prometheus-exporter`](https://github.com/HarperDB/prometheus-exporter)
|
21 | 70 | - [`@harperdb/acl-connect`](https://github.com/HarperDB/acl-connect)
|
| 71 | + |
| 72 | +## Custom Extensions |
| 73 | + |
| 74 | +- [`@harperdb/nextjs`](https://github.com/HarperDB/nextjs) |
| 75 | +- [`@harperdb/apollo`](https://github.com/HarperDB/apollo) |
22 | 76 | - [`@harperdb/astro`](https://github.com/HarperDB/astro)
|
0 commit comments