# moralis

> Moralis SDK for JavaScript and TypeScript

Latest version **2.27.2** (published 2024-08-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install moralis
pnpm add moralis
yarn add moralis
bun add moralis
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; large bundle.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.27.2 |
| Published | 2024-08-12 |
| First published | 2021-02-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 13 |
| Unpacked size | 11.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Moralis |
| Maintainers | locothedev, ernow, cicdmoralis, y0moo, capplequoppe, gerardo15, ivanontech |
| Keywords | ethereum, binance, avalanche, fantom, solana, nft, dapps, blockchain, crypto, web3, evm, eth, smart-contracts, contracts |

## Links

- npm: https://www.npmjs.com/package/moralis
- Repository: https://github.com/MoralisWeb3/Moralis-JS-SDK
- Homepage: https://github.com/MoralisWeb3/Moralis-JS-SDK#readme
- Issues: https://github.com/MoralisWeb3/Moralis-JS-SDK/issues
- npm.io page: https://npm.io/package/moralis

## Dependencies (13)

- [@moralisweb3/auth](https://npm.io/package/@moralisweb3/auth.md) ^2.27.2
- [@moralisweb3/evm-api](https://npm.io/package/@moralisweb3/evm-api.md) ^2.27.2
- [@moralisweb3/sol-api](https://npm.io/package/@moralisweb3/sol-api.md) ^2.27.2
- [@moralisweb3/streams](https://npm.io/package/@moralisweb3/streams.md) ^2.27.2
- [@moralisweb3/api-utils](https://npm.io/package/@moralisweb3/api-utils.md) ^2.27.2
- [@moralisweb3/aptos-api](https://npm.io/package/@moralisweb3/aptos-api.md) ^2.27.2
- [@moralisweb3/common-core](https://npm.io/package/@moralisweb3/common-core.md) ^2.27.2
- [@moralisweb3/streams-typings](https://npm.io/package/@moralisweb3/streams-typings.md) ^1.0.7
- [@moralisweb3/common-evm-utils](https://npm.io/package/@moralisweb3/common-evm-utils.md) ^2.27.2
- [@moralisweb3/common-sol-utils](https://npm.io/package/@moralisweb3/common-sol-utils.md) ^2.27.2
- [@moralisweb3/common-auth-utils](https://npm.io/package/@moralisweb3/common-auth-utils.md) ^2.27.2
- [@moralisweb3/common-aptos-utils](https://npm.io/package/@moralisweb3/common-aptos-utils.md) ^2.27.2
- [@moralisweb3/common-streams-utils](https://npm.io/package/@moralisweb3/common-streams-utils.md) ^2.27.2

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 2.27.2 (latest) — 2024-08-12
- 2.0.0-beta.11 (beta) — 2022-08-10
- 2.0.0-alpha.4 (alpha) — 2022-08-03
- 2.27.1 — 2024-07-31
- 2.27.0 — 2024-07-26
- 2.26.9 — 2024-07-12
- 2.26.8 — 2024-07-05
- 2.26.7 — 2024-06-26
- 2.26.6 — 2024-06-24
- 2.26.5 — 2024-06-18
- 2.26.4 — 2024-06-10
- 2.26.3 — 2024-06-04
- 2.26.2 — 2024-05-17
- 2.26.1 — 2024-04-19
- 2.26.0 — 2024-04-18
- … 327 more at https://npm.io/package/moralis/versions

## README

<!--
  CAUTION: This file is automatically generated. Do not edit it manually!
  To adjust it, change the sdk-readme code generator or its template
-->
<div align="center">
    <a align="center" href="https://moralis.io" target="_blank">
      <img src="https://github.com/MoralisWeb3/Moralis-JS-SDK/raw/main/assets/moralis-logo.svg" alt="Moralis JS SDK" height=200/>
    </a>
    <h1 align="center">Moralis SDK (JavaScript / TypeScript)</h1>
    <a href="https://discord.gg/moralis" target="_blank">
      <img alt="Join the Moralis DAO on Discord" src="https://img.shields.io/discord/819584798443569182?color=7289DA&label=Discord&logo=discord&logoColor=ffffff">
    </a>
    <a href="https://docs.moralis.io" target="_blank">
      <img alt="Check the docs" src="https://img.shields.io/badge/Docs-Full Documentation-21BF96?style=flat&logo=gitbook&logoColor=ffffff">
    </a>
    <a href="https://forum.moralis.io" target="_blank">
      <img alt="Discourse posts" src="https://img.shields.io/discourse/posts?color=B7E803&label=Forum&logo=discourse&server=https%3A%2F%2Fforum.moralis.io">
    </a><br/>
    <img alt="npm" src="https://img.shields.io/npm/v/moralis?label=version">
    <img src="https://img.shields.io/github/last-commit/MoralisWeb3/Moralis-JS-SDK">
    <img src="https://img.shields.io/bundlephobia/minzip/moralis">
    <img src="https://img.shields.io/npm/types/moralis">
  <p>
  </p>
  <p>
    The most powerful Web3 library for your backend in Javascript and Typescript.
  </p>
  <br/>
</div>

---

**Features**:

- Web3 authentication
- Make **Evm API** and **Solana API** calls
- Subscribe to real-time blockchain updates via **Streams**
- Consistent data types and utilities
- **Modular** package: include only what you need
- Fully **Typescript** ready out-of-the box

... and much more. Check the [official Moralis docs](https://docs.moralis.io/) for more details.

# 🚀 Quick start

If you're new to Moralis, check the [quickstart guide in the official docs](https://docs.moralis.io/docs/quickstart) on how to get started.

If you're already familiar with Moralis and have your server set up. Then follow along to connect your SDK:

## 1. Install Moralis

The easiest way to integrate the Moralis SDK into your JavaScript project is through the npm module.

Install the package via `npm`:

```shell
npm install moralis
```

or `yarn`:

```shell
yarn add moralis
```

Import Moralis:

```js
import Moralis from 'moralis';
```

## 2. Initialize Moralis

After your dependency is added, you simply need to initialize moralis via the `start` method:

> **⚠️ Warning**: Make sure to keep your api key private

```javascript
Moralis.start({
  apiKey: 'YOUR_API_KEY',
});
```

After that you can use any Moralis functionalities as described in our [extensive docs](https://docs.moralis.io)

# ⭐️ Star us

If this JS SDK helps you build your dapps faster - please star this project, every star makes us very happy!

# 🤝 Need help

If you need help with setting up the boilerplate or have other questions - don't hesitate to write in our community forum and we will check asap. [Forum link](https://forum.moralis.io). The best thing about this SDK is the super active community ready to help at any time! We help each other.

# 🧭 Table of Contents

- [🚀 Quick start](#-quick-start)
  - [1. Install Moralis](#1-install-moralis)
  - [2. Initialize Moralis](#2-initialize-moralis)
- [⭐️ Star us](#️-star-us)
- [🤝 Need help](#-need-help)
- [🧭 Table of Contents](#-table-of-contents)
- [⚙️ Configuration](#️-configuration)
- [👩‍🔬 Advanced setup](#-advanced-setup)
  - [1. Install the dependencies](#1-install-the-dependencies)
- [📦 Packages](#-packages)
- [🧙‍♂️ Community](#️-community)

# ⚙️ Configuration

When calling `Moralis.start`, you can include a configuration object.

# 👩‍🔬 Advanced setup

It's possible to install all functionalities of Moralis by installing `moralis` as a dependency. But, you may choose to only install certain modules (as listed below).

## 1. Install the dependencies

Instead of installing `moralis` you can need to install the packages that you want to use. You always need to install the `@moralisweb3/common-core` package. For example:

```shell
yarn add @moralisweb3/common-core @moralisweb3/evm-api
```

Then at the top of your code (before any interaction with Moralis), you need to register the modules to the core package

```javascript
import Core from '@moralisweb3/common-core';
import EvmApi from '@moralisweb3/evm-api';

const core = Core.create();
// Register all imported modules to the @moralisweb3/common-core module
core.registerModules([EvmApi]);
```

Then, initialize the app the same way as when using the umbrella `moralis` package. You only need to provide configuration that is required by the packages. So if you don't include an api package, then you might not need to include the apiKey.

```javascript
core.start({
  apiKey: 'YOUR_API_KEY',
  // ...and any other configuration
});
```

Now you can use any functionality from the installed modules. The only difference is that you need to call in your code:

```ts
import EvmApi from '@moralisweb3/evm-api';

const evmApi = core.getModule<EvmApi>(EvmApi.moduleName);
evmApi.block.getBlock();
```

Instead of

```javascript
import Moralis from 'moralis';

Moralis.EvmApi.block.getBlock();
```

Of course you are free to combine the modules in a single object, and use that in your dapp.

```javascript
// moralis.ts
import { Core } from '@moralisweb3/common-core';
import EvmApi from '@moralisweb3/evm-api';

const core = Core.create();
const evmApi = EvmApi.create(core);
core.registerModules([evmApi]);

export const Moralis = {
  EvmApi: evmApi,
};

// app.ts
import { Moralis } from './moralis/';

Moralis.EvmApi.block.getBlock();
```

# 📦 Packages

## Main modules

The main modules of the SDK

| package              | changelog              | description                                                                                 |
| -------------------- | ---------------------- | ------------------------------------------------------------------------------------------- |
| [moralis](README.md) | [2.17.0](CHANGELOG.md) | The main package of Moralis containing all features. You probably are looking for this one. |

## Integrations

Integrations with frameworks and services

| package                                               | changelog                             | description                            |
| ----------------------------------------------------- | ------------------------------------- | -------------------------------------- |
| [@moralisweb3/next](../next/README.md)                | [2.17.0](../next/CHANGELOG.md)        | Integration of Moralis in NextJs       |
| [@moralisweb3/parse-server](../parseServer/README.md) | [2.17.0](../parseServer/CHANGELOG.md) | Integration of Moralis in parse-server |

## Features

Feature modules. Only use these directly for advanced use-cases, the prefered way is to use these features via the umbrella package &quot;moralis&quot;

| package                                      | changelog                         | description                                                 |
| -------------------------------------------- | --------------------------------- | ----------------------------------------------------------- |
| [@moralisweb3/auth](../auth/README.md)       | [2.17.0](../auth/CHANGELOG.md)    | Authenticate via web3                                       |
| [@moralisweb3/evm-api](../evmApi/README.md)  | [2.17.0](../evmApi/CHANGELOG.md)  | Make calls to the Evm blockchain via Moralis Evm Apis       |
| [@moralisweb3/sol-api](../solApi/README.md)  | [2.17.0](../solApi/CHANGELOG.md)  | Make calls to the Solana blockchain via Moralis Solana Apis |
| [@moralisweb3/streams](../streams/README.md) | [2.17.0](../streams/CHANGELOG.md) | Subscribe to realtime data from the blockchain              |

## Core modules

Core modules are the building blocks of Moralis.

| package                                              | changelog                             | description                       |
| ---------------------------------------------------- | ------------------------------------- | --------------------------------- |
| [@moralisweb3/common-core](../common/core/README.md) | [2.17.0](../common/core/CHANGELOG.md) | All core logic related to the SDK |

## Utilities

Utilities, types, operations and datatypes related used by other modules.

| package                                                               | changelog                                     | description                                                   |
| --------------------------------------------------------------------- | --------------------------------------------- | ------------------------------------------------------------- |
| [@moralisweb3/api-utils](../apiUtils/README.md)                       | [2.17.0](../apiUtils/CHANGELOG.md)            | Utilities and types to handle logic for api calls             |
| [@moralisweb3/client-api-utils](../client/apiUtils/README.md)         | [2.17.0](../client/apiUtils/CHANGELOG.md)     | Client-side utilities for api calls                           |
| [@moralisweb3/client-evm-api](../client/evmApi/README.md)             | [2.17.0](../client/evmApi/CHANGELOG.md)       | Client-side logic for making Evm Api calls                    |
| [@moralisweb3/client-sol-api](../client/solApi/README.md)             | [2.17.0](../client/solApi/CHANGELOG.md)       | Client-side logic for making Solana Api calls                 |
| [@moralisweb3/common-aptos-utils](../common/aptosUtils/README.md)     | [2.17.0](../common/aptosUtils/CHANGELOG.md)   | Utilities, operations, datatypes and types related to Aptos   |
| [@moralisweb3/common-auth-utils](../common/authUtils/README.md)       | [2.17.0](../common/authUtils/CHANGELOG.md)    | Utilities, operations, datatypes, and types related to Auth   |
| [@moralisweb3/common-evm-utils](../common/evmUtils/README.md)         | [2.17.0](../common/evmUtils/CHANGELOG.md)     | Utilities, operations, datatypes and types related to Evm     |
| [@moralisweb3/common-sol-utils](../common/solUtils/README.md)         | [2.17.0](../common/solUtils/CHANGELOG.md)     | Utilities, operations, datatypes and types related to Solana  |
| [@moralisweb3/common-streams-utils](../common/streamsUtils/README.md) | [2.17.0](../common/streamsUtils/CHANGELOG.md) | Utilities, operations, datatypes and types related to Streams |

## Tools

Stand-alone tools and utilities

| package                                                 | changelog                             | description                                                     |
| ------------------------------------------------------- | ------------------------------------- | --------------------------------------------------------------- |
| [@moralisweb3/eslint-config](../eslintConfig/README.md) | [1.0.3](../eslintConfig/CHANGELOG.md) | Eslint rules, used within the Moralis SDK and its demo projects |



# 🧙‍♂️ Community

- [Discord](https://discord.gg/moralis)
- [Forum](https://forum.moralis.io)

---
_Source: https://npm.io/package/moralis · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
