# hashicorp/next-mdx-remote

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/hashicorp-next-mdx-remote).**

3,073 stars · 147 forks · TypeScript · mpl-2.0

## Links

- GitHub: https://github.com/hashicorp/next-mdx-remote
- awesome-repositories: https://awesome-repositories.com/repository/hashicorp-next-mdx-remote.md

## Description

next-mdx-remote is a rendering library for Next.js that serializes and renders MDX content from remote sources. It functions as a secure MDX compiler and remote content serializer, transforming MDX strings from external APIs or databases into a format compatible with client-side hydration.

The library distinguishes itself through a secure compilation process that restricts JavaScript execution and global variable access to prevent remote code execution. It utilizes a custom component mapper to replace standard HTML elements in markdown with specific React components, allowing for dynamic control over styling and behavior.

The system provides utilities for parsing markdown frontmatter to extract structured metadata and supports the injection of custom data and global variables into the document scope. It optimizes performance by serializing content on the server to defer component hydration and improve initial page load speeds.

## Tags

### Programming Languages & Runtimes

- [Secure Compilers](https://awesome-repositories.com/f/programming-languages-runtimes/javascript-compilers/secure-compilers.md) — Implements a secure MDX compiler that restricts JavaScript execution to prevent remote code execution vulnerabilities.
- [Markdown Serializers](https://awesome-repositories.com/f/programming-languages-runtimes/bytecode-compiled-languages/source-to-bytecode-compilers/markdown-serializers.md) — Compiles markdown into a serialized intermediate representation on the server to avoid shipping heavy compilers to the browser.
- [Execution Restrictions](https://awesome-repositories.com/f/programming-languages-runtimes/runtime-execution-environments/runtime-environments/runtimes/javascript-and-web-standard/secure-javascript-runtimes/execution-restrictions.md) — Restricts the interpretation of JavaScript during the compilation process to prevent unauthorized remote code execution. ([source](https://github.com/hashicorp/next-mdx-remote#readme))

### Web Development

- [MDX Rendering Frameworks](https://awesome-repositories.com/f/web-development/mdx-rendering-frameworks.md) — Provides a comprehensive library for serializing and rendering MDX content from remote sources within Next.js applications.
- [Deferred Loading](https://awesome-repositories.com/f/web-development/performance-optimizations/initial-page-load-optimizations/deferred-loading.md) — Optimizes initial page load speed by delaying the activation of interactive components through server-side serialization. ([source](https://github.com/hashicorp/next-mdx-remote#readme))
- [Static Site Performance Optimization](https://awesome-repositories.com/f/web-development/static-site-performance-optimization.md) — Improves page load speeds by serializing content on the server and deferring component hydration.

### Data & Databases

- [CMS Content Fetching](https://awesome-repositories.com/f/data-databases/remote-data-fetching/cms-content-fetching.md) — Retrieves MDX page structures and content from remote APIs or CMS for frontend rendering. ([source](https://github.com/hashicorp/next-mdx-remote/blob/main/package.json))
- [Frontmatter](https://awesome-repositories.com/f/data-databases/data-processing-pipelines/data-serialization/json-schema/metadata-schemas/frontmatter.md) — Extracts structured metadata defined in the headers of content files for use as page variables.

### Security & Cryptography

- [Context Isolation Strategies](https://awesome-repositories.com/f/security-cryptography/application-and-system-security/sandbox-and-isolation/runtime-process-isolation/context-isolation-strategies.md) — Implements security models that separate script execution contexts to prevent remote code execution vulnerabilities.
- [Remote Code Execution Mitigations](https://awesome-repositories.com/f/security-cryptography/remote-code-execution-mitigations.md) — Prevents remote code execution by blocking unauthorized access to constructors and internal functions during MDX compilation.

### User Interface & Experience

- [Component-Based Element Mappings](https://awesome-repositories.com/f/user-interface-experience/component-based-element-mappings.md) — Provides a system that maps markdown document elements to specific React components for tailored presentation.
- [Remote Content Renderers](https://awesome-repositories.com/f/user-interface-experience/content-rendering-components/remote-content-renderers.md) — Provides components for loading and rendering MDX content fetched from external remote sources. ([source](https://github.com/hashicorp/next-mdx-remote/blob/main/index.d.ts))
- [Content Serializers](https://awesome-repositories.com/f/user-interface-experience/content-serializers.md) — Transforms MDX source text into a serialized format that can be passed as a property to a React component. ([source](https://github.com/hashicorp/next-mdx-remote/blob/main/serialize.d.ts))
- [Custom Component Injection](https://awesome-repositories.com/f/user-interface-experience/custom-element-renderers/custom-component-injection.md) — Allows replacing default markdown tags with custom React components to control styling and behavior. ([source](https://github.com/hashicorp/next-mdx-remote/blob/main))

### Content Management & Publishing

- [Markdown Parsers](https://awesome-repositories.com/f/content-management-publishing/content-processing-transformation/markdown-markup-tools/markdown-processors/markdown-parsers.md) — Interprets markdown syntax to extract structured frontmatter metadata for use as page variables.
- [Headless CMS Integrations](https://awesome-repositories.com/f/content-management-publishing/headless-cms-integrations.md) — Bridges headless CMS installations to Next.js frontends using MDX for component-based layouts.
- [Markdown Parsing Pipelines](https://awesome-repositories.com/f/content-management-publishing/markdown-parsing-pipelines.md) — Utilizes configurable parsing pipelines to extract structured metadata from the top of markdown files. ([source](https://github.com/hashicorp/next-mdx-remote#readme))

### Development Tools & Productivity

- [Data Injection](https://awesome-repositories.com/f/development-tools-productivity/data-injection.md) — Provides mechanisms for dynamically populating MDX documents with external variables and serializable data. ([source](https://github.com/hashicorp/next-mdx-remote#readme))

### Software Engineering & Architecture

- [Runtime Variable Injections](https://awesome-repositories.com/f/software-engineering-architecture/application-lifecycle-management/configuration-management/environment-variable-management/environment-variable-injection/runtime-variable-injections.md) — Injects custom data into the execution context to be referenced as JavaScript variables within the content. ([source](https://github.com/hashicorp/next-mdx-remote/blob/main))
- [Serialization-to-Hydration Pipelines](https://awesome-repositories.com/f/software-engineering-architecture/software-architecture/architectural-patterns/reactive-messaging/pipeline-processing-architectures/two-stage-parsing/serialization-to-hydration-pipelines.md) — Transforms MDX source into a portable data format on the server to be hydrated as a React component on the client.
