Guide
Build your first Deva from an empty folder - client and agent files, vars, a func, a method, a listener, and a stamped packet you can verify.
What you’ll build
In this guide you’ll build Hello Deva, a small working Deva that runs on your own computer. It knows who it is, knows who is talking to it, answers a question, and hands back a packet stamped with md5, sha256 and sha512 hashes, so you can check that nothing changed after it was stamped.
Hello Deva is small on purpose. Every Deva in the system, from License Deva to Socket Deva, is built from the same parts you’ll put together here, so once you finish you’ll know how any Deva is put together.
What you need
- Node.js 22 or newer, along with npm 9.5.1 or newer. Check your versions with
node -vandnpm -v. - A terminal and a text editor.
You don’t need any other packages. Deva Core has no dependencies.
The steps
The guide has 7 steps, and each one builds on the one before it. Every code block on these pages is meant to be copied and run exactly as written.
| Step | What you’ll do |
|---|---|
| 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. |
| 2. The client file | Write client.json, which describes who is talking to the Deva. |
| 3. The agent file | Write agent.json, which describes who the Deva is, including its vars and its own context labels. |
| 4. Wire it together | Import the client and agent files, build the info block from your package.json, and create the Deva. |
| 5. Give it skills | Add one func, one method and one listener, and see when to use each. |
| 6. Bring it to life | Call init(client), watch the Deva reach ready, ask it a question, and read the stamped packet that comes back. |
| 7. Shut it down | Stop the Deva cleanly with stop() and see what it answers once it is offline. |
Your project
By the end, your project will look like this:
hello-deva/
├── package.json
├── index.js
└── data/
├── client.json
└── agent.json
Ready?
Open a terminal, pick a place for your project, and head to Step 1: Set up the project.