Skip to main content

Documentation Export Tool for AI/Agent Consumption

This tool exports all Mambu documentation into a structured JSON format optimized for AI agents, vector databases, and RAG (Retrieval-Augmented Generation) systems.

Overview​

Exports 4,507+ documents including:

  • User Guide documentation
  • API v1 and v2 reference docs
  • Streaming API documentation
  • Payments API documentation
  • ~1.6 million words of content

Quick Start​

Basic Usage​

# Export all documentation to default file (docs-export.json)
node scripts/export-docs-for-ai.js

# Export to a custom file
node scripts/export-docs-for-ai.js my-export.json

Add to package.json​

{
"scripts": {
"export-docs": "node scripts/export-docs-for-ai.js"
}
}

Then run:

yarn export-docs

Output Format​

The exported JSON file contains:

Structure​

{
"meta": {
"version": "1.0",
"exportDate": "2026-01-09T14:08:11.820Z",
"source": "Mambu Documentation Hub",
"baseUrl": "https://docs.mambu.com",
"generator": "export-docs-for-ai.js"
},
"statistics": {
"totalDocuments": 4507,
"totalWords": 1597277,
"averageWordsPerDoc": 354,
"totalTags": 518,
"tags": ["api", "deposits", "loans", ...],
"documentsByCategory": {
"api": 1234,
"docs": 890,
...
}
},
"categories": ["api", "docs", ...],
"documents": [...],
"documentsByCategory": {...}
}

Document Object​

Each document in the documents array contains:

{
"id": "docs/deposits/deposit-accounts",
"title": "Deposit Accounts",
"description": "Learn about deposit account management in Mambu",
"url": "https://docs.mambu.com/docs/deposits/deposit-accounts",
"filePath": "docs/deposits/deposit-accounts.md",
"content": "# Full markdown content with code blocks...",
"cleanContent": "Cleaned text without code blocks for better AI processing...",
"metadata": {
"sidebar_label": "Deposit Accounts",
"sidebar_position": 2,
"tags": ["deposits", "accounts", "banking"],
"keywords": ["deposit", "savings", "current account"],
"lastModified": "2026-01-09T12:52:40.704Z",
"fileSize": 15420
}
}

Use Cases​

1. AI Agent / Chatbot​

Feed the exported JSON into an AI agent to answer questions about Mambu:

import json

# Load documentation
with open('docs-export.json') as f:
docs = json.load(f)

# Use with LangChain, LlamaIndex, or your preferred framework
for doc in docs['documents']:
# Process doc['cleanContent'] for vector embeddings
# Use doc['metadata']['tags'] for filtering
# Reference doc['url'] for citations
pass

2. Vector Database Ingestion​

Perfect for RAG systems with Pinecone, Weaviate, ChromaDB, etc:

const exportData = require('./docs-export.json');

for (const doc of exportData.documents) {
await vectorDB.upsert({
id: doc.id,
text: doc.cleanContent,
metadata: {
title: doc.title,
url: doc.url,
tags: doc.metadata.tags,
category: doc.id.split('/')[0]
}
});
}

3. Search Index​

Build a custom search engine or enhance existing search:

const exportData = require('./docs-export.json');

// Index by category
const depositDocs = exportData.documentsByCategory['deposits'];

// Search by tags
const apiDocs = exportData.documents.filter(doc =>
doc.metadata.tags.includes('api')
);

4. Documentation Analysis​

Analyze documentation coverage and quality:

const { statistics } = require('./docs-export.json');

console.log(`Total documentation: ${statistics.totalWords.toLocaleString()} words`);
console.log(`Topics covered: ${statistics.totalTags} unique tags`);
console.log(`Categories: ${Object.keys(statistics.documentsByCategory).length}`);

Storage & Distribution​

Local Development​

  • File size: ~140 MB (uncompressed JSON)
  • Compress with gzip for ~10-15 MB

S3 Upload (For Fadel's Use Case)​

# Upload to S3
aws s3 cp docs-export.json s3://your-bucket/mambu-docs/docs-export.json

# Upload with gzip compression
gzip -c docs-export.json | aws s3 cp - s3://your-bucket/mambu-docs/docs-export.json.gz \
--content-encoding gzip \
--content-type application/json

CDN Distribution​

# Make available via CDN for agent consumption
aws s3 cp docs-export.json s3://your-bucket/mambu-docs/docs-export.json \
--acl private \
--cache-control max-age=3600

Field Descriptions​

FieldDescription
idUnique identifier based on file path
titleDocument title (from frontmatter or first H1)
descriptionBrief description (from frontmatter)
urlFull URL to the live documentation page
filePathOriginal file path in the repository
contentFull markdown content with code blocks and formatting
cleanContentCleaned text without code blocks, imports, or admonitions - optimized for AI
metadata.tagsArray of topic tags for categorization
metadata.keywordsSEO keywords
metadata.lastModifiedISO timestamp of last file modification
metadata.fileSizeFile size in bytes

Advanced Usage​

Filter by Category​

const exportData = require('./docs-export.json');

// Get all API documentation
const apiDocs = exportData.documentsByCategory['api'];

// Get all user guide docs
const userGuideDocs = exportData.documentsByCategory['docs'];

Filter by Tags​

// Find all documents about deposits
const depositDocs = exportData.documents.filter(doc =>
doc.metadata.tags.includes('deposits')
);

// Find all API v2 documentation
const apiV2Docs = exportData.documents.filter(doc =>
doc.metadata.tags.includes('api-v2')
);

Search by Content​

// Find documents mentioning a specific topic
const loanDocs = exportData.documents.filter(doc =>
doc.cleanContent.toLowerCase().includes('loan')
);

Automation​

Schedule Regular Exports​

Add to your CI/CD pipeline:

# .github/workflows/export-docs.yml
name: Export Documentation

on:
schedule:
- cron: '0 0 * * 0' # Weekly on Sunday
workflow_dispatch:

jobs:
export:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '18'
- run: yarn install
- run: node scripts/export-docs-for-ai.js
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- run: |
gzip -c docs-export.json > docs-export.json.gz
aws s3 cp docs-export.json.gz s3://your-bucket/mambu-docs/

Statistics (Current Export)​

  • Total Documents: 4,507
  • Total Words: 1,597,277
  • Average Words per Document: 354
  • Unique Tags: 518
  • Categories: 4 (api, docs, documentation-guidelines, markdown-page)
  • File Size: ~140 MB (JSON), ~15 MB (gzipped)

Troubleshooting​

Out of Memory Error​

If you encounter memory issues with large exports:

node --max-old-space-size=4096 scripts/export-docs-for-ai.js

Parsing Errors​

Check the console output for specific files that failed to parse. Common issues:

  • Invalid frontmatter YAML
  • Special characters in content
  • Corrupted markdown files

Performance​

The export processes ~4,500 files in about 30-60 seconds depending on your system.

Maintenance​

Update Frequency​

Recommended export schedule:

  • Development: Export before major releases
  • Production: Weekly or monthly automated exports
  • On-Demand: When documentation structure changes significantly

Version Control​

Consider versioning your exports:

node scripts/export-docs-for-ai.js docs-export-$(date +%Y%m%d).json

Quick Start​

For a quick start guide with practical examples, see the AI Export Quick Start Guide.

Support​

For questions or issues:

  • Internal: Contact the Documentation Team
  • Repository: Create an issue in the GitLab repository
  • Script Location: scripts/export-docs-for-ai.js

License​

Internal use only - Mambu proprietary documentation.