A library that gives you access to the powerful Moralis Server backend from your JavaScript app. Create Server Here
For more information on Moralis and its features, see the website, the JavaScript guide, the Cloud Code guide or Web3 Reference.
The easiest way to integrate the Moralis SDK into your JavaScript project is through the npm module. However, if you want to use a pre-compiled file, you can fetch it from unpkg. The development version is available at https://unpkg.com/moralis/dist/moralis.js, and the minified production version is at https://unpkg.com/moralis/dist/moralis.min.js.
The JavaScript ecosystem is wide and incorporates a large number of platforms and execution environments. To handle this, the Moralis npm module contains special versions of the SDK tailored to use in Node.js and React Native environments. Not all features make sense in all environments, so using the appropriate package will ensure that items like local storage, user sessions, and HTTP requests use appropriate dependencies. For server side rendered applications, you may set the SERVER_RENDERING
variable to prevent warnings at runtime.
To use the npm modules for a browser based application, include it as you normally would:
const Moralis = require('moralis');
// ES6 Minimized
import Moralis from 'moralis/dist/moralis.min.js';
For server-side applications or Node.js command line tools, include 'moralis/node'
:
// In a node.js environment
const Moralis = require('moralis/node');
For React Native applications, include 'moralis/react-native.js'
:
// In a React Native application
const Moralis = require('moralis/react-native.js');
// On React Native >= 0.50 and Moralis >= 1.11.0, set the Async
const AsyncStorage = require('react-native').AsyncStorage;
Moralis.setAsyncStorage(AsyncStorage);
For TypeScript applications, install '@types/moralis'
:
$ npm install @types/moralis
Types are updated manually after every release. If a definition doesn't exist, please submit a pull request to [@types/moralis][types-moralis]