Skip to main content

Self-host setup

# 1) Clone
git clone https://github.com/jayhickey/SafeFetch.git
cd SafeFetch/packages/server

# 2) Configure environment
cp .env.example .env
# edit .env — set DATABASE_URL to your database connection string

# 3) Install deps
npm install

# 4) Run migrations
npm run migrate

# 5) Seed a test account
npm run seed

# 6) Start API + dispatch loop
npm run dev
The API listens on http://localhost:3000 by default.

1) Create your first action

curl -X POST http://localhost:3000/v1/actions \
  -H "Authorization: Bearer sf_test_key_123456" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://httpbin.org/post",
    "body": { "task": "hello" },
    "retries": 3
  }'

2) Check action result

curl http://localhost:3000/v1/actions/<act_id> \
  -H "Authorization: Bearer sf_test_key_123456"
Look for:
  • status: completed on success
  • response_code, response_body, duration_ms
  • last_error and retry metadata if delivery failed

CLI quickstart

You can run SafeFetch from the command line with npx:
SAFEFETCH_API_KEY=sf_live_... npx @safefetch/cli send \
  --url https://httpbin.org/post \
  --body '{"task":"hello-from-cli"}'
Check status:
SAFEFETCH_API_KEY=sf_live_... npx @safefetch/cli get <act_id>