Rspress

repository·main·Indexed 11 days ago

https://github.com/web-infra-dev/rspress

A high-performance static site generator based on Rsbuild, designed for fast development and deployment of MDX-based documentation and content-heavy websites. It includes a CLI for scaffolding, building, and previewing sites, as well as official plugins for API doc generation (@rspress/plugin-api-docgen), TypeDoc integration (@rspress/plugin-typedoc), RSS feeds, sitemaps, and interactive playgrounds.

Tokens
123.4K
Snippets
489
Records
586
Agent score
79%

What's inside Rspress

  1. What is Rspress 2.0

    main

    Rspress is a static site generator (SSG) built on Rsbuild, specifically designed as a documentation site tool for developers.

    Version 2.0 introduces several major improvements over 1.x:

    • Enhanced Theme Styling: A new default theme and improved APIs for custom themes.
    • AI-native Capabilities: Built-in llms.txt generation and SSG-MD (Static Site Generation for Markdown) to provide high-quality content for AI Agents.
    • Instant Startup: Uses lazyCompilation by default, building only required files for visited routes to ensure fast startup regardless of project size.
    • Shiki Code Highlighting: Integrated by default for build-time syntax highlighting with theme switching support.
    • Improved DX (Developer Experience): Optimized HMR for configuration files (_nav.json, _meta.json), dead link checking, and improved JSON schema support for IDE hints.
  2. What is Rspress

    main

    Rspress is a high-performance, React-based static site generator (SSG) built on top of Rsbuild. It is designed for building documentation sites, blogs, or product homepages.

    Key features include:

    • Millisecond-level startup performance.
    • AI-native SSG-MD capabilities.
    • Full MDX support.
    • Built-in full-text search.
    • Internationalization (i18n) and multi-version documentation support.
    • A default documentation theme that can be customized.
  3. Overview of Rspress features

    main

    Rspress is a lightning-fast Static Site Generator (SSG) built on the Rust-powered front-end toolchain (Rsbuild). Key features include:

    • Blazing fast build speed: Leverages Rust-powered tools for a high-performance development experience.
    • MDX Support: Allows you to use React components directly within your Markdown content.
    • Built-in full-text search: Automatically generates a search index during the build process for out-of-the-box search capabilities.
    • AI-friendly: Supports generating llms.txt-compliant indexes and Markdown files via SSG-MD to help Large Language Models (LLMs) better understand your documentation.
    • Static Site Generation: Produces static HTML files suitable for deployment on any hosting provider.
    • Flexible customization: Provides extension APIs to customize both the theme UI and the build process.
  4. Compare Rspress with other SSG frameworks

    main

    Rspress is a high-performance static site generator (SSG) based on Rsbuild. When choosing between Rspress and other popular frameworks, consider these key differentiators:

    Rspress vs. Docusaurus

    • Performance: Rspress uses lazyCompilation and persistent cache to achieve millisecond-level cold starts.
    • Complexity: Rspress offers a lower learning curve with simpler configuration and built-in features like search and multi-version docs.
    • Abstraction: Rspress provides a higher-level abstraction over the bundler. Instead of managing complex bundler plugins (like html-webpack-plugin), you can use user-friendly options like builderConfig.html.tags to add tags to the <head>.

    Rspress vs. Nextra

    • Performance: Rspress provides better build performance.
    • Deployment: Rspress is lighter and produces pure HTML, making it suitable for deployment as a pure static site. Nextra is tied to Next.js and includes Next.js runtime code, which often requires deployment as an application using next start.

    Rspress vs. VitePress

    • Rendering Framework: Rspress uses React, whereas VitePress uses Vue.
    • Content Format: Rspress uses MDX, while VitePress uses Markdown with Vue component support.
    • Production Build: While both have fast development starts, Rspress is faster during the production bundling phase compared to VitePress (which uses Rollup).
  5. Understand the Rspress project structure

    main

    When using a project scaffolded by create-rspress, the following directory structure is used:

    • docs/: The source directory for your documentation. This is defined by the root key in rspress.config.ts.
    • docs/_nav.json: Configuration file for the navigation bar.
    • docs/[section]/_meta.json: Configuration file for the sidebar within a specific section (e.g., docs/guide/_meta.json).
    • docs/public/: Directory for static assets.
    • theme/: An optional directory for custom themes (only present if the custom theme scaffold was selected).
    • rspress.config.ts: The main configuration file for Rspress.
  6. Explore official Rspress plugins

    main

    Rspress provides a suite of official plugins to extend the functionality of your documentation site. These plugins cover search, API documentation generation, SEO, interactive playgrounds, and more.

    Available Official Plugins:

    • Search: @rspress/plugin-algolia replaces built-in search with Algolia-based DocSearch.
    • API Documentation:
      • @rspress/plugin-api-docgen: Automatically generates API reference content using react-docgen-typescript and documentation.
      • @rspress/plugin-typedoc: Automatically generates API documentation for TypeScript modules using TypeDoc.
    • SEO & Discovery:
      • @rspress/plugin-sitemap: Automatically generates a sitemap for search engine crawling.
      • @rspress/plugin-rss: Generates RSS files using feed.
      • @rspress/plugin-llms: Generates llms.txt files to help Large Language Models understand your documentation.
    • Interactive Code & Previews:
      • @rspress/plugin-playground: Provides a real-time playground for Markdown/MDX code blocks.
      • @rspress/plugin-preview: Enables previewing of Markdown/MDX code blocks.
      • @rspress/plugin-twoslash: Integrates Twoslash to generate rich code blocks with type information.
    • Navigation:
      • @rspress/plugin-client-redirects: Adds client-side redirects to your site.