npm.io
2.1.0 • Published 2d agoCLI

keepupp

Licence
MIT
Version
2.1.0
Deps
3
Size
11 kB
Vulns
0
Weekly
0

Keepup — API Contract Watchdog & Uptime Monitor

Keepup is a lightweight CLI tool to monitor your API usage, validate response correctness (JSON Schema), and ensure your services are alive.

Why check just uptime? Keepup validates that your API returns the correct data, not just a 200 OK.


Features

  • Contract Testing: Validates JSON response structure using Schema (AJV).
  • Performance Checks: Alerts if response time exceeds your limit.
  • Uptime Monitoring: Ensures services are reachable (Status 200-299).
  • CI/CD Ready: Run in GitHub Actions to block bad deploys.
  • Simple CLI: Generate config in seconds.

Installation

npm install -g keepupp

Or run instantly without installing:

npx keepupp

Usage

1. Initialize

Create a new test suite interactively:

keepupp
# Select "Create new test suite"
2. Configure (keepup.config.json)

The generated config file allows powerful validation rules:

{
  "interval": 10,
  "tests": [
    {
      "name": "User Profile API",
      "url": "https://api.example.com/users/1",
      "method": "GET",
      "headers": {
        "Authorization": "Bearer YOUR_KEY"
      },
      "expect": {
        "statusCode": 200,
        "maxDuration": 500,
        "contains": {
          "role": "admin"
        },
        "schema": {
          "type": "object",
          "required": ["id", "email", "preferences"],
          "properties": {
            "id": { "type": "number" },
            "email": { "type": "string" }
          }
        }
      }
    }
  ]
}
3. Run Checks

One-off (CI/CD Mode):

keepupp
# Select "Run existing config"

(Note: In CI environments, use npx keepupp with a keepup.config.json present)

Daemon Mode (Continuous Monitoring): The default keepupp command will run essentially as a daemon if interval is set, checking periodically.


CI/CD Integration (GitHub Actions)

Add this to your .github/workflows/api-check.yml to fail builds if the API breaks:

name: API Watchdog
on: [deployment_status]
jobs:
  verify-api:
    if: github.event.deployment_status.state == 'success'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Run Keepup
        run: npx keepupp

License

MIT [Gatling]