CAP Plugins Complete Reference
All Available Plugins (15)
| # | Plugin | Node.js Package | Java Package | Purpose |
|---|---|---|---|---|
| 1 | OData V2 Adapter | @cap-js-community/odata-v2-adapter |
Built-in | Legacy OData V2 support |
| 2 | WebSocket | @cap-js-community/websocket |
- | Real-time communication |
| 3 | UI5 Dev Server | ui5-ecosystem-showcase/cds-plugin-ui5 |
- | UI5 tooling integration |
| 4 | GraphQL Adapter | @cap-js/graphql |
- | GraphQL protocol |
| 5 | Attachments | @cap-js/attachments |
cds-feature-attachments |
File management |
| 6 | SAP Document Mgmt | @cap-js/sdm |
cap-java/sdm |
CMIS repository |
| 7 | Audit Logging | @cap-js/audit-logging |
Built-in | Personal data logging |
| 8 | Change Tracking | @cap-js/change-tracking |
Built-in | Change history |
| 9 | Notifications | @cap-js/notifications |
- | SAP Build WorkZone alerts |
| 10 | Telemetry | @cap-js/telemetry |
Built-in | OpenTelemetry |
| 11 | ORD | @cap-js/ord |
Built-in | Resource discovery |
| 12 | CAP Operator | @cap-js/cap-operator-plugin |
Available | K8s lifecycle |
| 13 | Event Hub | @cap-js/event-broker |
cds-feature-event-hub |
S/4HANA events |
| 14 | Advanced Event Mesh | @cap-js/advanced-event-mesh |
cds-feature-advanced-event-mesh |
Cross-platform events |
| 15 | ABAP RFC | @sap/cds-rfc |
- | RFC function modules |
1. OData V2 Adapter
Converts OData V2 requests to V4 for legacy UI support.
Installation (Node.js)
npm add @cap-js-community/odata-v2-adapterUse Cases
- Legacy SAP UI5 applications
- Tree tables (require V2)
- Existing OData V2 consumers
Configuration
{
"cds": {
"odata_v2": {
"path": "/odata/v2"
}
}
}2. WebSocket
Real-time bidirectional communication via WebSocket or Socket.IO.
Installation
npm add @cap-js-community/websocketService Definition
@protocol: 'websocket'
service ChatService {
function message(text: String) returns String;
event received { text: String; }
}Client Usage
const socket = io('/chat')
socket.emit('message', { text: 'Hello' })
socket.on('received', msg => console.log(msg))3. UI5 Dev Server
Integrates UI5 tooling into CDS development server.
Installation
npm add @syg-de/cds-plugin-ui5Features
- Serves dynamic UI5 resources
- Auto-transpiles TypeScript
- Hot module replacement
4. GraphQL Adapter
Generates GraphQL schema from CDS models.
Installation
npm add @cap-js/graphqlConfiguration
{
"cds": {
"protocols": {
"graphql": {
"path": "/graphql",
"impl": "@cap-js/graphql"
}
}
}
}Service Definition
@protocol: 'graphql'
service CatalogService {
entity Books { ... }
}Features
- Automatic schema generation
- Queries and mutations
- GraphQL Playground at
/graphql
5. Attachments
Out-of-the-box file handling with malware scanning.
Installation
npm add @cap-js/attachmentsUsage
using { Attachments } from '@cap-js/attachments';
entity Incidents {
key ID : UUID;
attachments : Composition of many Attachments;
}Features
- Upload/download via OData
- Malware scanning integration
- Automatic Fiori annotations
- Streaming (prevents memory overload)
- Multiple storage backends
- Multitenancy support
Storage Backends
{
"cds": {
"requires": {
"attachments": {
"[production]": { "kind": "sdm" }, // SAP Document Management
"[development]": { "kind": "db" } // Database (default)
}
}
}
}Java
<dependency>
<groupId>com.sap.cds</groupId>
<artifactId>cds-feature-attachments</artifactId>
</dependency>6. SAP Document Management (SDM)
Stores attachments in SAP Document Management Service.
Installation
npm add @cap-js/sdmFeatures
- CMIS-compliant repository
- Automatic repository provisioning
- File operations (upload, view, download, delete, rename)
- Malware scanning
- Multitenancy handling
Usage
using { Attachments } from '@cap-js/sdm';
extend my.Incidents with {
attachments : Composition of many Attachments;
}7. Audit Logging
Logs personal data access for GDPR compliance.
Installation
npm add @cap-js/audit-loggingConfiguration
{
"cds": {
"requires": {
"audit-log": {
"[production]": { "kind": "audit-log-service" },
"[development]": { "kind": "console" }
}
}
}
}Annotations
annotate my.Customers with @PersonalData: {
EntitySemantics: 'DataSubject',
DataSubjectRole: 'Customer'
} {
ID @PersonalData.FieldSemantics: 'DataSubjectID';
name @PersonalData.IsPotentiallyPersonal;
email @PersonalData.IsPotentiallyPersonal;
creditCard @PersonalData.IsPotentiallySensitive;
}Features
- Automatic logging on annotated entities
- Console logging (development)
- SAP Audit Log Service (production)
- Transactional outbox
8. Change Tracking
Captures and displays entity change history.
Installation
npm add @cap-js/change-trackingUsage
annotate my.Incidents {
customer @changelog: [customer.name];
title @changelog;
status @changelog;
}Features
- Automatic change capture
- Fiori timeline integration
- Association tracking
- Configurable fields
Java
Built-in feature with documentation.
9. Notifications
Publishes business notifications in SAP Build WorkZone.
Installation
npm add @cap-js/notificationsUsage
const alert = await cds.connect.to('notifications')
await alert.notify({
recipients: [userId],
title: 'New Incident Created',
description: incident.title,
priority: 'HIGH'
})Features
- CAP Services API
- Console logging (development)
- Transactional outbox
- Notification templates with i18n
- Automatic lifecycle management
10. Telemetry
OpenTelemetry instrumentation for observability.
Installation
npm add @cap-js/telemetryConfiguration
{
"cds": {
"requires": {
"telemetry": {
"kind": "to-cloud-logging"
}
}
}
}Export Targets
| Target | Description |
|---|---|
to-console |
Development output |
to-cloud-logging |
SAP Cloud Logging |
to-dynatrace |
Dynatrace |
to-jaeger |
Jaeger (Node.js only) |
Features
- Automatic span creation
- Request tracing
- Performance metrics
11. ORD (Open Resource Discovery)
Generates ORD documents for metadata discovery.
Installation
npm add @cap-js/ordUse Cases
- Static metadata catalogs
- Runtime system landscape inspection
- Service Provider Interface
12. CAP Operator for Kubernetes
Automates multitenant CAP app lifecycle on K8s.
Installation
npm add @cap-js/cap-operator-pluginFeatures
- Generates customizable Helm charts
- Reduces manual K8s configuration
- Multitenant support
13. SAP Cloud Application Event Hub
Consumes events from SAP S/4HANA Cloud.
Installation
npm add @cap-js/event-brokerUsage
const S4Bupa = await cds.connect.to('API_BUSINESS_PARTNER')
S4Bupa.on('BusinessPartner.Changed', async msg => {
const { BusinessPartner } = msg.data
// Handle event
})Java
<dependency>
<groupId>com.sap.cds</groupId>
<artifactId>cds-feature-event-hub</artifactId>
</dependency>14. SAP Integration Suite, Advanced Event Mesh
Integrates non-SAP systems into event-driven architecture.
Installation
npm add @cap-js/advanced-event-meshUse Case
Cross-platform event management for heterogeneous environments.
Java
<dependency>
<groupId>com.sap.cds</groupId>
<artifactId>cds-feature-advanced-event-mesh</artifactId>
</dependency>15. ABAP RFC
Imports and calls RFC-enabled function modules.
Installation
npm add @sap/cds-rfcUse Case
Direct integration with ABAP systems via RFC.
Database Plugins
| Plugin | Package | Purpose |
|---|---|---|
| SQLite | @cap-js/sqlite |
Development database |
| SAP HANA | @cap-js/hana |
Production database |
| PostgreSQL | @cap-js/postgres |
Alternative production |
Creating Custom Plugins
Plugin Structure
my-plugin/
├── package.json
├── cds-plugin.js
└── lib/
└── handlers.jspackage.json
{
"name": "@my-org/cds-plugin-custom",
"cds": {
"plugin": true
}
}cds-plugin.js
const cds = require('@sap/cds')
// Bootstrap hook
cds.on('bootstrap', app => {
app.use('/custom', require('./lib/handlers'))
})
// Served hook
cds.on('served', async () => {
console.log('Plugin initialized')
})
// Add service
cds.on('loaded', model => {
// Modify model
})Handler Registration
// Register for specific services
cds.on('serving', 'CatalogService', srv => {
srv.on('READ', 'Books', async (req, next) => {
// Custom logic
return next()
})
})Plugin Configuration Patterns
Profile-Based
{
"cds": {
"requires": {
"my-plugin": {
"[development]": { "kind": "mock" },
"[production]": { "kind": "real" }
}
}
}
}Service Binding
Plugins auto-detect VCAP_SERVICES bindings.
Manual Credentials
{
"cds": {
"requires": {
"my-plugin": {
"credentials": {
"url": "https://api.example.com",
"apiKey": "..."
}
}
}
}
}Community Resources
- CAP JS Community: https://github.com/cap-js-community
- Best of CAP JS: https://bestofcapjs.org/
- SAP Community: https://community.sap.com/
Support
- Open issue in plugin's GitHub repository
- Ask question in SAP Community
- Open incident via SAP Support Portal (official plugins only)