Plugin authoring

Writing a package that extends a framework or runtime rather than an application that uses it — a reusable extension loaded by its host, and the question you arrive at once solving a problem twice makes you want to solve it once for everyone.

Overview

Writing a package that extends the CAP runtime rather than an application that uses it — the mechanism underneath every cds-plugin in this atlas, and the question you arrive at once solving a problem twice makes you want to solve it once for everyone.

SAP SHIPS
Node.js →

@sap/cds-dk The command line client and development toolkit for CAP projects, with the commands cds build, cds deploy, cds watch and cds add among them.

Java →

com.sap.cds:cds-services-bom Extension points for CAP Java plugins: CDS models shared as Maven artifacts and resolved into the project, and event handlers registered for custom types and annotations.

Not covered: It stops at loading. What a plugin may safely do once loaded — which lifecycle events to attach to, how to avoid colliding with another plugin's handlers, how to version against a runtime that moves — is convention rather than contract, and is learned from reading other plugins. The design-time half of a plugin, cds add and cds build, is @sap/cds-dk, a dependency that runs locally or in a pipeline and must not be loaded at application runtime.

SourceCDS Plugin Packages — capirechecked
THE COMMUNITY ADDS

No community artifact is documented here.

Licence1

LicenceSAP Developer License Agreement 3.2 CAP§ 1, 2AlwaysA plugin is developed or distributed for use with SAP CAP materials covered by the agreement.
  • § 1 License. Productive customer applications are limited to SAP BTP or another SAP-licensed platform, and mass extraction to a non-SAP product is restricted except where solely required for SAP interoperability.
  • § 2 Intellectual Property. The agreement retains SAP's rights in the covered materials and limits making APIs, tools or software available to third parties, while preserving ownership of customer applications subject to SAP's underlying rights.

The agreement expressly includes plug-ins among the SAP materials and section 2 addresses making APIs and tools available to third parties. A plugin's own open-source licence does not erase those separate use terms.

SAP Developer License Agreement 3.2 CAP →

Artifacts2

2 of 2 artifacts
ArtifactSignals
CLI tools1
@sap/cds-dkCommand line client and development toolkit for CAP
Signals
none
Packages1
com.sap.cds:cds-services-bomMaven bill of materials pinning CAP Java module versions
Signals
none

Content8

Group by8 of 8 pieces
Piece, what it offers
What's in Daniel Hutzel's brain?
YouTube — SAP Developers playlists, Daniel Hutzel, DJ Adams, Talk
DRY CAP – Making Sustainable Solutions Through Plugins
YouTube — SAP Developers playlists, SAP Developers, Talk
Create your first CAP plugin
SAP Community, Wouter Lemaire, Blog
Show 5 more
SAP AI Services - DOX - Gen AI with SAP CAP Plugin - Part 3
SAP Community, sabarna17, part 3 of 3, Blog
How to build reusable plugin components for CAP Java applications
SAP Community, robinjayasinghe, Blog
BTP CAP : Custom plugin to separate generic change log capture logic
SAP Community, sreehari_vpillai, Blog
Reusable components for CAP with cds-plugin
SAP Community, Daniel Schlachter, BlogThe reasoningRunnable code
AI needs a foundation: A map of the plug-in ecosystem for CAP
SAP TechEd — session catalogue, Mike Zaschka, TalkThe reasoning

Seen working9

ArtifactSignals
Samples9
@capire/data-viewerSample CAP plugin adding a generic data browser
Functional boundary
commonSample CAP plugin extending @sap/cds/common with reuse data
none
ordersSample CAP reuse service for orders, with a Fiori UI
Functional boundary
orders-javaSample CAP Java reuse service for orders, with a Fiori UI
Functional boundary
reviewsSample CAP reuse service for reviews, with a Fiori UI
Functional boundary
reviews-javaSample CAP Java reuse service for reviews, with a Vue UI
Functional boundary
SAP-samples/cap-tour-hands-onEight-exercise tour of CAP features, from mocking to plugins
none
shared-dbCAP sample sharing one domain model and database across apps
Functional boundary
shared-db-javaCAP Java sample sharing one domain model across several apps
Functional boundary

Details

What changed — and what it makes stale1
@sap/cds-dk 7.5.0, CAP

A plugin can implement a build plugin, registered with cds.build in its cds-plugin.js and run by cds build to write its own deployment artifacts; 7.6.0 on 2024-01-31 added contributing the build task type to the cds schema for code completion. Dated from npm.

Makes stale:

Advice that deployment artifacts a plugin needs must be produced by a script outside cds build.

SourceImplement Build Plugins — capirechecked
Coverage
statecore only, CAP
assessed
SourceCDS Plugin Packages — capirechecked SourceImplement Build Plugins — capirechecked SourceImplement Build Plugins — capirechecked SourceImplement Build Plugins — capirechecked SourceBuilding Plugins (CAP Java) — capirechecked SourceBuilding Plugins (CAP Java) — capirechecked SourcePlugins for cds add — capirechecked SourcePlugins for cds add — capirechecked SourceCDS Design Time APIs — capirechecked SourceCDS Design Time APIs — capirechecked
For your agent
Ref
capability:plugin-authoring
JSON
/capabilities/plugin-authoring.json
MCP
Connecting an agent