Skip to Content

Get Started with SAP Cloud SDK for JavaScript

0 %
Get Started with SAP Cloud SDK for JavaScript
// Explore More Tutorials

Get Started with SAP Cloud SDK for JavaScript


Scaffold an application that is ready to be used with the SAP Cloud SDK for JavaScript.


You will learn

  • How to scaffold (create from a template) your application
  • About the project’s structure
  • How to run the application locally

Step 1: Scaffold an application

To create an express.js (a minimal Node.js web application framework) application that already contains all the files and configuration you need to use the SAP S/4HANA Cloud SDK for JavaScript, simply clone our TypeScript scaffolding application as follows:

git clone --single-branch --branch scaffolding-ts --origin scaffolding <path/to/your/project>

Then enter the freshly cloned project:

cd <path/to/your/project>


If you cannot or do not want to use TypeScript, you can also checkout the JavaScript version. The tutorial will be based on TypeScript, but is easily applicable to JavaScript. The main differences you will notice are the type annotations and module definitions - ES6 modules in the TypeScript version vs. commonJS modules in the JavaScript version.

# clone the JavaScript version of the scaffolding above
git clone --single-branch --branch scaffolding-js --origin scaffold <path/to/your/project>
Log on to answer question
Step 2: Get familiar with the project

The project contains the following files and folders, among others, to get you started with the SAP Cloud SDK for JavaScript:

NPM / Project

  • package.json: Specifies dependencies, metadata and user-defined scripts. The provided scaffolding comes with some predefined scripts and dependencies, that will be explained in detail in the course of this group of tutorials. The scripts starting with ci- are used by the Continuous Delivery pipeline. We recommend not changing them for
  • .npmrc: The npm configuration file. In the scaffolding we specify the registry for the @sap scope, where the SAP S/4HANA Cloud SDK libraries are published. The registry for the SAP Cloud SDK for JavaScript is Please always double-check the registries specified in .npmrc file that you have not created yourself!


  • tsconfig.json: Configuration file for TypeScript. This is not present in the plain JavaScript version.

Continuous Delivery

  • Jenkinsfile: Jenkins pipeline definition file for quality assurance. It uses the SAP Cloud SDK's Continuous Delivery Toolkit.
  • pipeline_config.yml: Pipeline configuration file for the Jenkins pipeline.
  • cx-server/: A directory containing scripts to quickly deploy and start your own CI / CD server based on Jenkins.

Cloud Foundry

  • manifest.yml: The deployment descriptor file for Cloud Foundry in SAP Cloud Platform.

Local development

  • initialize.js: Script for initial setup.

  • src/: Source code for an initial hello world express application.

Log on to answer question
Step 3: Run the application

Before you can run the app, you should run the initialization script. This will install your dependencies and replace some placeholders with your application name. This is only necessary once at the start of development. Feel free to delete this file afterwards.

npm run init -- <YOUR-APPLICATION-NAME>

Now, you are all set to start the application, run:

npm run start:local

Go to http://localhost:8080/hello and you should get a ‘Hello, World!’ in response.
To stop the server again, press ctrl + c in your command line.
Alternatively, you also use watch:local instead of run:local.
This will run the server and will automatically restart and update it whenever you change some of the source files.

Log on to answer question
Step 4: Use the SDK in existing project (optional)

If you already have an existing project, you will need to specify the registry for the @sap scope, in order to make the SAP Cloud SDK for JavaScript libraries available. If it does not yet exist create a .npmrc file in the root folder of your project. Paste the following line into it:


Note: Please be cautious when adding registries to your npm configuration and make sure that you trust the registry!
Now you can install the necessary libraries, first of all the @sap/cloud-sdk-core, the heart of the SAP Cloud SDK for JavaScript and basis for the service libraries you might want to use.

npm install @sap/cloud-sdk-core

We recommend to also take a look at the continuous delivery artifacts in the scaffold application and adopt those along with the respective npm scripts.

Log on to answer question

That’s it! You should now have a running application that is ready to be integrated with SAP S/4HANA Cloud.

Step 5: Test yourself
Which of the following files are part of the scaffolding introduced above?

This tutorial is part of a larger series.
You can find the next entry [here](Create Your First Application with SAP Cloud SDK for JavaScript).
For questions, you can reach out to us on StackOverflow using the tag sap-cloud-sdk and on using the tag SAP S/4HANA Cloud SDK.

Next Steps

Back to top