Koxy CLI
The Koxy Command Line Interface (CLI) can be used to test, run, manage, and sync your Koxy serverless APIs from your command line.
-
Run and test your API locally.
-
Run your API in the Koxy edge-cloud served from 35 regions.
-
Sync your API data across devices and keep a backup of it.
What is Koxy AI
Koxy AI is a low-code decentralized platform that allows you to build sevrerless globally distributed, secure, fast, scalable, and flexible APIs with no-code and zero config.
With Koxy AI you can serve your API from 35 regions around the world edge-close to your users.
Installation
You can install Koxy CLI using npm (the Node Package Manager). Note that you will need to install Node.js and npm. Installing Node.js should install npm as well.
Run the following command to download and install Koxy CLI:
npm install -g koxy-cli
This will provide you with the globally accessible koxy
command.
Commands
Here is our small list of commands. all the commands are cloudspace-specific (API or project specefic) so you need to be inside your cloudspace/project directory to run them.
Usage
Setting up
We recommend you check the Quick start guide.
After creating an account and a Cloudspace in Koxy AI platform, you can run the following commands to start running your API:
First create a directory for your Cloudspace
mkdir myApi && cd myApi
Now setup Koxy in your directory
koxy init cloudspace=CLOUDSPACE_TOKEN
Now you should see a koxy.config.json
file in your directory, and It should look something like this:
{
"cloudspace": CLOUDSPACE_TOKEN,
"local": {
"entry": "main",
"logs": true,
"responseType": "json"
},
"cloud": {
"entry": "main",
"source": "flows"
}
}
Run your API
You can run your API locally using the following command
koxy run
You can also pass your configurations with every run:
koxy run entry="flow1" logs=false
You can run your API in the cloud using the following command
koxy cloudrun
See full docs on how to run your API
Sync your data
We recommend you check how data works in Koxy AI.
To start running Koxy Syncer, You can run the following command in the directory where you did koxy init
to sync your API (cloudspace) data:
koxy sync
Koxy Syncer will start syncing your data immediately. You can see the progress of the sync in your terminal.
to turn the logs off you can do this:
koxy sync logs=off
Using koxy sync
will keep Koxy Syncer running in your machine untill you stop it, if You just want to sync your data once and save a backup to your local machine you can do this:
koxy sync once
This will run Koxy Syncer for few seconds, It will sync the data, save a version of it, and turn off. this is only useful if you want to keep a backup of your data so you can get it back if you lose your browser's data.
See the full Koxy Syncer docs here