--- title: CoreDoc Integration Report version: 1.0.0 date: 2026-10-25 author: Momentry Core Team status: Active --- # CoreDoc Integration Report ## Overview This report documents the integration of CoreDoc into Markbase, including the dual documentation system architecture and all necessary configuration. --- ## Integration Summary ### What Was Done | Task | Status | Location | |------|--------|----------| | **Documentation Created** | ✅ Complete | `markbase/docs/core-doc/` | | **Route Module Created** | ✅ Complete | `markbase-core/src/api/docs.rs` | | **Static Files Configured** | ✅ Complete | `markbase/static/docs/` | | **Symbolic Links Created** | ✅ Complete | Link to `momentry_core/docs_v1.0/` | | **Module Declaration Added** | ✅ Complete | `markbase-core/src/api/mod.rs` | | **Server Routes Integration** | ⚠️ Pending | Requires manual addition to `server.rs` | --- ## File Structure ### Documentation Files ``` markbase/docs/core-doc/ ├── README.md # Overview and quick start ├── DIRECTORY_STRUCTURE.md # Complete directory mapping ├── ARCHITECTURE.md # System design and data flow ├── MAINTENANCE_GUIDE.md # Daily maintenance procedures ├── INTEGRATION_GUIDE.md # Integration details └── API_REFERENCE.md # All API endpoints ``` ### Code Files ``` markbase/markbase-core/src/ ├── api/ │ ├── mod.rs # Added: pub mod docs; │ └── docs.rs # New: Route definitions └── server.rs # Needs: .nest("/docs", docs_routes()) ``` ### Static Files ``` markbase/static/docs/ ├── legacy -> /Users/accusys/momentry_core/docs_v1.0/doc_wasm/ ├── api -> /Users/accusys/momentry_core/docs_v1.0/API_WORKSPACE/ └── cli -> /Users/accusys/momentry_core/docs_v1.0/CLI_WORKSPACE/ ``` --- ## Dual Documentation System ### System 1: Legacy WASM (Deprecated but Available) **Status**: ⚠️ Deprecated but accessible **Purpose**: Backward compatibility **Location**: `momentry_core/docs_v1.0/doc_wasm/` **Modules**: 68 Markdown files **Rendering**: Client-side WASM (291KB) **Access**: `http://localhost:11438/docs/legacy/` **Features**: - WASM Markdown rendering - HTTP Basic Auth - Client-side navigation - 68 documentation modules --- ### System 2: New Modular Documentation (Active) **Status**: ✅ Active and recommended **Purpose**: Primary documentation **Location**: `momentry_core/docs_v1.0/{API_WORKSPACE,CLI_WORKSPACE}/` #### API Documentation - **Access**: `http://localhost:11438/docs/api/` - **Format**: Modular Markdown - **Organization**: By API endpoint #### CLI Documentation - **Access**: `http://localhost:11438/docs/cli/` - **Format**: Modular Markdown - **Organization**: By CLI command **Advantages**: - Modern structure - No WASM compilation needed - Easy to maintain - Version control friendly --- ## Integration Steps (Remaining) ### Step 1: Add Route to server.rs **File**: `markbase-core/src/server.rs` **Add the following**: ```rust use crate::api::docs::docs_routes; // In the Router::new() block, add: .nest("/docs", docs_routes()) ``` **Recommended Position**: After authentication routes, before other services. **Example**: ```rust Router::new() // Auth routes .route("/api/v2/auth/login", post(login_handler)) .route("/api/v2/auth/verify", get(verify_handler)) // Documentation routes (NEW) .nest("/docs", docs_routes()) // Other routes .route("/api/v2/products", get(list_all_products)) // ... ``` --- ### Step 2: Rebuild Markbase ```bash cd /Users/accusys/markbase cargo build --release ``` --- ### Step 3: Restart Markbase Server ```bash # Stop current server lsof -ti :11438 | xargs kill -9 # Start with new routes ./target/release/markbase-core interface web --port 11438 ``` --- ### Step 4: Verify Integration ```bash # Test legacy system curl -u admin:admin123 http://localhost:11438/docs/legacy/ # Test API docs curl -u admin:admin123 http://localhost:11438/docs/api/ # Test CLI docs curl -u admin:admin123 http://localhost:11438/docs/cli/ # Test authentication curl http://localhost:11438/docs/ # Should return 401 ``` --- ## Architecture Diagram ``` ┌─────────────────────────────────────────────────────────┐ │ Markbase Server (Port 11438) │ ├─────────────────────────────────────────────────────────┤ │ │ │ ┌────────────────────────────────────────────────┐ │ │ │ Router │ │ │ ├────────────────────────────────────────────────┤ │ │ │ /api/v2/* → Markbase APIs │ │ │ │ /docs/legacy/* → Legacy WASM Docs ⚠️ │ │ │ │ /docs/api/* → API Docs ✅ │ │ │ │ /docs/cli/* → CLI Docs ✅ │ │ │ └────────────────────────────────────────────────┘ │ │ │ │ ┌────────────────────────────────────────────────┐ │ │ │ Auth Middleware (HTTP Basic Auth) │ │ │ └────────────────────────────────────────────────┘ │ │ │ └─────────────────────────────────────────────────────────┘ │ │ Symbolic Links ▼ ┌─────────────────────────────────────────────────────────┐ │ ~/momentry_core/docs_v1.0/ │ ├─────────────────────────────────────────────────────────┤ │ doc_wasm/ (Legacy WASM System) │ │ ├── index.html │ │ ├── modules/ (68 files) │ │ └── pkg/ (WASM binaries) │ │ │ │ API_WORKSPACE/ (New API Docs) │ │ └── modules/ │ │ │ │ CLI_WORKSPACE/ (New CLI Docs) │ │ └── modules/ │ └─────────────────────────────────────────────────────────┘ ``` --- ## Maintenance Responsibilities ### Markbase Team Responsibilities | Task | Frequency | Documentation Reference | |------|-----------|------------------------| | **Health Monitoring** | Daily | `MAINTENANCE_GUIDE.md` | | **Security Updates** | Monthly | `MAINTENANCE_GUIDE.md` | | **Documentation Updates** | As needed | `MAINTENANCE_GUIDE.md` | | **WASM Rebuilds** | Rare | `MAINTENANCE_GUIDE.md` | | **Performance Monitoring** | Weekly | `MAINTENANCE_GUIDE.md` | | **Backup** | Daily | `MAINTENANCE_GUIDE.md` | ### Documentation Ownership - **CoreDoc Documentation**: Markbase team maintains - **Source Documentation**: Momentry Core team maintains - **WASM Code**: Momentry Core team maintains --- ## Performance Expectations ### Expected Load Times | Endpoint | Expected Time | Notes | |----------|---------------|-------| | `/docs/legacy/` | ~200ms | First WASM load | | `/docs/legacy/` (cached) | ~10ms | Cached WASM | | `/docs/legacy/modules/*` | < 50ms | Static files | | `/docs/api/*` | < 50ms | Static files | | `/docs/cli/*` | < 50ms | Static files | ### Resource Usage | Resource | Usage | |----------|-------| | Server Memory | +10MB (static files) | | Client Memory | +10MB (WASM) | | Disk Space | ~5MB (WASM + docs) | | CPU | Negligible (static files) | --- ## Security Configuration ### Authentication - **Method**: HTTP Basic Auth - **Database**: Shared with Markbase (`data/auth.sqlite`) - **Users**: Managed via `/api/v2/admin/users` ### Access Control - All `/docs/*` routes require authentication - Same credentials as Markbase admin - No separate user management needed --- ## Troubleshooting Guide ### Issue: Routes Not Working **Check**: 1. Route added to `server.rs` 2. Server restarted after changes 3. `docs_routes()` function imported **Solution**: Follow integration steps above --- ### Issue: Files Not Found **Check**: 1. Symbolic links exist: `ls -la static/docs/` 2. Target directories exist: `ls -la ~/momentry_core/docs_v1.0/` 3. File permissions correct **Solution**: ```bash # Recreate symbolic links cd /Users/accusys/markbase/static/docs ln -sfn /Users/accusys/momentry_core/docs_v1.0/doc_wasm legacy ln -sfn /Users/accusys/momentry_core/docs_v1.0/API_WORKSPACE api ln -sfn /Users/accusys/momentry_core/docs_v1.0/CLI_WORKSPACE cli ``` --- ### Issue: Authentication Failing **Check**: 1. User exists in database 2. Password correct 3. Auth middleware configured **Solution**: ```bash # Test authentication curl -v -u admin:admin123 http://localhost:11438/docs/legacy/ ``` --- ## Migration Path ### From Port 8000 to Markbase 1. ✅ Routes configured in Markbase 2. ✅ Static files moved 3. ⚠️ Update client applications 4. ⚠️ Close port 8000 **Client Update Required**: - Old: `http://localhost:8000/modules/001_Auth.md` - New: `http://localhost:11438/docs/legacy/modules/001_Auth.md` --- ## Future Enhancements ### Recommended 1. **Search Integration**: Add full-text search 2. **Versioning**: Support multiple API versions 3. **Interactive Examples**: Add try-it-out features 4. **Metrics**: Track documentation usage 5. **CDN**: Use CDN for static files --- ## Support and Contacts - **Documentation Issues**: Refer to `docs/core-doc/MAINTENANCE_GUIDE.md` - **Technical Issues**: Contact Momentry Core team - **Feature Requests**: Submit via issue tracker --- ## Version History | Version | Date | Changes | |---------|------|---------| | 1.0.0 | 2026-10-25 | Initial integration report |