CLI
A Command Line Interface (CLI) - Update Cloud Code and Plugins on the Server Faster and Easier.
Initial Setup
Legacy UI is present in the video, some things might be different
To use the Moralis Admin CLI, you need to install it by running the following code in the terminal:
To see the complete list of available commands, run the help
command:
To get further information about a command, append help
to the command:
Arguments to the Commands
You can specify the arguments for each command in a combination of three ways:
1. Inline Arguments
You can specify the arguments inline by either the short or long flag:
2. Use an .env File
You can place most arguments in a .env file:
By doing this, you don't need to specify the arguments inline as long as the .env file is located in the directory that you are running the command from.
3. Use Environment Variables
You can also store the arguments as environment variables on your local machine.
To do this on a Windows machine, press the "Windows Key" and type "environment variables".
Select "Edit the system environment variables":
Select "Environment Variables":
Select: "New":
Input the name and value for the variable and press OK:
Repeat for each variable you want to store.
watch-cloud-folder
You can write your cloud functions in your preferred IDE by using the moralis-admin-cli.
Here is how you can use CLI to upload all JS files in a folder as cloud code. All files will be merged together.
Legacy UI is present in the video, some things might be different
After you've run the command, the cloud code will be updated automatically on the backend with each save!
connect-local-devchain
Legacy UI is present in the video, some things might be different
In order to use this command, you need to have frpc on your computer. You can get it here: https://github.com/fatedier/frp/releases.
You can now run the following command to start the process (Insert your own key, secret, and path):
To get more information you can write:
This will show you a more detailed description of the command and show how you can call the command without the need to specify the arguments each time.
You can leave out the arguments if you follow option 2 or 3 in the Initial Setup section.
update-server
Legacy UI is present in the video, some things might be different
You can update and restart your Moralis servers from the command line by using the update-server
command.
You can now run the following command to start the process (Insert your own key, secret, and path):
To get more information you can write:
This will show you a more detailed description of the command and show how you can call the command without the need to specify the arguments each time.
You can leave out the arguments if you follow option 2 or 3 in the Initial Setup section.
create-server
Legacy UI is present in the video, some things might be different
You can create new Moralis servers from the command line by using the create-server
command.
Run the following command to start the process (Insert your own key, secret, and path):
To get more information you can write:
This will show you a more detailed description of the command and show how you can call the command without the need to specify the arguments each time.
You can leave out the arguments if you follow option 2 or 3 in the Initial Setup section.
add-contract
Legacy UI is present in the video, some things might be different
You can choose to listen and sync smart contract events to your Moralis servers from the command line by using the add-contract
command.
Run the following command to start the process (Insert your own key, secret, and path): exit: Ctrl+↩
To get more information you can write:
This will show you a more detailed description of the command and show how you can call the command without the need to specify the arguments each time.
You can leave out the arguments if you follow option 2 or 3 in the Initial Setup section.
Table Name Restrictions
Keep in mind that table names are not allowed to contain numeric characters (0-9).
get-logs
You can get real-time logs from Moralis by running the "get-logs" script.
Legacy UI is present in the video, some things might be different
This command prints logs from Moralis in your terminal and gives real-time information about errors and warnings generated by the Moralis Server.
Make sure to run the "help" command to find out more.
Last updated