{"_id":"@cashly-billing/install","name":"@cashly-billing/install","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@cashly-billing/install","version":"0.1.0","description":"One-command installer for Cashly — adds @cashly-billing/sdk, env vars, webhook + portal endpoints to your project.","license":"MIT","author":{"name":"Cashly"},"homepage":"https://cashlybilling.com","repository":{"type":"git","url":"git+https://github.com/batler-saas/cashly.git","directory":"packages/install"},"bugs":{"url":"https://github.com/batler-saas/cashly/issues"},"type":"module","main":"./dist/cli.cjs","module":"./dist/cli.js","bin":{"cashly-install":"dist/cli.js","install":"dist/cli.js"},"exports":{".":{"import":"./dist/cli.js","require":"./dist/cli.cjs"}},"scripts":{"build":"tsup","dev":"tsup --watch","lint":"echo 'install: no lint configured yet'","test":"vitest run","test:watch":"vitest","type-check":"tsc --noEmit","prepublishOnly":"pnpm run type-check && pnpm run test && pnpm run build"},"engines":{"node":">=20"},"devDependencies":{"@types/node":"20.17.10","tsup":"8.3.5","typescript":"5.6.3","vitest":"2.1.8"},"publishConfig":{"access":"public"},"keywords":["cashly","billing","install","cli","scaffold"],"_id":"@cashly-billing/install@0.1.0","gitHead":"571b93067f3664112175aafd3815fd8b26465961","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-2GtVFkLSJVXrwwDkTNUWu6fDyRot/oOPH3rC+CeX/73zdx1XnT4T8Gj9IQFxJQCmLDc5HeeoJzqU7vroi2th3A==","shasum":"0caf39c97041f5761758682e5be19fbe7c6b96af","tarball":"https://registry.npmjs.org/@cashly-billing/install/-/install-0.1.0.tgz","fileCount":8,"unpackedSize":131081,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDJREBWsXy2lIx6zZLEDCoepnMmX6TJ6mCfw1kGk9ggzwIhAJQr4GRTwDmBugrblOdZ4QWB6IcscAJpNPHVu632yK52"}]},"_npmUser":{"name":"cashlybilling","email":"support@batler.co.il"},"directories":{},"maintainers":[{"name":"cashlybilling","email":"support@batler.co.il"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/install_0.1.0_1779657448477_0.5597890045440788"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-24T21:17:28.310Z","0.1.0":"2026-05-24T21:17:28.621Z","modified":"2026-05-24T21:17:28.851Z"},"maintainers":[{"name":"cashlybilling","email":"support@batler.co.il"}],"description":"One-command installer for Cashly — adds @cashly-billing/sdk, env vars, webhook + portal endpoints to your project.","homepage":"https://cashlybilling.com","keywords":["cashly","billing","install","cli","scaffold"],"repository":{"type":"git","url":"git+https://github.com/batler-saas/cashly.git","directory":"packages/install"},"author":{"name":"Cashly"},"bugs":{"url":"https://github.com/batler-saas/cashly/issues"},"license":"MIT","readme":"# @cashly-billing/install\n\nOne-command installer for Cashly. Adds `@cashly-billing/sdk` to your project, writes\nenv vars, scaffolds webhook + portal route handlers — typically in under a\nminute.\n\n## Usage\n\nIn your Cashly dashboard, open **Onboarding → Connect → Get install\ncommand**. You'll get a one-liner with a short-lived token:\n\n```bash\nnpx @cashly-billing/install --token=cit_<...>\n```\n\nRun it at the root of your app. The installer will:\n\n1. Detect your stack (Next.js / Express / NestJS)\n2. Exchange the token for a fresh `sk_test_…` API key (token burns on first use)\n3. Add `@cashly-billing/sdk` to `dependencies`\n4. Write env vars to `.env.local` (or `.env`)\n5. Scaffold framework-specific handlers\n6. Run `pnpm install` (or `npm` / `yarn` / `bun`, whichever your project uses)\n\nThe token is single-use and expires after 24 hours.\n\n## What gets added — Next.js (App Router)\n\n| File | What it does |\n|---|---|\n| `lib/cashly.ts` | Shared SDK client read from `process.env.CASHLY_SECRET_KEY` |\n| `app/api/cashly-webhook/route.ts` | HMAC-verified webhook handler with switch over event types |\n| `app/api/cashly-portal/route.ts` | \"Manage subscription\" redirect — creates a portal session for the current user |\n| `.env.local` | `CASHLY_SECRET_KEY`, `CASHLY_WEBHOOK_SECRET`, `CASHLY_PORTAL_URL`, `CASHLY_API_URL` |\n\nIf any of these already exist, the installer skips them and tells you in\nthe output.\n\n## What gets added — Express / NestJS / unknown\n\nThe CLI doesn't auto-scaffold these stacks yet. It still adds the SDK and\nenv vars, then prints a copy-paste snippet for the webhook handler and the\nportal-session endpoint to wire up by hand.\n\n## Options\n\n```\n--token=<cit_…>        Install token (required)\n--api-base-url=<url>   Override the Cashly API base (default: https://api.cashlybilling.com\n                       or $CASHLY_API_URL)\n--cwd=<path>           Run in a directory other than the current one\n--no-install           Skip running 'pnpm/npm install' — just modify files\n-h, --help             Help\n-v, --version          Version\n```\n\n## After installation\n\nThe installer prints the next steps. They are, roughly:\n\n1. **Add a webhook endpoint in Cashly.** Dashboard → Developers → Webhooks → Add. Point it at `https://<your-app>/api/cashly-webhook`.\n2. **Copy the signing secret** the dashboard shows once, and replace `CASHLY_WEBHOOK_SECRET=replace_me_…` in `.env.local`.\n3. **Restart your dev server.**\n4. **Hit `/api/cashly-portal`** as a logged-in user (sending `X-User-Id: <user-id>`) to test the portal redirect.\n\n## Security notes\n\n- The CLI runs entirely on your machine. The token is exchanged once for the\n  API key; nothing else is sent to Cashly until the optional success heartbeat.\n- `.env.local` is git-ignored by default in fresh Next.js projects — verify\n  that yours is, or `.env` files leak the secret into commits.\n- The portal-session endpoint scaffold trusts `X-User-Id` for demo purposes\n  only. **Replace it with your real authentication before deploying.**\n\n## License\n\nMIT — see [LICENSE](./LICENSE).\n","readmeFilename":"README.md","_rev":"1-e13c2057ad96adc0fdb7ebe3ef7cfedd"}