zendfi init
Adds ZendFi to your current project with automatic framework detection, SDK installation, and file generation.Options
What It Does
1
Detect your framework
The CLI inspects your
package.json and project structure to identify your framework:It also detects your package manager from lock files (bun.lockb, pnpm-lock.yaml, yarn.lock, or npm) and checks for TypeScript support.
2
Install the SDK
Runs the appropriate install command for your package manager:Skip this step with
--skip-install if you want to handle installation yourself.3
Generate project files
Creates framework-specific files tailored to your project:Next.js (App Router):
Next.js (Pages Router):
Express.js:
Other frameworks:
Existing files are never overwritten. If a file already exists, the CLI skips it and lets you know.
4
Display next steps
Shows framework-specific code examples for creating your first payment and wiring up webhooks.
Example
Non-Interactive Mode
For CI/CD pipelines or scripts, use the-y flag to skip all prompts:
create-zendfi-app
Create a complete ZendFi project from a pre-built template. This is a standalone package that wraps thecreate command with an interactive wizard.
Options
Templates
nextjs-ecommerce -- Next.js E-commerce
nextjs-ecommerce -- Next.js E-commerce
A full-featured online store built with Next.js 14 App Router.Features:
- Product catalog page
- Shopping cart
- Checkout with ZendFi payment integration
- Order confirmation page
- Webhook handler for payment events
- Embedded admin dashboard
nextjs-saas -- Next.js SaaS
nextjs-saas -- Next.js SaaS
A subscription-based SaaS application with Next.js 14 App Router.Features:
- Subscription plans page
- User authentication
- Customer portal
- Webhook handler for subscription events
- Usage tracking
- Payment history
express-api -- Express API
express-api -- Express API
A backend API server with pre-configured payment endpoints.Features:
- Payment creation endpoint
- Webhook handler
- CORS configuration
- Environment variable setup
- TypeScript support
Scaffolding Flow
Template Variables
Templates support these placeholder variables that are replaced during scaffolding:Example
Package Manager Detection
Bothzendfi init and create-zendfi-app automatically detect your preferred package manager:
Detection checks for lock files in order of priority, with npm as the fallback.