• Stars
    star
    365
  • Rank 116,129 (Top 3 %)
  • Language
    TypeScript
  • License
    Other
  • Created about 3 years ago
  • Updated 19 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Moralis Official Javascript SDK
Moralis JS SDK

Moralis SDK (JavaScript / TypeScript)

Join the Moralis DAO on Discord Check the docs Discourse posts
npm

The most powerful Web3 library for your backend in Javascript and Typescript.



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 for more details.

๐Ÿš€ Quick start

If you're new to Moralis, check the quickstart guide in the official docs 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:

npm install moralis

or yarn:

yarn add moralis

Import Moralis:

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

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

After that you can use any Moralis functionalities as described in our extensive docs

โญ๏ธ 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. The best thing about this SDK is the super active community ready to help at any time! We help each other.

๐Ÿงญ Table of Contents

โš™๏ธ 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:

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

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.

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:

import { EvmApi } from '@moralisweb3/evm-api';

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

Instead of

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.

// 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 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 CHANGELOG.md Integration of Moralis in NextJs
@moralisweb3/parse-server 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 "moralis"

package changelog description
@moralisweb3/auth CHANGELOG.md Authenticate via web3
@moralisweb3/evm-api CHANGELOG.md Make calls to the Evm blockchain via Moralis Evm Apis
@moralisweb3/sol-api CHANGELOG.md Make calls to the Solana blockchain via Moralis Solana Apis
@moralisweb3/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 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 CHANGELOG.md Utilities and types to handle logic for api calls
@moralisweb3/client-api-utils CHANGELOG.md Client-side utilities for api calls
@moralisweb3/client-evm-api CHANGELOG.md Client-side logic for making Evm Api calls
@moralisweb3/client-sol-api CHANGELOG.md Client-side logic for making Solana Api calls
@moralisweb3/common-aptos-utils CHANGELOG.md Utilities, operations, datatypes and types related to Aptos
@moralisweb3/common-auth-utils CHANGELOG.md Utilities, operations, datatypes, and types related to Auth
@moralisweb3/common-evm-utils CHANGELOG.md Utilities, operations, datatypes and types related to Evm
@moralisweb3/common-sol-utils CHANGELOG.md Utilities, operations, datatypes and types related to Solana
@moralisweb3/common-streams-utils CHANGELOG.md Utilities, operations, datatypes and types related to Streams

Tools

Stand-alone tools and utilities

package changelog description
@moralisweb3/eslint-config CHANGELOG.md Eslint rules, used within the Moralis SDK and its demo projects

๐Ÿง™โ€โ™‚๏ธ Community

More Repositories

1

youtube-tutorials

C#
624
star
2

react-moralis

Hooks and components to use Moralis in a React app
TypeScript
622
star
3

unity-web3-game-kit

Unity Web3 Game Kit is the fastest way to connect and build games for Web3. It provides a single workflow for building high performance dapps. Fully compatible with your favourite platform.
C#
527
star
4

demo-apps

Python
392
star
5

web3-unity-sdk

Moralis Web3 Unity SDK provides full wallet and blockchain integration for your Unity Game. Full cross-chain and L2 support. Feel free to fork and contribute.
C#
147
star
6

MoralisDocumentation

This is the official repository for DEPRECATED V1 Moralis Documentation hosted in Gitbooks.
63
star
7

moralis-blueprints

JavaScript
51
star
8

course-resources

HTML
41
star
9

changelog

Moralis Changelog - Subscribe to this repo to not miss important updates and breaking changes ๐Ÿ””
34
star
10

Moralis-Python-SDK

Python
29
star
11

docs

Official documentation of Moralis Web3
TypeScript
27
star
12

web3-dotnet-sdk

Official Moralis C# .NET SDK
C#
25
star
13

issue-tracker

25
star
14

vanilla-boilerplate

Boilerplate Moralis Project made with vanilla JS
HTML
23
star
15

web3-unity-sdk-sample-game-scw

The "Sim City Web3" sample game demonstrates the Moralis Web3 Unity SDK, geo mapping, and NFTs.
C#
22
star
16

unity-web3-sample-elden-ring

Web3 Elden Ring Tutorial Code - Web3 Game Programming
C#
21
star
17

moralis-money-faq

Moralis Money FAQ
15
star
18

plugindocs

14
star
19

web3-unity-sdk-sample-game-wump

The "Web3 Unity Multiplayer Playground" sample game offers users a shared environment to move, trade currency, and trade NFTs.
C#
13
star
20

streams-beta

13
star
21

unity-web3-sample-nft-shop

C#
9
star
22

bsc-node-setup

Connect to Binance Smart Chain Node with Moralis
HTML
9
star
23

unity-web3-sample-ar-metaverse

AR Metaverse sample project created with Unity and Moralis
C#
8
star
24

moralis-analytics-js

JavaScript
8
star
25

Moralis-JS-SDK-v1

Moralis Official Javascript SDK v1 (see https://github.com/MoralisWeb3/Moralis-JS-SDK for the latest version)
JavaScript
8
star
26

MoralisCSharp

.NET C# Moralis SDK
C#
8
star
27

firebase-extensions

Moralis extensions for Firebase
TypeScript
6
star
28

unity-web3-sample-nft-powerup

Consume an already minted NFT and use its attributes to power up a 3D character movement. Get ready for some Invincible Super Mario vibes!
C#
6
star
29

templates

Frontend templates for applications built with Moralis and Moralis plugins.
5
star
30

parse-server-moralis-streams

JavaScript
5
star
31

demo-app

Moralis API Demos
JavaScript
5
star
32

unity-web3-nft-minter

Sample project to serve you as a tool to mint NFTs from Unity
ShaderLab
5
star
33

create-moralis-dapp

TypeScript
5
star
34

web3-unity-sdk-examples

This "Web3 Unity SDK Examples" project is a suite of standalone Unity scenes showcasing key features of the Web3 Unity SDK.
C#
4
star
35

angular-moralis

Moralis Angular
4
star
36

web3-unity-sdk-sample-game-wmtc

The "Web3 Magic Treasure Chest" sample game requires the user to pay to open the chest, then randomly win rewards including gold currency and prize NFTs
C#
4
star
37

unity-web3-sample-skyrim-market

Unity sample project where you can trade in-game currency (PlayFab) for ERC-20 tokens. Only with that tokens you can then buy NFT Outfits which you can actually wear!
C#
4
star
38

web3-providers-ws

JavaScript
4
star
39

matic-tac-toe

TypeScript
3
star
40

unity-web3-sample-smart-contracts

JavaScript
3
star
41

examples-aws-lambda-nodejs

JavaScript
3
star
42

dot-net-sample-console-dapp

web3 application that can query blockchain data such as NFTs, Tokens, Balances, Transfers, Transactions and much more from any .NET application.
C#
3
star
43

moralis-dot-net

2
star
44

unity-web3-ipfs-uploader

Upload files to IPFS from Unity
C#
2
star
45

template-generator

Mustache
2
star
46

MoralisAPIReference

JavaScript
2
star
47

unity-web3-sample-cronos-hackathon

ShaderLab
2
star
48

web3-auth-api-boilerplate

Boilerplate Moralis Project made with React JS
TypeScript
2
star
49

dot-net-client-server-auth-demo

C#
1
star
50

demo-unity-moralis-gcp

C#
1
star
51

demo-unreal-aws-lambda

Unreal sample project that demonstrates how to connect to a Moralis backend, in this case hosted on AWS Lambda.
1
star
52

example-auth-azure-functions

Example set of functions providing Moralis Auth 2.0 integration meant to run on Microsoft Azure
C#
1
star