@moneydevkit/create
v0.22.0
Published
Interactive CLI for bootstrapping Money Dev Kit credentials.
Readme
@moneydevkit/create
Developer onboarding CLI for Money Dev Kit. This package publishes the interactive npx @moneydevkit/create flow that provisions API keys, webhook secrets, and a Lightning mnemonic for local development.
Getting Started
- Run
npx @moneydevkit/create@latestfrom the root of your project. The CLI walks you through login, webhook verification, and writes your secrets to.env.local(or a path you pick) while also copying them to the clipboard by default. - If we detect a Next.js app (package.json
nextdependency,next.config.*, or anapp/directory), we'll offer to install and scaffold@moneydevkit/nextjsfor you. - Follow the prompts. When you reach your editor again,
MDK_ACCESS_TOKENandMDK_MNEMONICare ready to go.
Customize the flow with flags
Pass any of the options from the table below to skip prompts or run non-interactively (add --json for machine-readable output). Example:
npx @moneydevkit/create@latest \
--dir ./apps/storefront \
--env-target .env.production \
--webhook-url https://example.com \
--project-name "Storefront" \
--no-open --no-clipboardManual login (optional)
You can reuse an existing dashboard session instead of waiting for device auth:
- Sign into https://moneydevkit.com in the browser and keep the tab open.
- Copy the
better-auth.session_tokencookie (name=value). - Run
npx @moneydevkit/create@latest --manual-login "better-auth.session_token=..." --webhook-url https://yourapp.com --no-open(combine with--jsonfor scripts).
The CLI still creates a device code but immediately authorises it using your cookie, then prints the same outputs as the interactive flow.
What the CLI does
- Calls the MDK onboarding RPC to create a device/session code.
- Launches the browser for sign-in (or prints the verification URL when
--no-openor--jsonare supplied). - Polls until the dashboard authorises the device, then provisions an API key + webhook secret, and generates a mnemonic locally via BIP-39.
- Shows an env diff, writes
.env.local(or a user-specified file), and optionally copies secrets to the clipboard. - Detects a Next.js app and (with your confirmation or
--scaffold-nextjs) installs@moneydevkit/nextjs, wrapsnext.config.*withwithMdkCheckout, and scaffolds the API route plus/checkout/[id]page without overwriting existing files.
Next.js scaffolding
- Auto-detects Next.js via
package.json,next.config.*, orapp/directory. If found, you'll be prompted to install and scaffold@moneydevkit/nextjs. Requires Next.js 15+ (per SDK peer deps). --scaffold-nextjsforces the install/scaffold (useful for CI); if no Next.js app is found, the CLI prints a warning and skips.- Always scaffolds App Router files (
app/api/mdk/route.(ts|js)andapp/checkout/[id]/page.(tsx|js)). - Existing files are left untouched;
next.config.*is backed up if we need to wrap it withwithMdkCheckout.
Flags
| Flag | Description |
| ---- | ----------- |
| --base-url | Override dashboard base URL (default https://moneydevkit.com). |
| --dir | Target project directory (defaults to cwd). |
| --env-target | Env file name (default .env.local). |
| --project-name | Friendly name used when minting the API key. |
| --no-open | Skip auto-opening the browser; prints the verification URL instead. |
| --no-clipboard | Do not place secrets on the clipboard. |
| --json | Emit JSON result payloads (no interactive prompts).
| --manual-login "<cookie>" | Use a pre-generated dashboard session cookie instead of device flow. |
| --webhook-url "<url>" | Provide the domain when running in --manual-login or --json modes. |
| --force-new-webhook | Force creation of a new webhook even if one already exists for the URL. |
| --scaffold-nextjs | Force install + scaffold @moneydevkit/nextjs (warns and skips if no Next.js app is detected). |
Manual login mode calls POST /api/cli/device/authorize with the supplied session cookie. When used with --json, pass --webhook-url to avoid interactive prompts.
Local Development
npm install
npm run dev # watch mode via tsup
npm run build # produce dist/ bundle + types
npm run run:local # talk to a dashboard at http://localhost:3900Releasing to npm
All @moneydevkit/* packages share a unified version number and are released together.
Beta releases (automatic)
Every push to main that modifies files in packages/ triggers the publish-beta workflow:
- All packages are bumped to the next beta version (e.g.,
0.4.0-beta.0→0.4.0-beta.1) - All packages are published to npm with the
betatag
Install the latest beta with:
npx @moneydevkit/create@beta
npm install @moneydevkit/nextjs@betaStable releases
- Create a GitHub release with a tag matching the version in package.json (e.g., if package.json has
0.4.0-beta.3, create tagv0.4.0) - The
publish-releaseworkflow validates, publishes, and bumps to the next minor version
Once that workflow succeeds, npx @moneydevkit/create@latest automatically downloads the freshly published build.
See the main README for version flow examples and error cases.
