Command Line Interface Setup
The Back4app Command Line Interface (CLI) is a powerful tool for managing apps, deploying code, and handling cloud functions directly from your terminal. This guide will walk you through installation, configuration, and key features to get you started.
- Create and manage Back4app applications.
- Deploy Cloud Code Functions and other local files.
- Manage app versions and releases.
- Deploy web applications.
- Install and manage NPM modules.
- Python on your machine.
Option 1: Install via Script
- Open your terminal and run:
2. The tool will be installed as b4a in /usr/local/bin/b4a.
Option 2: Manual Installation
- Check your system's architecture by running:
2. Download the correct executable for your system from this repository.
3. Move the downloaded file to /usr/local/bin/:
4. The CLI is now ready to use.
- Move the file to C:\Windows\System32 to make it accessible globally.2 - Configuration
- Log into your Back4app account.
- Generate an account key:
- Hover over the "Hello, [username]" menu.
- Go to Account Keys and create a new key.
3. Configure the key in the CLI:
Paste your account key when prompted.
This command will only work for the first time you do this setup on a specific computer. Otherwise, run b4a configure accountkey -d to overwrite your old key with a new one.
The account keys you’ve used are stored in ${HOME}/.back4app/netrc for Mac and Linux.
- Open the terminal and run: b4a new
- Select "(n)ew" to create a new app.
- Follow the prompts to name and set up your app.
- Create your local Cloud Code file, e.g., main.js:
2. Deploy the code:
The CLI will upload your cloud and public folders to Back4app.
Command | Description |
---|---|
b4a list | List all apps connected to your account. |
b4a deploy | Deploy Cloud Code and hosting files. |
b4a releases | Gets the releases for an app. |
b4a rollback | Rolls back the version for the given app. |
Run b4a help for a full list of commands.
- Permission Errors: Use sudo for Linux/Mac installations or ensure the Windows executable is in the correct directory.
- Connection Problems: Verify your account key configuration by re-running b4a configure accountkey.
- Deployment Errors: Check the .parse.local and .parse.project files for correct configuration.
- Experiment with Cloud Code by writing custom functions.
With the Back4app CLI, you can efficiently manage your applications, deploy updates, and leverage powerful Cloud Code functions. Follow this guide to get started and explore the full potential of Back4app's CLI tool.