mirror of
https://github.com/n8n-io/n8n.git
synced 2026-10-12 02:19:43 +00:00
feat(core): Add backend module scaffolding (no-changelog) (#40482)
This commit is contained in:
@@ -12,15 +12,18 @@ Benefits of modularity:
|
||||
|
||||
## File structure
|
||||
|
||||
To set up a backend module, run this command at monorepo root:
|
||||
To set up a packaged backend module, run this command at the monorepo root:
|
||||
|
||||
```sh
|
||||
pnpm setup-backend-module
|
||||
pnpm n8n-module-sdk create my-feature --stack=backend
|
||||
```
|
||||
|
||||
The setup command creates a module at `packages/cli/src/modules/my-feature`. Rename `my-feature` in the directory name and file names. Use kebab-case.
|
||||
The command creates a built workspace package at `packages/modules/my-feature/backend`. It also
|
||||
adds the package to the backend runtime manifest.
|
||||
|
||||
A decoupled module can instead use a built workspace package at `packages/modules/my-feature/backend`. The package name uses the `@n8n/backend-module-<name>` pattern. Add a lazy package import to `packages/cli/src/modules/modules.manifest.ts`. Add the package as a runtime dependency of `n8n`.
|
||||
Use `pnpm setup-backend-module` only when the module must stay in
|
||||
`packages/cli/src/modules/my-feature`. Rename `my-feature` in the generated directory and file
|
||||
names. Use kebab-case.
|
||||
|
||||
A module’s file structure is as follows:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user