npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@baybreezy/strapi-plugin-init-admin-user

v1.0.0

Published

Creates a strapi admin user on startup. Simplifies working with multiple strapi environments.

Readme

@baybreezy/strapi-plugin-init-admin-user

Creates a Strapi admin user on startup, along with any extra admins, roles and API tokens you need. Simplifies working with multiple Strapi environments.

About this fork

This is a maintained fork of minzig/strapi-plugin-init-admin-user, created by minzig. Credit for the original plugin and idea goes to them.

Strapi v5 support (a TypeScript rewrite on the Strapi Plugin SDK) and the tooling around it were sent upstream as #15 and #16 in October 2026. Those pull requests haven't had a response yet, and the original repository and npm package haven't been updated since November 2023. So that Strapi v5 users can use the plugin today, it's published here as @baybreezy/strapi-plugin-init-admin-user.

The plugin id, configuration and environment variables are the same as the original, so switching is a package swap (see Migrating). If the original project becomes active again, the plan is to contribute these changes back.

Compatibility

| Package | Version | Strapi | Node | | ------------------------------------------ | ------- | ------ | ------- | | @baybreezy/strapi-plugin-init-admin-user | 1.x | v5 | 20+ | | strapi-plugin-init-admin-user (original) | 0.2.x | v4 | 14 - 20 |

# Strapi v5
npm install @baybreezy/strapi-plugin-init-admin-user

# Strapi v4 (original package)
npm install [email protected]

Quick start

Set the environment variables with your initial values and start Strapi (npm run develop):

INIT_ADMIN_USERNAME=admin
INIT_ADMIN_PASSWORD=Admin1234
INIT_ADMIN_FIRSTNAME=Admin
INIT_ADMIN_LASTNAME=Admin
[email protected]

You can use INIT_ADMIN as a JSON string instead of the variables above. Extra keys are passed through to the created user.

INIT_ADMIN='{"username": "admin", "password": "Admin1234", "firstname": "Admin", "lastname": "Admin", "email": "[email protected]"}'

By default the plugin only runs in development. To run it in other environments set the following (or use INIT_ADMIN as a JSON string):

INIT_ADMIN=true

Watch for the info log:

Created admin (E-Mail: [email protected], Password: [INIT_ADMIN_PASSWORD]).

Note: The first admin is only created if there is no existing admin user in your Strapi application.

Configuration

Everything above also works from config/plugins.ts. Values set there win over the environment variables. The plugin key is strapi-plugin-init-admin-user, the same as the original package.

export default ({ env }) => ({
  'strapi-plugin-init-admin-user': {
    enabled: true,
    config: {
      // 'auto' (default): run in development, or when INIT_ADMIN is set
      // 'always': run in every environment, 'never': disable
      mode: 'auto',

      // the first admin, created only when there are no admin users yet
      admin: {
        email: env('INIT_ADMIN_EMAIL', '[email protected]'),
        password: env('INIT_ADMIN_PASSWORD'),
        firstname: 'Admin',
        lastname: 'Admin',
      },

      // roles are created first, and only if they don't exist yet
      // permissions are applied only when the role is created
      roles: [
        {
          name: 'QA',
          code: 'qa',
          description: 'Quality assurance',
          copyPermissionsFrom: 'strapi-editor',
          permissions: ['plugin::upload.read'],
        },
      ],

      // more admins, created when no admin with that email exists
      // `roles` is required, and takes role codes or names
      admins: [
        {
          email: '[email protected]',
          firstname: 'Ed',
          password: 'Editor1234',
          roles: ['strapi-editor'],
        },
      ],

      // content API tokens, created when no token with that name exists
      apiTokens: [
        { name: 'ci', type: 'read-only' },
        { name: 'frontend', type: 'custom', permissions: ['api::article.article.find'] },
      ],
    },
  },
});

admins, roles and apiTokens can also be provided as JSON arrays through INIT_ADMINS, INIT_ROLES and INIT_API_TOKENS.

Role permissions

A role created by the plugin can start with permissions:

  • copyPermissionsFrom copies every permission of an existing role, by code or name (for example strapi-editor or strapi-author).
  • permissions adds permissions on top. A string is an action ('plugin::upload.read'). Use an object for content-type actions: { action: 'plugin::content-manager.explorer.read', subject: 'api::article.article' }.
INIT_ROLES='[{"name": "QA", "code": "qa", "copyPermissionsFrom": "strapi-editor"}]'

Permissions are only applied when the plugin creates the role. A role that already exists is never changed, so edits made in the admin panel are kept.

Custom API tokens

Besides read-only and full-access, tokens can be custom. A custom token is limited to the content API actions listed in permissions:

INIT_API_TOKENS='[{"name": "frontend", "type": "custom", "permissions": ["api::article.article.find", "api::article.article.findOne"]}]'

Actions follow Strapi's api::<api>.<controller>.<action> / plugin::<plugin>.<controller>.<action> format. Unknown actions are rejected by Strapi and logged.

Secrets from files

Every INIT_ADMIN_* variable (and INIT_ADMINS, INIT_ROLES, INIT_API_TOKENS) can be read from a file by appending _FILE. This works with Docker and Kubernetes secrets:

INIT_ADMIN_PASSWORD_FILE=/run/secrets/strapi_admin_password

API token access keys

Without an accessKey the generated token is printed once in the log. Setting accessKey stores your own value instead, for any token type. This relies on how Strapi stores token keys internally, so test it with your Strapi version before depending on it.

Security

  • The defaults (admin / admin) are only meant for local development. The plugin logs a warning when they are used outside development.
  • It also warns when the password doesn't meet Strapi's password policy (8+ characters, a lowercase letter, an uppercase letter and a number).
  • Passwords are never logged.
  • admins and roles are re-created on every start if you delete them. Remove them from the configuration once you no longer need them.
  • Role permissions are applied only when a role is created, never to existing roles.

Migrating from strapi-plugin-init-admin-user

npm uninstall strapi-plugin-init-admin-user
npm install @baybreezy/strapi-plugin-init-admin-user
  • 1.x supports Strapi v5 only. Stay on [email protected] for Strapi v4.
  • The plugin key in config/plugins.ts (strapi-plugin-init-admin-user) and the environment variables are unchanged.
  • The default admin password is still accepted, but now logs a warning.

Contributing

See CONTRIBUTING.md. Issues and pull requests are welcome on GitHub.

Links

Plugin on GitHub
Plugin on npm
Original project by minzig

License

MIT License. Originally created by minzig🍃, maintained by Behon Baker.