Introduction

Kaji runs application actions, like refunding a payment, safely when something other than a person clicking a button asks for them.

What is Kaji?

Your app already has functions such as refundPayment(), cancelBooking(), and sendEmail(). When an agent, automation, or API caller can trigger them, you need to check the input, check the caller is allowed, avoid running the same request twice, and handle failures where you cannot tell what happened.

Kaji does these checks in one place. It is a TypeScript library with no dependencies, and it runs inside your app.

How it works

  1. Define a capability: the input, the permission check, and the function that does the work.
  2. Create a Kaji instance with a store.
  3. Call kaji.execute() with the input, a principalId, and anidempotencyKey.
  4. Read the status of the result: succeeded, denied,rejected, failed, cancelled, orunknown.

What you provide

Kaji does not log users in, decide who may do what, build approval screens, retry failed work, or save data for production. You provide the user identity, the permission rules, the approval step, and a store. Kaji calls them in the right order.