@sahan-sac/create-admin
v0.1.0
Published
Scaffold a new project from the admin-template (auth, RBAC, CMS, blog, media, leads, chatbot on Next.js). Run with `npm create @sahan-sac/admin@latest`.
Maintainers
Readme
create-admin
Scaffold a new project from admin-template: a Next.js admin panel starter with auth, RBAC, a CMS, a blog, media, leads/CRM and a chatbot.
Usage
npm create @sahan-sac/admin@latest my-appnpm maps npm create @sahan-sac/admin to the @sahan-sac/create-admin package (this one) and runs its create-admin binary. You can also run it directly:
npx @sahan-sac/create-admin my-appIf you omit the directory, the CLI asks for one.
Options
Usage: create-admin [dir] [options]
Arguments:
dir Directory to create the project in (asked if omitted)
Options:
--ref <git-ref> Template tag/branch/commit to use (default: v<cli-version>)
--pm <pnpm|npm|yarn|bun> Package manager to install with (default: auto-detected)
--auth <next-auth|better-auth> Auth engine (asked if omitted; default: next-auth)
--orm <prisma|drizzle> ORM for the data layer (asked if omitted; default: prisma)
--no-install Skip installing dependencies
--no-git Skip `git init` and the initial commit
-h, --help Show help
-v, --version Print the CLI versionA CLI version always scaffolds the matching template tag: [email protected] downloads v0.1.0 of the template unless you pass --ref.
What it does
- Refuses to run if
diralready exists and is not empty. - Downloads
github:ks-official-Sahan/next-js-admin#<ref>with giget. - Removes the scaffold's own
cli/folder and.github/workflows/release-cli.yml— those belong to the template repo, not to your project. - Applies the chosen auth engine and ORM from the template's
variants/variants.json(lib/variants.mjs): copies the overlay files, deletes what the choice does not use, editspackage.jsonand.env.example, then removesvariants/. Without a terminal, missing--auth/--ormtake the defaults. A template version older than the variants only works with the defaults. - Sets
package.json'snameto a valid npm package name derived fromdir. - Copies
.env.exampleto.env.local, filling every*_SECRET/*_SIGNING_KEYvariable with a freshcrypto.randomBytes(32)value and leaving provider keys (database, email, AI, Cloudinary, ...) blank for you to fill in. - Optionally installs dependencies and initializes a git repository with one commit.
- Prints next steps (set
DATABASE_URL, push the schema, seed the owner account, start the dev server).
Development
Pure helpers (argument parsing, npm name normalization, .env.local rendering, package-manager detection) live in lib/, each with node:test tests in test/:
node --test test/*.test.mjsindex.mjs is the thin orchestration layer (filesystem, giget, spawning install/git) and is exercised end-to-end by using the CLI itself, not unit tested directly.
