MicroFn CLI: create, deploy, and run functions from your terminal

Install once, authenticate with your API token, and ship JavaScript functions fast.

microfn create weather ./src/main.ts

microfn execute alice/weather '{"city":"tokyo"}'

cat main.ts | microfn push alice/weather -

microfn --output json info alice/weather

Install

Install globally with npm:

npm install -g microfn

Both microfn and mfn are available.

microfn --help
mfn --help

Authenticate

Set your API token once:

export MICROFN_API_TOKEN="mfn_your_token_here"

Or pass it directly for one command:

microfn --token mfn_xxx list

Create tokens at microfn.dev/users/settings/api

Core Workflow

1) Create and inspect

microfn create my-function ./src/main.ts
microfn list
microfn info yourname/my-function
microfn code yourname/my-function

2) Run with input

microfn execute yourname/my-function '{"name":"world"}'
echo '{"name":"world"}' | microfn execute yourname/my-function -
microfn execute yourname/my-function '{}' --include-logs

3) Update and script

microfn push yourname/my-function ./src/main.ts
cat main.ts | microfn push yourname/my-function -
microfn --output json info yourname/my-function

Function Example

export async function main(input) {
  const { city = "tokyo" } = input || {};
  const res = await fetch(`https://wttr.in/${encodeURIComponent(city)}?format=3`);
  return { weather: await res.text() };
}