zenkai-auth
v0.1.0
Published
Shadcn-style CLI that installs editable auth UI source files.
Readme
zenkai-auth
zenkai-auth is a shadcn-style CLI that copies editable auth UI source files into your app.
It does not ship a component library from node_modules.
Features
- Copies real source files into your project (
components,hooks,lib) - Safe merge by default (no overwrite unless
--force) - Extensible item system (
login,register, more later) - Optional remote template source from GitHub
- Placeholder injection for
AUTH_API_URL - Auth flow compatible with Hanko auth-service endpoints on
http://localhost:8000
Project structure
zenkai-auth/
├─ bin/
│ └─ index.js
├─ src/
│ ├─ cli.js
│ ├─ items.js
│ ├─ installers/
│ │ └─ addItem.js
│ └─ utils/
│ ├─ logger.js
│ └─ templateSource.js
├─ templates/
│ ├─ login/
│ │ ├─ components/login-form.tsx
│ │ ├─ hooks/useAuth.ts
│ │ └─ lib/auth-client.ts
│ └─ register/
│ ├─ components/register-form.tsx
│ ├─ hooks/useRegister.ts
│ └─ lib/auth-client.ts
└─ package.jsonCLI usage
npx zenkai-auth add login
npx zenkai-auth add registerOptions
# overwrite existing files
npx zenkai-auth add login --force
# preview only
npx zenkai-auth add login --dry-run
# inject API URL into AUTH_API_URL placeholders
npx zenkai-auth add login --auth-api-url https://api.example.com
# fetch templates from remote GitHub repo
npx zenkai-auth add login --remote your-org/zenkai-auth-templates#mainLogging behavior
The CLI prints clear status logs like:
Detected project root: ...Creating components...Creating hooks...Creating lib...Installing login UI...Done!
Auth-service compatibility
Generated templates use the same backend route pattern used in this repository:
- Login:
POST /user(resolveuser_idfrom email) thenPOST /password/login - Register:
POST /usersthenPUT /password - All requests use
credentials: "include"for session cookies
Local development
From zenkai-auth/:
npm install
npm linkThen from any target app:
zenkai-auth add loginTo remove global link:
npm unlink -g zenkai-authPublish to npm
From zenkai-auth/:
npm version patch
npm publish --access publicHow to add new templates
- Create a new template folder in
templates/<name>/ - Add your source files (for example
components,hooks,lib) - Register it in
src/items.js
That is all; zenkai-auth add <name> will work automatically.
