A comprehensive, stand-alone tool to extract, process, and statically generate documentation (including API reference) for all major Amplify platforms from the official aws-amplify/docs repository.
-
Fully Stand-alone:
No need to run from inside the Amplify docs repo. This tool will automatically fetch the latest code from the main branch ofaws-amplify/docs.git. -
Multi-Platform Support:
Extracts and processes documentation for all Gen2 and Gen1 platforms:react,vue,angular,nextjs,react-native,javascript,android,swift,flutter
-
Automated Processing Pipeline:
For each platform, the tool:- Extracts all relevant documentation (with platform-specific and shared content)
- Preserves general content from overview pages while generating proper navigation
- Adds breadcrumbs to every Markdown file for easy navigation
- Generates comprehensive API reference documentation for every service category (Auth, Storage, Analytics, API, etc.) in every platform's output
-
Complete API Reference Coverage:
- Automatically detects and extracts all available API categories from the Amplify source
- Provides detailed API documentation including parameters, return types, and examples
- Matches the structure of the original docs site with proper reference directories
- Includes proper navigation with table of contents and links
-
Output:
- All processed documentation is output to
./extracted-docs/gen2-docs-<platform>/and./extracted-docs/gen1-docs-<platform>/for each platform. - API reference docs are generated in
build-a-backend/add-aws-services/<category>/reference/index.mdand atbuild-a-backend/add-aws-services/<category>/reference.mdwithin each Gen2 platform directory. - Each platform directory includes both a
README.mdandindex.htmlfile with platform-specific information, providing useful content when browsing at the root level.
- All processed documentation is output to
-
Install Node.js (if not already installed).
-
Run the extractor:
node extract-and-format-all-docs.js
This will:
- Clone (or update) the latest
aws-amplify/docsrepo into./aws-amplify-docs - Extract and process documentation for all supported platforms
- Add breadcrumbs
- Generate comprehensive API reference docs for each category across all platforms
- Clone (or update) the latest
-
Result:
The fully processed documentation will be in the./extracted-docs/directory:./extracted-docs/gen2-docs-<platform>/./extracted-docs/gen1-docs-<platform>/
Each Gen2 platform will have API reference docs in both formats for compatibility:
./extracted-docs/gen2-docs-<platform>/build-a-backend/add-aws-services/<category>/reference.md ./extracted-docs/gen2-docs-<platform>/build-a-backend/add-aws-services/<category>/reference/index.md
-
extract-and-format-all-docs.js
Orchestrates the entire workflow: fetches the latest docs, runs all processing scripts for every platform, and generates comprehensive API reference docs. Ensures proper directory structure matching the original docs site. -
scripts/extract-docs.js
Extracts platform-specific and shared content from all Amplify documentation.mdxfiles, converts them to Markdown, and outputs them to the appropriate platform directory. Handles platform-specific content filters and properly processes special components. Now preserves general (all-platform) content from overview pages while still generating proper navigation structure. -
scripts/add-breadcrumbs.js
Adds a breadcrumb trail to the top of every Markdown file, reflecting the file's full path and context within the documentation. Ensures navigation is intuitive and consistent. -
scripts/extract-api-reference.js
Extracts comprehensive API reference data from the Amplify API model JSON file:- Dynamically identifies all service categories from multiple sources in the JSON
- Creates detailed API documentation with parameter info, return types, and examples
- Generates table of contents for easy navigation
- Ensures compatibility with both original documentation paths
-
scripts/create-html-indexes.js
Creates HTML index files from README.md files in all platform directories:- Automatically converts Markdown syntax to HTML
- Generates well-formatted HTML with consistent styling
- Provides default content when browsing platform directories via HTTP
-
Adding or Removing Platforms:
Edit thePLATFORMSarray inextract-and-format-all-docs.js. -
Running Scripts Individually:
See usage information in the comments at the top of each script in thescripts/directory. -
Customizing API Category Detection:
Edit theknownCategoriesarray inscripts/extract-api-reference.jsto add or modify service categories. -
Mapping between Different Category Names:
Update thecategoryMappingobject inscripts/extract-api-reference.jsto handle mappings between kebab-case and camelCase service names.
The extraction process carefully analyzes the structure of the AWS Amplify Docs repository to ensure complete coverage:
-
Content Extraction: Analyzes the dynamic routing structure of the Next.js app to identify all documentation pages, including special handling for platform-specific content through
<InlineFilter>components. -
Structure Preservation: Maintains the logical structure of the original documentation while optimizing for static browsing.
-
API Reference Extraction: Parses the comprehensive
amplify-js.jsonspecification file to extract detailed API references:- Intelligently detects all service categories
- Handles both standard and special-case categories
- Creates detailed documentation with proper navigation
-
Path Alignment: Creates reference documentation in both formats (
<category>/reference.mdand<category>/reference/index.md) to ensure compatibility with all link patterns.
Output:
A complete, static, and easily navigable documentation set for Amplify Gen2 and Gen1, for every major platform, including comprehensive API reference docs for all service categories. The output closely mirrors the structure of the original AWS Amplify documentation site while being fully static and self-contained.