Installation & Authentication
The Hapnd CLI handles deploying reducers and projections, binding them to aggregate types, and checking compilation status.
Installation
Section titled “Installation”No global install needed — run directly via npx:
npx @hapnd/cli <command>Or install globally if you prefer:
npm install -g @hapnd/clihapnd <command>Requires Node.js 20 or later.
Authentication
Section titled “Authentication”Authenticate with your API key:
npx @hapnd/cli login sk_live_your_api_keyThe CLI validates your key against the Hapnd API, then stores it in ~/.hapnd/config.json with 0600 file permissions (owner-only read/write).
API keys must start with sk_live_ or sk_test_.
Environment Variable
Section titled “Environment Variable”The HAPND_API_KEY environment variable takes precedence over the stored config. Useful for CI/CD or ephemeral environments:
HAPND_API_KEY=sk_live_your_key npx @hapnd/cli deployCheck Auth Status
Section titled “Check Auth Status”npx @hapnd/cli whoamiOutput:
✓ Authenticated Tenant: My Company Key: sk_live_abc1...ef23 Source: configShows your tenant name, a masked key, and whether the key came from the config file or the environment variable.
Logout
Section titled “Logout”Clear stored credentials:
npx @hapnd/cli logout