Creating a Nitro Module
This guide will walk you through creating a Nitro Module with and without an example app, as well as specifying a directory.
With example app
To create a Nitro Module along with an example app, use the following command. This will generate a new module and an example app to help you get started quickly.
- Bun
- Npx
- Pnpm
- Yarn
bun create nitro-module@latest my-awesome-module
npx create-nitro-module@latest my-awesome-module
pnpm create nitro-module@latest my-awesome-module
yarn create nitro-module@latest my-awesome-module
Without example app
If you prefer to create a Nitro Module without an example app, use the following command. This will generate only the module, without any additional example app.
- Bun
- Npx
- Pnpm
- Yarn
bun create nitro-module@latest my-awesome-module --skip-example
npx create-nitro-module@latest my-awesome-module --skip-example
pnpm create nitro-module@latest my-awesome-module --skip-example
yarn create nitro-module@latest my-awesome-module --skip-example
The --skip-example
flag indicates that the example app should be skipped.
Specifying a directory
If you prefer to create a Nitro Module within a specific directory, use the following command:
- Bun
- Npx
- Pnpm
- Yarn
bun create nitro-module@latest my-awesome-module --module-dir packages
npx create-nitro-module@latest my-awesome-module --module-dir packages
pnpm create nitro-module@latest my-awesome-module --module-dir packages
yarn create nitro-module@latest my-awesome-module --module-dir packages
This command will create a Nitro Module within the packages
directory as shown in the example above.