# Installation

> Set up a Node.js or React Native (Expo) project and install Credo with its storage and key management packages.

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](https://credo.js.org/guides/next/agent-setup/storage/drizzle.md) in SQLite and keys with [Askar](https://credo.js.org/guides/next/agent-setup/storage/askar.md). On React Native, Askar stores both. Use Node.js for a server and React Native for a mobile wallet. [Choose your setup](https://credo.js.org/guides/next/getting-started.md#choose-your-setup) covers the other choices to make first.

## Set up the project

**Node.js**

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

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

Add TypeScript and [tsx](https://tsx.is) to run TypeScript files:

```bash
npm install --save-dev typescript tsx
```

```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.

**React Native**

Create an Expo app, or use an existing one:

```bash
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](https://docs.expo.dev/workflow/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**

```bash
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.

**React Native**

Install the peer dependencies of `@credo-ts/react-native` with `npx expo install`, so you get the versions that match your Expo SDK:

```bash
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:

```json
{
  "overrides": {
    "@credo-ts/react-native": {
      "expo-crypto": "$expo-crypto"
    }
  }
}
```

pnpm and Yarn print a peer dependency warning instead.

Then install Credo:

```bash
npm install @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`.

:::note[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

- [Your first agent](https://credo.js.org/guides/next/getting-started/first-agent.md) configures the agent and runs it.
- [Storage](https://credo.js.org/guides/next/agent-setup/storage.md) compares Drizzle with Askar.
