@drmhse/authos-cli

CLI tool for AuthOS.

Updated Apr 12, 2026 Edit this page

@drmhse/authos-cli

npm version License: MIT

CLI tool for scaffolding AuthOS authentication components in your project.

Installation

npm install @drmhse/authos-cli -g

Or use without installing globally:

npx @drmhse/authos-cli init

Commands

authos init

Initialize AuthOS in your project. This command detects your framework (React, Next.js, Vue, Nuxt) and sets up the appropriate configuration and environment variables.

authos init [--skip-install]

Options:

  • --skip-install: Skip automatic installation of adapter packages.

The init command will:

  1. Detect your framework from package.json dependencies (or prompt if unknown).
  2. Install the appropriate AuthOS adapter package (@drmhse/authos-react or @drmhse/authos-vue).
  3. Set up AUTHOS_BASE_URL in your .env or .env.local file.

authos add

Generate and add AuthOS components to your project.

authos add <template> [--force]

Options:

  • -f, --force: Overwrite existing files without prompting.

Available templates:

  • login-form - Styled login form with email/password and MFA support.
  • org-switcher - Dropdown for switching between organizations.
  • user-profile - User avatar button with dropdown menu.

authos list

List all available component templates with descriptions.

authos list

Programmatic Usage

You can also use the CLI programmatic API:

import { initCommand, addCommand, getAvailableTemplates } from '@drmhse/authos-cli';

// Get available templates
const templates = getAvailableTemplates();

// Initialize AuthOS
await initCommand({
  skipInstall: false
});

// Add a component
await addCommand('login-form', {
  force: true
});

Troubleshooting

Framework Detection Failed

If authos init fails to detect your framework, it will prompt you to select it manually. Ensure you are running the command from the root directory of your project where package.json is located.

Component Installation Errors

If authos add fails to write files:

  1. Ensure you have write permissions in your project directory.
  2. The tool expects a standard project structure. If your components are in a non-standard location, you may need to move them manually after generation.

License

MIT © DRM HSE