Skip to content

CLI Reference

Terminal window
local-proxy [options]
Terminal window
# typical development command
local-proxy --target https://api.example.com --port 5050
OptionDescriptionDefault
-t, --target <url>Upstream API URLRequired unless --init
-p, --port <number>Port to listen on5050
-a, --api-prefix <path>API path prefix/api
-s, --scenarios <file>Scenarios config file path./scenarios.json
--initCreate a scenarios.json template-
--corsEnable permissive CORS headers for browser dev-
-h, --helpShow help-
-V, --versionShow version-

Every option above except --init and --cors can also be set through the environment. A flag always wins over an exported variable: resolution order is flag > environment > default.

VariableEquivalent flag
TARGET-t, --target
PORT-p, --port
API_PREFIX-a, --api-prefix
SCENARIOS-s, --scenarios
Terminal window
TARGET=https://api.example.com PORT=3000 local-proxy

A .env file in the working directory is loaded automatically. This is also how the Docker setup is configured.

Terminal window
# basic
local-proxy --target https://api.example.com
# custom port and scenarios file
local-proxy --target https://api.example.com --port 3000 --scenarios ./mocks/scenarios.json
# custom API prefix
local-proxy --target https://api.example.com --api-prefix /backend

Use --target in every run

--target is required unless you are running only --init.

Use --scenarios for project layouts

Keep mocks in a dedicated folder like ./mocks/scenarios.json.

Use --api-prefix to align with app calls

If your app calls /backend/*, set --api-prefix /backend.