SAP

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
⤢ Open full site

Create a CAP Business Service with Node.js Using Visual Studio Code

Develop a sample business service using Core Data & Services (CDS), Node.js, and SQLite, by using the SAP Cloud Application Programming Model (CAP) and developing on your local environment.

Overview

You will learn

  • How to develop a sample business service using CAP and Node.js
  • How to define a simple data model and a service that exposes the entities you created in your data model
  • How to run your service locally
  • How to deploy the data model to an SQLite database
  • How to add custom handlers to serve requests that aren’t handled automatically
René Jeglinsky R René Jeglinsky September 1, 2026
Created on December 10, 2024
Contributors

More from René Jeglinsky

See all 13 tutorials by René Jeglinsky →

Prerequisites

Prerequisites

  • You’ve installed Node.js. Make sure you run the latest long-term support (LTS) version of Node.js with an even number like 20. Refrain from using odd versions, for which some modules with native parts will have no support and thus might even fail to install. In case of problems, see the Troubleshooting guide for CAP.
  • You’ve installed the latest version of Visual Studio Code (VS Code).
  • (Windows only) You’ve installed the SQLite tools for Windows. Find the steps how to install it in the How Do I Install SQLite section of the CAP documentation.
  • Install the cds command line tool as described on Capire
  • Install the VS-Code extensions as described on Capire
  • You’ve installed an HTTP client, for example, REST client.
  • If you don’t have a Cloud Foundry Trial subaccount and dev space on SAP BTP yet, create your Cloud Foundry Trial Account with US East (VA) as region and, if necessary Manage Entitlements. You need this to continue after this tutorial.

Steps

Windows macOS Linux BAS

Intro

Before you start, complete the prerequisites and select your OS so that your see the correct instructions for your setup.

Step 1 Start project

With your installed CDS command line tool, you can now create a new CAP-based project, in the form of a new directory with various things preconfigured, and run it.

In case of problems during installation, see the Troubleshooting guide in the CAP documentation for more details.

  1. Open a command line window and run the following command in a folder of your choice to create the project:

    Shell/Bash
    cds init my-bookshop --nodejs

    This creates a folder my-bookshop in the current directory.

  2. In VS Code, go to File Open Folder and choose the my-bookshop folder.

  3. Go to Terminal New Terminal to open a command line window within VS Code and run the following command in the root level of your project:

    Shell/Bash
    cds watch

    This command tries to start a cds server. Whenever you feed your project with new content, for example, by adding or modifying .cds, .json, or .js files, the server automatically restarts to serve the new content.

    As there’s no content in the project so far, it just keeps waiting for content with a message as shown:

    Shell/Bash
    cds serve all --with-mocks --in-memory? 
    ( live reload enabled for browsers ) 
    
            ___________________________
    
    
        No models found in db/,srv/,app/,app/*.
        Waiting for some to arrive...
  1. Open a command line window and run the following command in a folder of your choice to create the project:

    Shell/Bash
    cds init my-bookshop --nodejs

    This creates a folder my-bookshop in the current directory.

  2. Open VS Code, go to File Open and choose the my-bookshop folder.

  3. Go to View Command Palette Terminal: Create New Terminal to open a command line window within VS Code and run the following command in the root level of your project:

    Shell/Bash
    cds watch

    This command tries to start a cds server. Whenever you feed your project with new content, for example, by adding or modifying .cds, .json, or .js files, the server automatically restarts to serve the new content.

    As there’s no content in the project so far, it just keeps waiting for content with a message as shown:

    Shell/Bash
    cds serve all --with-mocks --in-memory? 
    ( live reload enabled for browsers ) 
    
            ___________________________
    
    
        No models found in db/,srv/,app/,app/*.
        Waiting for some to arrive...
  1. Open a command line window and run the following command in a folder of your choice to create the project:

    Shell/Bash
    cds init my-bookshop --nodejs

    This creates a folder my-bookshop in the current directory.

  2. Open VS Code, go to File Open and choose the my-bookshop folder.

  3. Go to View Command Palette Terminal: Create New Terminal to open a command line window within VS Code and run the following command in the root level of your project:

    Shell/Bash
    cds watch

    This command tries to start a cds server. Whenever you feed your project with new content, for example, by adding or modifying .cds, .json, or .js files, the server automatically restarts to serve the new content.

    As there’s no content in the project so far, it just keeps waiting for content with a message as shown:

    Shell/Bash
    cds serve all --with-mocks --in-memory? 
    ( live reload enabled for browsers ) 
    
            ___________________________
    
    
        No models found in db/,srv/,app/,app/*.
        Waiting for some to arrive...
Step 2 Define your first data model and service
+
Step 3 Add initial data
+
Step 4 Test generic handlers
+
Step 5 Add custom logic
+
Step 6 Extend CDS Model
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 6
1. Start project 2. Define your first data model and service 3. Add initial data 4. Test generic handlers 5. Add custom logic 6. Extend CDS Model
Next