Step 1: Set up the project
Create the project folder, set it up as an ES module, install Deva Core, and lay out the files you will fill in.
1. Check your tools
Deva Core needs Node.js 22 or newer and npm 9.5.1 or newer. Check what you have:
node -v
npm -v
If either version is older, update Node.js from nodejs.org before you go on. npm comes with it.
2. Create the project folder
mkdir hello-deva
cd hello-deva
npm init -y
npm init -y creates a package.json with default values. You can change the name, description and author in it later.
3. Set it up as an ES module
Deva Core is an ES module, and Hello Deva will use import to load Deva Core and its JSON files. Tell Node that your project uses modules too:
npm pkg set type=module
This adds "type": "module" to your package.json.
4. Install Deva Core
npm install @indra.ai/deva
Deva Core has no dependencies of its own, so this installs a single package.
To check that it installed and loads, run:
node --input-type=module -e "import Deva from '@indra.ai/deva'; console.log(typeof Deva);"
You should see:
function
5. Lay out the files
Create the main file and a data folder for the two JSON files you will write next:
mkdir data
touch index.js data/client.json data/agent.json
On Windows, create the data folder and the three empty files in your editor instead of using touch.
Your project now looks like this (node_modules and package-lock.json are left out):
hello-deva/
├── package.json
├── index.js
└── data/
├── client.json
└── agent.json
Your package.json should include these two entries. The version number may be newer than the one shown:
"type": "module",
"dependencies": {
"@indra.ai/deva": "^1.64.56"
}
What you did
- Create a folder and run npm init.
- Set “type”: “module” in package.json.
- Install @indra.ai/deva.
- Create index.js and the data folder.
Next
The files are empty for now. In Step 2: The client file you’ll fill in client.json, which describes who is talking to your Deva.