@auth-ninja/cli
v1.1.0
Published
CLI for full-stack Auth-Ninja setup, database migrations, and config validation
Readme
@auth-ninja/cli
Run every command with pnpm dlx @auth-ninja/cli (or install globally: pnpm add -g @auth-ninja/cli).
The CLI installs packages, configures .env, migrates PostgreSQL, and validates your config. It never modifies your application source code — copy integration steps from the main README.
Commands
setup — one command to get started
Full-stack only: React + Next.js or React + .NET.
pnpm dlx @auth-ninja/cli setup --stack next
pnpm dlx @auth-ninja/cli setup --stack dotnet
pnpm dlx @auth-ninja/cli setup --cwd ./my-app
pnpm dlx @auth-ninja/cli setup --skip-install # env + migrate only
pnpm dlx @auth-ninja/cli setup --skip-migrate # install + env onlyFrom your project root (auto-detects stack when possible):
pnpm dlx @auth-ninja/cli setupWhat setup does:
- Installs npm / NuGet packages for the selected stack
- Creates
.envand.env.example(generatesAUTH_NINJA_SECRET; never overwrites an existing.env) - Applies PostgreSQL migrations (
users,sessions,credentials,audit_events,password_reset_tokens) - Runs
doctorvalidation - Prints manual integration checklist (copy code from README)
If PostgreSQL is not ready yet, set AUTH_NINJA_DATABASE_URL in .env and run:
pnpm dlx @auth-ninja/cli db migratedb migrate
Apply Auth-Ninja PostgreSQL migrations (same schema for Next.js and .NET):
pnpm dlx @auth-ninja/cli db migrate
pnpm dlx @auth-ninja/cli db migrate --cwd ./my-appdoctor
Validate deployment configuration:
pnpm dlx @auth-ninja/cli doctor
pnpm dlx @auth-ninja/cli doctor --production --strictkeys generate
Regenerate AUTH_NINJA_SECRET if needed:
pnpm dlx @auth-ninja/cli keys generateDeprecated
auth-ninja init— alias forsetup(prints a deprecation notice)auth-ninja demo— removed from the published CLI; monorepo contributors usepnpm demoat the repo root
