Docs/API Reference/Packages

@veap/plugins

Inspected version: 0.1.4 · Source

3 min read

Inspected version: 0.1.4 · Source →

Plugin contracts, persisted plugin registry, lifecycle hooks, route-tree discovery/matching, navigation, extension points and dashboard widgets.

Entry points#

The manifest exports ., /client, /router, /models, /actions, /server, /migrations and /package.json.

  • Root: common contracts, composition augmentation, migrations, navigation, providers and registry.
  • /server: root APIs plus server actions, registry/router APIs and server-rendered widget components.
  • /client: client React extension and widget components.
  • /router: route-tree and matching/discovery utilities.
  • /actions: plugin actions.
  • /models: plugin persistence models.
  • /migrations: plugin database migrations.

The package has peer dependencies for React/React DOM and optional UI/icon/notification packages. Install the peers required by the UI features you actually use.

Plugin manifest#

PluginManifestSchema validates id, name, version, optional description, dependencies, extends, enabled, system, hasSetup and author. Its defaults include empty dependency/extension arrays and boolean defaults for enabled/system/setup flags.

createManifestFromPackageJson(pkg) builds a manifest from the package's veap metadata, falling back to package name/version/description where applicable.

IPlugin contract#

An IPlugin has a manifest and can optionally declare migrations, init, onMigrate, onEnable, onDisable, hooks, extensions, widgets, navigation, nested plugins, locales and routeTree.

These optional fields are contracts, not a guarantee that every host integration invokes every callback in every context. Verify the provider/registry behavior for the exact package version in use.

Composition augmentation#

Importing @veap/plugins loads its composition module, which augments ApplicationBuilder with withPlugins(plugins). The method registers the plugin list and PluginsServiceProvider. The base @veap/kernel package alone does not define withPlugins.

Extension and widget contracts#

  • PluginHook: a named point, handler and optional priority.
  • PluginExtension: ID, target, point, React component, optional priority/metadata/role/permission restrictions.
  • PluginWidget: ID, name, area, component, optional priority and grid spans plus role/permission restrictions.
  • PluginNavigation: public links and grouped admin/settings navigation.
  • VeapMiddleware: React-node middleware with context and next.
  • ApiMiddleware: request/response middleware.

UI extensions are React components and must be rendered through the corresponding server/client integration. Do not import a client component into a server-only module without following the React boundary rules.

Route trees#

The router subpath provides route discovery, route tree contracts, matching, middleware and React rendering/soft-navigation helpers. A plugin can expose a routeTree value or a sync/async function returning a RouteNode. The example in the source contract uses discoverRoutes() against a plugin app/ directory.

Route-tree support is an integration feature and should not be confused with Next.js's native filesystem router. Test nested layouts, dynamic segments, error/loading boundaries and middleware behavior in the host application.

Registry and persistence#

The plugin package persists plugin status and user widget state through the database layer. IPluginRepository exposes findAll, findById, seed, upsertStatus and updateConfig. Use registry facades instead of mutating persistence tables directly.

CLI#

The repository contains plugin-oriented CLI commands for adding/ejecting/generating plugins. These commands are for plugin workflows; they are not a general create-veap-app replacement.

Detailed API pages#

veap
Preparing0%