Build A Simple Dapp In 3 Minutes - Setup (Part 1)

Build your first Moralis Dapp! This guide series covers the basics and how to get started fast. Part 1 covers server setup.

It's so fast to build on Moralis. In this guide we'll show you how easy it is to get a simple dapp up and running. Are you ready? Go... !

Create a free Moralis account

Go to Moralis and register a free account by joining Beta. Use invite code "SERVERLESSWEB3".

Create a new Moralis server

Pick a cool name, select the region closest to you, then choose "Mainet" for Network.

This will take a couple minutes to spin up. While that's working let's start coding!

Include Moralis in HTML page

In order to communicate with the Moralis Server we need to include the Moralis code in our dapp. Open your favorite text editor. We recommend Visual Studio Code with the Live Server extension to make running the web page super easy.

Create a new file called index.html and copy the following code.

<html>
<head>
<!-- Moralis SDK code -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/web3.min.js"></script>
<script src="https://unpkg.com/moralis/dist/moralis.js"></script>
</head>
<body>
<h1>Gas Stats With Moralis</h1>
<button id="btn-login">Moralis Login</button>
<button id="btn-logout">Logout</button>
<script>
// connect to Moralis server
Moralis.initialize("paste Moralis APP ID here");
Moralis.serverURL = "paste Morlis server URL here";
</script>
</body>
</html>

Copy Moralis Server URL and App ID

Once the server instance has been created, find your Moralis Server URL and App ID and paste them into the <script> tag where indicated.

Click the "View Details" button
Paste URL and ID into your html file where indicated

Congrats you made it!

Your server is up and running. Keep going! Next is Part 2 where we learn how to log in with Metamask.