
Security News
Feross on TBPN: How North Korea Hijacked Axios
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.
A command-line interface tool for managing and generating product catalog documentation.
A CLI to build product directory and landing pages for Docusaurus-powered sites.
prodcat is a command-line tool designed to streamline the creation and maintenance of product documentation for sites built with Docusaurus. It takes a structured list of products from a single source file and uses customizable templates to automatically generate a full directory structure of Markdown pages.
This project solves the tedious and error-prone task of manually creating and updating individual documentation pages for a large catalog of products. By treating your product data as the single source of truth, prodcat ensures consistency and dramatically speeds up your documentation workflow.
init command, which interactively guides you through creating a configuration file.prodcat.config.js file, making your documentation setup version-controllable and easy to replicate.For most use cases, running prodcat with npx is the recommended approach as it uses the latest version without a global installation.
npx prodcat --help
If you prefer to have the prodcat command available system-wide:
npm install -g prodcat
Verify the installation:
prodcat --version
Here is a minimal example of how to set up and run prodcat in your project.
Run the init command in the root of your repository. It will ask a few questions to create a prodcat.config.js file.
npx prodcat init
This will create a prodcat.config.js file similar to this:
// prodcat.config.js
export default {
docsRoot: 'website/docs',
productsFilePath: 'products.js',
productsOutputPath: 'website/docs/products',
// ...and other settings
};
Create a products.js file (or the name you specified) with an array of your product objects.
// products.js
export default [
{
name: '4K Smart TV',
id: '4k-smart-tv-j5k6l', // URL-friendly slug
description: 'A stunning 4K television with smart features.',
category: 'Electronics',
},
{
name: 'Noise-Cancelling Headphones',
id: 'nc-headphones-g3h4i',
description: 'Immerse yourself in sound.',
category: 'Audio',
},
];
Execute the generate command. prodcat will read your products.js file, process it through the default templates, and write the output files.
npx prodcat generate
After running, prodcat will generate a directory structure inside the path specified by productsOutputPath.
website/docs/products/
├── 4k-smart-tv-j5k6l/
│ └── index.md
├── nc-headphones-g3h4i/
│ └── index.md
└── index.md
The Docusaurus development server will automatically pick up these new files and render them as part of your site.
prodcat generateGenerates the product documentation pages.
Alias: g
Options:
-i, --input <path>: (Short for --input) Specifies the path to the product data file. Overrides the productsFilePath value in your config.--update-navbar: Injects a link to the products page into the Docusaurus navbar. (Default: false)--navbar-label <string>: The text label for the new navbar link. Defaults to config.defaultNavbarLabel (or "Products" if not set).--navbar-position <specifier>: Position of the link. Formats: 'left', 'right', 'left:start', 'right:end', 'before:Label', 'after:Label'. Defaults to config.defaultNavbarPosition (or "left" if not set).To automatically add a link to your product catalog in your site's navigation bar, use the --update-navbar flag.
# Generate docs and add a "Catalog" link after the "Docs" link
npx prodcat generate \
--update-navbar \
--navbar-label "Catalog" \
--navbar-position "after:Docs"
prodcat initStarts an interactive wizard to create a prodcat.config.js file.
Alias: i
Arguments:
[configFile]: The name of the configuration file to create. (Default: prodcat.config.js)Options:
-f, --force: Overwrite an existing configuration file without prompting.-y, --yes: Skip all interactive prompts and use default values.prodcat is configured via a prodcat.config.js file in the root of your project.
Example prodcat.config.js:
export default {
// Root directory for Docusaurus docs.
docsRoot: 'website/docs',
// Path to the JS file containing product data.
productsFilePath: 'products.js',
// Directory where generated product pages will be saved.
productsOutputPath: 'website/docs/products',
// A pattern for generating product page paths.
landingPagePathPattern: '{{{ productsOutputPath }}}/{{{ product.id }}}',
// Defines the template files to use for generation.
templates: {
'products-directory': 'templates/products-directory.md.hbs',
'landing-page': 'templates/landing-page.md.hbs',
},
};
Here's a detailed breakdown of all available configuration options with the new, clearer naming convention.
defaultNavbarLabelstring"Products"--update-navbar flag without specifying --navbar-label.defaultNavbarPositionstring"left"--update-navbar flag without specifying --navbar-position. Accepts formats like 'left', 'right', 'before:Label', etc.docsRootstringwebsite/docsdocs folder). All generated paths are typically relative to this directory.docusaurusConfigPathstringwebsite/docusaurus.config.js--update-navbar feature.landingPagePathPatternstring{{{ directoryPath }}}/{{{ product.id }}}directoryPath (the productsOutputPath value) and product.id.productsFilePathstringproducts.jsproductsOutputPathstringwebsite/docs/productsprodcat will generate all product-related documentation files (both the product directory index and individual product landing pages).sidebarsPathstringwebsite/sidebars.jssidebars.js file. Similar to docusaurusConfigPath, this is for structural reference.templatesobjecttemplates['landing-page']: Path to the template for individual product pages.templates['products-directory']: Path to the template for the main product directory index page.prodcat executes JavaScript files specified in your configuration (prodcat.config.js, products.js). This is a powerful feature that allows for dynamic data generation. Only run this tool with configuration files from trusted sources.
prodcat is designed for efficient generation of documentation, but it's important to be aware of certain performance characteristics, especially with large datasets or specific features.
The tool loads the entire product data file (specified by productsFilePath) into memory at once. This approach works well for moderately sized product catalogs. However, for very large datasets (e.g., hundreds of thousands or millions of products), loading all data into memory can lead to high memory consumption and potential out-of-memory errors, limiting scalability. If you anticipate extremely large product catalogs, consider alternative data storage solutions (like databases or streamable formats) and a customized data loading mechanism for prodcat.
The --update-navbar feature (used with the generate command) modifies your Docusaurus configuration file (docusaurus.config.js) by parsing its JavaScript code into an Abstract Syntax Tree (AST), modifying the AST, and then writing it back. AST manipulation is a computationally intensive process. While performed only once per generate command execution, it can add a noticeable overhead. For critical build pipelines or frequent runs, be mindful of this performance cost.
To set up the development environment for prodcat itself:
git clone https://github.com/your-username/prodcat.git
cd prodcat
npm install
node:
node ./bin/cli.js generate --help
This project uses Jest for testing. To run the test suite:
npm test
Contributions are welcome! Please feel free to submit a pull request. We recommend creating an issue first to discuss any major changes.
For more details, please see our (forthcoming) CONTRIBUTING.md file and be sure to follow our Code of Conduct.
This project is licensed under the MIT License. See the LICENSE file for details.
FAQs
A command-line interface tool for managing and generating product catalog documentation.
The npm package prodcat receives a total of 1 weekly downloads. As such, prodcat popularity was classified as not popular.
We found that prodcat demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.

Security News
OpenSSF has issued a high-severity advisory warning open source developers of an active Slack-based campaign using impersonation to deliver malware.

Research
/Security News
Malicious packages published to npm, PyPI, Go Modules, crates.io, and Packagist impersonate developer tooling to fetch staged malware, steal credentials and wallets, and enable remote access.