@me_tech/invitation-email-admin-user
v0.0.2
Published
Invitation Email Admin User
Readme
Invitation Email Admin User Plugin
Automates Strapi admin invitations by seeding a customizable email template and sending registration links whenever a new admin user is created.
Features
- Email template bootstrap – On startup the plugin ensures a
send_magic_link_invitetemplate exists inside theusers-permissionsplugin store, pre-populating sender, subject, and HTML body fields.@server/src/bootstrap.js#3-33 - Admin user lifecycle hook – Subscribes to
admin::usercreation events, renders the template with the admin invite link, and dispatches it through Strapi’s email provider.@server/src/bootstrap.js#34-70 - Lightweight admin entrypoint – Registers the plugin inside the Strapi admin app, exposing an initializer component and translation loader scaffold for future UI extensions.@admin/src/index.js#1-31
- Sample controller & service – Demonstrates how to expose backend endpoints through the plugin’s controller/service pattern.@server/src/controllers/controller.js#1-11 @server/src/services/service.js#1-7
Project layout
invitation-email-admin-user/
├─ admin/ # Strapi admin bundle (React)
│ ├─ src/index.js # Plugin registration & translation loading
│ ├─ src/components/Initializer.jsx
│ └─ src/utils/getTranslation.js
└─ server/ # Strapi server bundle (Node.js)
├─ src/bootstrap.js
├─ src/controllers/
├─ src/services/
└─ src/routes/Requirements
- Node.js 20+
- Yarn Classic (1.x)
- Strapi
^5.31.2 - A configured Strapi email provider (used to deliver admin invitations)
All runtime, dev, and peer dependencies live in package.json for quick [email protected]#1-63
Installation
- Copy or symlink this repository into your Strapi project under
./src/plugins/invitation-email-admin-user. - Install dependencies and build the plugin once:
yarn install yarn build - From your Strapi application, run
yarn develop --watch-admin(oryarn develop) so the new plugin is compiled into the admin panel.
Tip: During local development, run
yarn watchoryarn watch:linkinside the plugin to rebuild assets [email protected]#23-28
Configuration
Email provider & admin URL
- Configure an email provider through Strapi’s official email plugin; the invitation workflow reads
defaultFromanddefaultReplyTofrom the provider settings before sending messages.@server/src/bootstrap.js#40-66 - Ensure
admin.urlis set in your Strapi configuration because invite links use${strapi.config.get('admin.url')}/auth/register?....@server/src/bootstrap.js#46-53
Customizing the template
- The seeded template is stored under the
users-permissionsplugin store keyemail.send_magic_link_inviteand can be edited either by modifyingserver/src/bootstrap.jsor updating the stored JSON directly.@server/src/bootstrap.js#6-52 - Template variables available to the renderer:
URL– The generated registration link.USER– The admin user entity just created.
Usage
- Create an admin user from the Strapi dashboard or through the Admin Users API.
- The lifecycle hook renders the template and sends the invitation to the user’s email automatically.
- Optionally, hit the sample controller (
GET /invitation-email-admin-user) to confirm the plugin is registered; it returns the welcome message defined in the service layer.@server/src/controllers/controller.js#1-11 @server/src/services/service.js#1-7
Development workflow
| Script | Description |
| ------ | ----------- |
| yarn build | Runs strapi-plugin build to emit production assets into dist/[email protected]#23-28 |
| yarn watch | Watches admin + server sources for changes and rebuilds [email protected]#23-28 |
| yarn watch:link | Builds and outputs artifacts suitable for linking into another Strapi app during [email protected]#23-28 |
When iterating on the admin UI, keep yarn watch running here and yarn develop --watch-admin in your host Strapi project for hot reloads.
License
MIT © Mendrika [email protected]#58-61
