Skip to main content
Version: 0.8 (next)

Installation

This page sets up a project and installs Credo, its platform package, and the packages for storage and keys. Every agent needs a storage module. On Node.js the next pages store records with Drizzle in SQLite and keys with Askar. On React Native, Askar stores both. Use Node.js for a server and React Native for a mobile wallet. Choose your setup covers the other choices to make first.

Set up the project​

Credo needs Node.js 22 or later. It's published as ES modules only, so create a project with "type": "module":

mkdir my-agent
cd my-agent
npm init -y
npm pkg set type=module

Add TypeScript and tsx to run TypeScript files:

npm install --save-dev typescript tsx
tsconfig.json
{
"compilerOptions": {
"module": "nodenext",
"strict": true,
"skipLibCheck": true
}
}
  • "module": "nodenext" resolves the exports of the Credo packages, including subpaths such as @credo-ts/core/kms. "moduleResolution": "bundler" works too. The older "node" resolution doesn't find subpaths.
  • skipLibCheck is needed because some of Credo's dependencies ship type definitions that don't type-check.

Install Credo​

Keep all @credo-ts/* packages on the same version. They depend on each other with exact versions.

npm install \
@credo-ts/core@alpha \
@credo-ts/node@alpha \
@credo-ts/drizzle-storage@alpha \
drizzle-orm@^0.45.4 \
@libsql/client \
@credo-ts/askar@alpha \
@openwallet-foundation/askar-nodejs@0.6.1

@libsql/client is the SQLite driver for Drizzle. Keep drizzle-orm on the version range shown, which @credo-ts/drizzle-storage requires.

The Askar platform package depends on @openwallet-foundation/askar-shared with its exact version, and @credo-ts/askar needs the same copy. Install a single Askar version: with two versions of askar-shared in your project, agent.initialize() fails with Native askar has not been registered yet.

pnpm and Bun

The Askar packages download their native library in an install script. pnpm and Bun don't run install scripts of dependencies unless you allow them. With pnpm, run pnpm approve-builds. With Bun, add the package to trustedDependencies in your package.json.

Next steps​