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
- Node.js
- React Native
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
- pnpm
- yarn
- bun
npm install --save-dev typescript tsx
pnpm add -D typescript tsx
yarn add -D typescript tsx
bun add -d typescript tsx
{
"compilerOptions": {
"module": "nodenext",
"strict": true,
"skipLibCheck": true
}
}
"module": "nodenext"resolves theexportsof the Credo packages, including subpaths such as@credo-ts/core/kms."moduleResolution": "bundler"works too. The older"node"resolution doesn't find subpaths.skipLibCheckis needed because some of Credo's dependencies ship type definitions that don't type-check.
Create an Expo app, or use an existing one:
npx create-expo-app@latest my-wallet
Credo uses native modules, so it doesn't run in Expo Go. Build the app with Continuous Native Generation, for example with npx expo run:android and npx expo run:ios or with EAS Build. Expo's TypeScript and Metro defaults work with Credo's ES modules, so you don't need to change them.
Install Credo
Keep all @credo-ts/* packages on the same version. They depend on each other with exact versions.
- Node.js
- React Native
- npm
- pnpm
- yarn
- bun
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
pnpm add \
@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
yarn add \
@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
bun add \
@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.
Install the peer dependencies of @credo-ts/react-native with npx expo install, so you get the versions that match your Expo SDK:
npx expo install expo-crypto react-native-get-random-values @dr.pogodin/react-native-fs
| Package | Why Credo needs it |
|---|---|
react-native-get-random-values | Secure random numbers. @credo-ts/react-native imports it for you, so you don't need a polyfill in your entry file. |
expo-crypto | Hashing in the JSON-LD libraries Credo uses. |
@dr.pogodin/react-native-fs | File system access. react-native-fs works too. Importing @credo-ts/react-native throws if neither is installed. |
@credo-ts/react-native declares expo-crypto@^15 as its peer range, which only matches Expo SDK 54. With a newer SDK, npm refuses to install Credo with an ERESOLVE error. Add an override to your package.json first:
{
"overrides": {
"@credo-ts/react-native": {
"expo-crypto": "$expo-crypto"
}
}
}
pnpm and Yarn print a peer dependency warning instead.
Then install Credo:
- npm
- pnpm
- yarn
- bun
npm install \
@credo-ts/core@alpha \
@credo-ts/react-native@alpha \
@credo-ts/askar@alpha \
@openwallet-foundation/askar-react-native@0.6.1
pnpm add \
@credo-ts/core@alpha \
@credo-ts/react-native@alpha \
@credo-ts/askar@alpha \
@openwallet-foundation/askar-react-native@0.6.1
yarn add \
@credo-ts/core@alpha \
@credo-ts/react-native@alpha \
@credo-ts/askar@alpha \
@openwallet-foundation/askar-react-native@0.6.1
bun add \
@credo-ts/core@alpha \
@credo-ts/react-native@alpha \
@credo-ts/askar@alpha \
@openwallet-foundation/askar-react-native@0.6.1
@openwallet-foundation/askar-react-native is linked automatically and doesn't need a config plugin. Rebuild the native app after you install it.
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.
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
- Your first agent configures the agent and runs it.
- Storage compares Drizzle with Askar.