--- title: Modules description: Reuse Nextflow definitions across pipelines using local and registry modules. --- # Modules Nextflow scripts can include **definitions** (workflows, processes, and functions) from other scripts. A **module** is a self-contained process definition and corresponding [spec file][dev-modules-structure]. Modules can be reused within a pipeline and can be shared across projects. By packaging process definitions as modules, you avoid duplicating code and benefit from community improvements. There are two ways to use modules in Nextflow: - [Local modules](#local-modules) - [Registry modules](#registry-modules) See [Using modules][using-modules-page] to learn how to install and use modules in a project. See [Developing modules][dev-modules-page] to learn how to create and publish your own modules. See [Nextflow module registry][module-registry-page] to learn how to use the Nextflow module registry. ## Local modules Local modules are stored and maintained directly in your project. You include definitions from local modules using the `include` keyword with a relative path: ```nextflow include { CAT } from './modules/cat' workflow { data = channel.fromPath('data/*.txt') CAT(data) } ``` The above snippet imports a process named `CAT` from the *included script* into the *including script*. The include source `./modules/cat` refers to the script `./modules/cat.nf` relative to the including script path. Local modules are well suited for project-specific components that are not intended for sharing. ## Registry modules Registry modules are sourced from the [Nextflow registry](https://registry.nextflow.io) or a compatible module registry. Like local modules, registry modules are stored in your project, but they are installed and managed using the `nextflow module` command. Key features of registry modules: - **Discoverability**: Search for modules by keyword or name and browse available versions. - **Version management**: Pin specific versions or use the latest release, with automatic integrity checking via checksums. - **Direct execution**: Run modules as standalone workflows for ad-hoc tasks or testing without writing a wrapper script. - **Standard structure**: Each module includes a script (`main.nf`), spec (`meta.yml`), and documentation (`README.md`), providing a consistent structure for tooling and automation. :::note Modules from the [nf-core](https://nf-co.re/) community are automatically mirrored to the Nextflow module registry under the `nf-core` namespace. ::: Install registry modules into your project and include them by name: ```console $ nextflow module install nf-core/fastqc ``` ```nextflow include { FASTQC } from 'nf-core/fastqc' ``` [dev-modules-page]: ./developing-modules [dev-modules-structure]: ./developing-modules#module-structure [module-registry-page]: ./module-registry [using-modules-page]: ./using-modules