{"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"preview","__idx":0},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["preview"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"introduction","__idx":1},"children":["Introduction"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["preview"]}," command starts a local preview server for a Redocly project."," ","Use the preview server to develop your project locally before deployment."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"usage","__idx":2},"children":["Usage"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"redocly preview\nredocly preview --product=revel\nredocly preview --product=reef --plan=pro\nredocly preview --product=reef --plan=pro --project-dir=./my-docs-project --port=4001\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"options","__idx":3},"children":["Options"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Option"},"children":["Option"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["--help"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["boolean"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Show help."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["--plan"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Product plan to use in preview. ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}," ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Possible values:"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pro"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["enterprise"]},". The default value is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["enterprise"]},". For more details, see ",{"$$mdtype":"Tag","name":"Link","attributes":{"href":"https://redocly.com/pricing/"},"children":["plans"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["--product"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Name of a product to preview the project with. ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}," ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Possible values:"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["redoc"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["revel"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["reef"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["realm"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["redoc-revel"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["redoc-reef"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["revel-reef"]},". ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["redoc"]}," is the flagship product for generating API documentation from OpenAPI specifications. ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["revel"]}," is a specialized product designed for external API applications. ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["reef"]}," is a specialized product designed for internal API needs. ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["realm"]}," is a balanced product combining ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["redoc"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["revel"]},", and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["reef"]},". ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["redoc-revel"]}," is a blended product combining ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["redoc"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["revel"]},". ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["redoc-reef"]}," is a blended product combining ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["redoc"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["reef"]},". ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["revel-reef"]}," is a blended product combining ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["revel"]}," and ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["reef"]},". ",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]}," The default value is autodetected from the project's ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["package.json"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["realm"]}," is used."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["--project-dir, -d"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Path to the project directory. The default value is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["."]}," (current directory)."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["--port, -p"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["number"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The port to run the preview server on. The default value is ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["4000"]},"."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["--version"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["boolean"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Show version number."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"examples","__idx":4},"children":["Examples"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"select-a-product-for-preview","__idx":5},"children":["Select a product for preview"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Specify the product package to use by setting the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--product"]}," option."," ","If this setting is not supplied, the preview command tries to guess which package to use from the project's ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["package.json"]}," or use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["realm"]}," by default."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"redocly preview --product=revel\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"select-a-plan-for-preview","__idx":6},"children":["Select a plan for preview"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["By default, previews are run in enterprise plan mode."," ","This mode makes all of the enterprise features available."," ","Switch the preview to pro plan mode by setting the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--plan"]}," option to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["pro"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"redocly preview --plan=pro\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"specify-project-directory","__idx":7},"children":["Specify project directory"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["By default, the preview command uses the current directory."," ","To specify another directory, provide a path relative to the current directory using the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["--project-dir"]}," option:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"redocly preview --project-dir=./path/to/my/docs/\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"use-custom-port-for-preview","__idx":8},"children":["Use custom port for preview"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["By default, the preview starts on port ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["4000"]},", so you can access the docs at ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["http://localhost:4000"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["http://127.0.0.1:4000"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To specify a custom port for the preview, pass the desired value using the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["port"]}," option:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"redocly preview --port=8888\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This command starts the preview on port 8888, so you can access the docs at ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["http://localhost:8888"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["http://127.0.0.1:8888"]},"."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"troubleshoot","__idx":9},"children":["Troubleshoot"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"internal-server-error","__idx":10},"children":["Internal Server Error"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["An ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Internal Server Error"]}," page when running the preview command is often caused by a corrupted or outdated npx cache."," ","The preview command uses npx internally to launch product packages, and cached packages can sometimes cause issues."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"clear-the-npx-cache","__idx":11},"children":["Clear the npx cache"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Clear the npx cache:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"npm cache clean --force\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["After clearing the cache, try running the preview command again."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"install-redocly-cli-globally","__idx":12},"children":["Install Redocly CLI globally"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Install Redocly CLI globally to avoid cache-related issues:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"npm install -g @redocly/cli@latest\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["After installation, the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["redocly"]}," command is available globally, which helps avoid npx cache issues."]}]},"frontmatter":{},"tagList":["html"],"title":"preview","lastModified":"2025-11-06T11:14:39.000Z"}