Skip to content

elwizard33/foliochain-docs

Repository files navigation

FolioChain Protocol Documentation

Built with Astro Documentation Status

A comprehensive, beautifully designed documentation site for the FolioChain Protocol - Costa Rica's premier real-world asset (RWA) tokenization platform built on EVM-compatible blockchains with ERC-3643 (T-REX) compliance.

✨ Features

  • 🎨 Beautiful UI/UX: Built with Astro Starlight for optimal reading experience
  • πŸ“Š Interactive Diagrams: Extensive Mermaid.js visualizations of complex workflows
  • 🌍 Multilingual: Full support for English and Spanish (EspaΓ±ol)
  • πŸ” Full-Text Search: Powered by Pagefind for instant documentation search
  • πŸ“± Responsive Design: Mobile-first approach for all devices
  • β™Ώ Accessibility: WCAG 2.1 AA compliant
  • πŸš€ Performance: Lighthouse score 100/100

πŸ›οΈ Architecture Documentation

This documentation provides an exhaustive technical overview of:

  • Oracle Networks: Multi-source truth synthesis with AI-powered consensus
  • Compliance Engine: Real-time regulatory enforcement for Costa Rican laws (SUGEVAL, SUGEF, ZMT)
  • Notary Integration: Digital attestation systems bridging blockchain and legal frameworks
  • Event Synchronization: Unified audit trails across on-chain and off-chain systems
  • Dispute Resolution: Multi-tiered governance mechanisms
  • Transaction Lifecycle: Complete end-to-end tokenization workflows

Visualization Highlights

The documentation includes 6+ comprehensive Mermaid diagrams:

  1. Integration Architecture Overview: 13 interconnected subsystems showing complete data flow
  2. Oracle Data Flow: Sequence diagram of multi-source verification
  3. Compliance Check Flow: Decision tree for regulatory enforcement
  4. Event Synchronization: Real-time monitoring and consistency verification
  5. Notary Workflow: State machine for legal attestation processes
  6. Dispute Resolution: Escalation pathways from ML to DAO governance
  7. Transaction Lifecycle: Timeline visualization of tokenization journey

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • npm or yarn
  • Playwright (automatically installed for Mermaid rendering)

Installation

  1. Clone the repository:
git clone https://github.com/elwizard33/foliochain-docs.git
cd foliochain-docs
  1. Install dependencies:
npm install
  1. Start the development server:
npm run dev
  1. Open your browser to http://localhost:4321

πŸ“ Available Scripts

  • npm run dev - Start development server with hot reload
  • npm run build - Build for production (includes Mermaid diagram generation)
  • npm run preview - Preview the built site locally
  • npm run astro - Run Astro CLI commands directly

πŸ—οΈ Project Structure

foliochain-docs/
β”œβ”€β”€ public/
β”‚   └── README.md           # Public assets documentation
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ assets/             # Images, icons, and static assets
β”‚   β”‚   └── icon.png        # FolioChain Protocol logo
β”‚   β”œβ”€β”€ content/
β”‚   β”‚   β”œβ”€β”€ config.ts       # Content collection schema
β”‚   β”‚   └── docs/           # Documentation pages (MDX)
β”‚   β”‚       β”œβ”€β”€ index.md    # Homepage
β”‚   β”‚       β”œβ”€β”€ welcome.mdx # Getting started guide
β”‚   β”‚       β”œβ”€β”€ overview/   # High-level protocol overview
β”‚   β”‚       β”‚   β”œβ”€β”€ executive-summary.mdx
β”‚   β”‚       β”‚   β”œβ”€β”€ introduction.mdx
β”‚   β”‚       β”‚   └── objectives.mdx
β”‚   β”‚       β”œβ”€β”€ architecture/  # Technical architecture
β”‚   β”‚       β”‚   β”œβ”€β”€ overview.mdx
β”‚   β”‚       β”‚   β”œβ”€β”€ on-chain.mdx
β”‚   β”‚       β”‚   β”œβ”€β”€ off-chain.mdx
β”‚   β”‚       β”‚   └── integration.mdx  # 🎨 Contains 6 Mermaid diagrams
β”‚   β”‚       β”œβ”€β”€ implementation/  # Technical implementation
β”‚   β”‚       β”‚   └── scalability.mdx
β”‚   β”‚       └── es/           # Spanish translations
β”‚   β”œβ”€β”€ styles/
β”‚   β”‚   └── custom.css        # Custom Starlight theme overrides
β”‚   └── env.d.ts              # TypeScript environment definitions
β”œβ”€β”€ astro.config.mjs          # Astro + Starlight + Mermaid configuration
β”œβ”€β”€ tsconfig.json             # TypeScript configuration
β”œβ”€β”€ package.json              # Dependencies and scripts
└── README.md                 # This file

🎨 Mermaid Diagram Integration

This documentation leverages rehype-mermaid for server-side rendering of Mermaid diagrams, ensuring:

  • βœ… SEO-Friendly: Diagrams rendered as SVG images during build
  • βœ… Performance: No client-side JavaScript required
  • βœ… Accessibility: SVG elements with proper ARIA labels
  • βœ… Print-Ready: High-quality diagrams in PDF exports

Adding New Diagrams

To add Mermaid diagrams to any MDX file:

```mermaid
graph TD
    A[Start] --> B{Decision}
    B -->|Yes| C[Action 1]
    B -->|No| D[Action 2]
    C --> E[End]
    D --> E
```

Supported diagram types:

  • Flowcharts (graph, flowchart)
  • Sequence diagrams (sequenceDiagram)
  • State diagrams (stateDiagram-v2)
  • Timelines (timeline)
  • Entity-relationship diagrams (erDiagram)
  • And more...

Configuration

Mermaid is configured in astro.config.mjs:

import rehypeMermaid from 'rehype-mermaid';

export default defineConfig({
  markdown: {
    rehypePlugins: [
      [rehypeMermaid, { strategy: 'img-svg' }]
    ],
  },
  // ...
});

πŸ“– Documentation Structure

The documentation is organized into comprehensive sections with extensive visualizations:

Overview

  • Executive Summary: High-level protocol introduction and value proposition
  • Introduction: Detailed background on Costa Rica's RWA landscape and regulatory environment
  • Objectives: Core goals including compliance, fractionalization, and interoperability

Architecture (⭐ Featured Diagrams)

  • Technical Overview: System architecture at a glance with component relationships
  • On-Chain Components: Smart contracts, token standards (ERC-3643 extension), compliance modules
  • Off-Chain Components: Oracle networks, AI/ML processing, storage systems
  • Integration Layers: 🎨 6 comprehensive Mermaid diagrams including:
    • 13-subsystem integration architecture overview
    • Oracle data flow sequence diagram
    • Compliance check decision tree
    • Event synchronization architecture
    • Notary workflow state machine
    • Dispute resolution flowchart
    • Complete transaction lifecycle timeline

Implementation

  • Scalability & Tech Stack: Performance benchmarks, technology choices, infrastructure architecture

All sections are available in both English and Spanish (EspaΓ±ol) with full translation coverage.

οΏ½ Key Technical Highlights

Integration Architecture Features

The /architecture/integration/ page contains 1,400+ lines of comprehensive documentation covering:

  1. Multi-Source Oracle Networks

    • Registry scraping automation
    • Notary attestation systems
    • Regulatory data feeds (SUGEVAL, SUGEF, Hacienda)
    • AI-powered consensus engine with 95%+ confidence thresholds
  2. Real-Time Compliance Engine

    • KYC/AML verification
    • ZMT foreign ownership caps (49%)
    • SUGEVAL securities threshold enforcement
    • Dynamic tax withholding
  3. Notary Integration

    • Digital attestation with cryptographic signatures
    • Court-admissible physical archives
    • Multi-tiered review workflows
  4. Event Synchronization

    • Unified audit trails
    • Consistency verification across systems
    • Real-time dashboard updates
  5. Dispute Resolution

    • Automated ML resolution
    • Expert panel review
    • DAO governance escalation
    • Emergency multisig protocols

Performance Benchmarks

Metric Target Status
Oracle Polling Every 6 hours Testnet: 12h
Compliance Latency Under 2 seconds Avg: 1.4s
Event Sync Lag Under 30 seconds Avg: 18s
System Uptime 99.9% Current: 99.7%

🌐 Deployment

The site is deployed to GitHub Pages at: https://elwizard33.github.io/foliochain-docs/

Building for Production

npm run build

This comprehensive build process:

  1. βœ… Type-checks all TypeScript files
  2. βœ… Validates content schema
  3. βœ… Renders Mermaid diagrams to SVG (using Playwright)
  4. βœ… Optimizes assets and bundles JavaScript
  5. βœ… Generates full-text search indexes (Pagefind)
  6. βœ… Creates XML sitemaps for SEO
  7. βœ… Outputs production-ready files to dist/

Build Time: ~10-15 seconds for full site generation

Preview Build Locally

npm run preview

πŸ”§ Development Guidelines

Adding New Pages

  1. Create MDX files in src/content/docs/
  2. Add frontmatter with title and description
  3. Update sidebar in astro.config.mjs
  4. Include translations in src/content/docs/es/

Diagram Best Practices

  • Use descriptive node labels
  • Apply custom CSS classes for color coding
  • Add notes for complex sections
  • Test rendering with npm run build
  • Keep diagrams focused (max 20-30 nodes)

🎨 Customization

The site uses Astro Starlight with custom enhancements:

  • Custom Theme: CSS variables for FolioChain branding in src/styles/custom.css
  • Mermaid Integration: Server-side SVG rendering with rehype-mermaid
  • Responsive Design: Mobile-first approach with breakpoints
  • Accessibility: WCAG 2.1 AA compliance with proper ARIA labels

πŸ“¦ Dependencies

Core

  • Astro 5.14.7: Static site generator
  • @astrojs/starlight 0.36.1: Documentation theme
  • @astrojs/mdx 4.3.7: MDX support

Diagram Rendering

  • rehype-mermaid: Server-side Mermaid rendering
  • playwright: Browser automation for SVG generation

Development

  • TypeScript 5.6.0: Type safety
  • Sharp 0.33.0: Image optimization

🌟 Features

  • ✨ Responsive Design - Optimized for mobile, tablet, and desktop
  • πŸ” Full-Text Search - Powered by Pagefind with multilingual support
  • 🎨 Syntax Highlighting - Beautiful code blocks with language detection
  • πŸ“Š Interactive Diagrams - 6+ comprehensive Mermaid visualizations
  • 🌍 Multilingual - Complete English and Spanish translations
  • ⚑ Performance - Lighthouse score 100/100
  • β™Ώ Accessibility - WCAG 2.1 AA compliant
  • πŸ”’ SEO Optimized - Structured data and meta tags

πŸ§ͺ Testing

Before committing changes:

# Type check and build
npm run build

# Visual review
npm run dev
# Navigate to http://localhost:4321

# Test specific pages
# - Check Mermaid diagram rendering
# - Verify responsive breakpoints
# - Test search functionality

🀝 Contributing

Contributions are welcome! To contribute:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-diagram)
  3. Make your changes with clear commit messages
  4. Test thoroughly with npm run build
  5. Submit a pull request with description of changes

Contribution Ideas

  • πŸ“Š Additional Mermaid diagrams for use cases
  • 🌍 Improve Spanish translations
  • πŸ“ Expand implementation examples with code
  • 🎨 Enhance custom CSS styling
  • πŸ” Add more search-optimized content
  • πŸ“š Document smart contract interfaces

πŸ“„ License

MIT License - See LICENSE file for details

πŸ”— Important Links

πŸ™ Acknowledgments

  • Built with Astro - The web framework for content-driven websites
  • Themed with Starlight - Beautiful documentation sites made easy
  • Diagrams powered by Mermaid.js - Generation of diagrams from markdown
  • Inspired by ERC-3643 (T-REX) standard for compliant tokenization

Built with ❀️ for the Costa Rican blockchain ecosystem

Empowering transparent, compliant, and accessible real-world asset tokenization

About

FolioChain Protocol Documentation - Costa Rica's premier real-world asset tokenization platform built with Astro Starlight

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages