MDDB - High-Performance Markdown Database

Performance Go Version License

The fastest markdown database with gRPC and HTTP/3 support

AI-native embedded knowledge base with a built-in MCP server (116 tools), hybrid BM25+vector search and RAG. Single ~36 MB Go binary, zero config. In production behind daemonports.org (about 120,000 pages).

Markdown documents with rich metadata, full revision history, and dual protocol support (HTTP/JSON + gRPC/Protobuf). The MCP server is in the image: docker run -i --rm --network host -v mddb-data:/app/data -e MDDB_MCP_STDIO=true tradik/mddb:latest is the whole client configuration, and the image is listed in the MCP Registry as com.tradik/mddb.

๐Ÿš€ Performance #

  • 29,810 docs/sec throughput (37.4x baseline)
  • 34ยตs average latency
  • 5.75x faster than MongoDB
  • 6.89x faster than PostgreSQL
  • 24.54x faster than MySQL
  • 95.43x faster than CouchDB

โšก Key Features #

  • Dual Protocol Support: HTTP/JSON REST API + gRPC/Protobuf
  • HTTP/3 Support: QUIC protocol for extreme performance
  • Full Revision History: Track all document changes with MVCC
  • Rich Metadata: Store and query structured metadata
  • Batch Operations: High-throughput batch insert/update/delete
  • Compression: Snappy and Zstd compression support
  • Lock-Free Cache: Sharded cache with zero contention
  • Adaptive Indexing: Smart metadata indexing
  • Built-in Backup: Hot backup and restore functionality
  • Embedded Database: BoltDB for zero-dependency deployment

๐Ÿณ Quick Start #

Production Server #

docker run -d \
  --name mddb \
  -p 11023:11023 \
  -p 11024:11024 \
  -v mddb-data:/data \
  -e MDDB_PATH=/data/mddb.db \
  -e MDDB_MODE=wr \
  -e MDDB_EXTREME=true \
  tradik/mddb:latest

Docker Compose #

version: '3.8'

services:
  mddb:
    image: tradik/mddb:latest
    container_name: mddb-server
    ports:
      - "11023:11023"  # HTTP
      - "11024:11024"  # gRPC
      - "11443:11443"  # HTTP/3 (extreme mode)
    volumes:
      - mddb-data:/data
    environment:
      - MDDB_PATH=/data/mddb.db
      - MDDB_MODE=wr
      - MDDB_EXTREME=true
      - MDDB_HTTP_PORT=11023
      - MDDB_GRPC_PORT=11024
      - MDDB_HTTP3_PORT=11443
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:11023/stats"]
      interval: 30s
      timeout: 10s
      retries: 3

volumes:
  mddb-data:

๐Ÿ”ง Configuration #

Environment Variables #

Variable Default Description
MDDB_PATH /data/mddb.db Database file path
MDDB_MODE wr Mode: ro (read-only) or wr (read-write)
MDDB_EXTREME false Enable extreme performance mode
MDDB_HTTP_PORT 11023 HTTP server port
MDDB_GRPC_PORT 11024 gRPC server port
MDDB_HTTP3_PORT 11443 HTTP/3 server port (extreme mode)

Extreme Performance Mode #

Enable with MDDB_EXTREME=true to activate:

  • HTTP/3 server with QUIC protocol
  • All 29 performance optimizations
  • Lock-free cache with sharding
  • Adaptive indexing
  • Compression (Snappy + Zstd)
  • Optimized batch processing
  • String allocation elimination
  • Zero-copy operations

๐Ÿ“Š Available Tags #

Production Images #

  • latest - Latest stable release
  • 2.19.13, 2.19, 2 - Specific version tags

Platform Support #

All images support:

  • linux/amd64 (Intel/AMD x86_64)
  • linux/arm64 (ARM/Apple Silicon aarch64)

๐Ÿ”Œ API Examples #

HTTP REST API #

# Add a document
curl -X POST http://localhost:11023/add \
  -H "Content-Type: application/json" \
  -d '{
    "collection": "docs",
    "key": "welcome",
    "lang": "en",
    "meta": {
      "title": {"values": ["Welcome"]},
      "author": {"values": ["MDDB Team"]}
    },
    "content_md": "# Welcome to MDDB\n\nHigh-performance markdown database."
  }'

# Get a document
curl http://localhost:11023/get/docs/welcome/en

# Search documents
curl -X POST http://localhost:11023/search \
  -H "Content-Type: application/json" \
  -d '{
    "collection": "docs",
    "filter_meta": {
      "author": {"values": ["MDDB Team"]}
    },
    "limit": 10
  }'

# Batch insert (high performance)
curl -X POST http://localhost:11023/batch \
  -H "Content-Type: application/json" \
  -d '{
    "collection": "docs",
    "documents": [
      {
        "key": "doc1",
        "lang": "en",
        "meta": {"title": {"values": ["Document 1"]}},
        "content_md": "# Document 1"
      },
      {
        "key": "doc2",
        "lang": "en",
        "meta": {"title": {"values": ["Document 2"]}},
        "content_md": "# Document 2"
      }
    ]
  }'

# Get statistics
curl http://localhost:11023/stats

gRPC API #

import (
    "google.golang.org/grpc"
    "mddb/proto"
)

conn, _ := grpc.Dial("localhost:11024", grpc.WithInsecure())
client := proto.NewMDDBClient(conn)

// Add document
doc, _ := client.Add(ctx, &proto.AddRequest{
    Collection: "docs",
    Key:        "welcome",
    Lang:       "en",
    Meta: map[string]*proto.MetaValues{
        "title": {Values: []string{"Welcome"}},
    },
    ContentMd: "# Welcome to MDDB",
})

// Batch insert (high performance)
resp, _ := client.AddBatch(ctx, &proto.AddBatchRequest{
    Collection: "docs",
    Documents: []*proto.BatchDocument{
        {
            Key:  "doc1",
            Lang: "en",
            Meta: map[string]*proto.MetaValues{
                "title": {Values: []string{"Document 1"}},
            },
            ContentMd: "# Document 1",
        },
        // ... more documents
    },
})

๐Ÿ—๏ธ Architecture #

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                 Performance Layer                    โ”‚
โ”‚  โ€ข HTTP/3 Server (QUIC)                             โ”‚
โ”‚  โ€ข Lock-Free Cache (Sharded)                        โ”‚
โ”‚  โ€ข Batch Processor (Parallel + Single TX)           โ”‚
โ”‚  โ€ข String Optimization (Zero-Copy)                  โ”‚
โ”‚  โ€ข Compression (Snappy + Zstd)                      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                         โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                  Protocol Layer                      โ”‚
โ”‚  โ€ข HTTP/JSON REST API                               โ”‚
โ”‚  โ€ข gRPC/Protobuf API                                โ”‚
โ”‚  โ€ข HTTP/3 (Extreme Mode)                            โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                         โ†“
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                   Storage Layer                      โ”‚
โ”‚  โ€ข BoltDB (Embedded)                                โ”‚
โ”‚  โ€ข MVCC (Multi-Version Concurrency Control)         โ”‚
โ”‚  โ€ข Adaptive Indexing                                โ”‚
โ”‚  โ€ข Revision History                                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“ˆ Benchmarks #

Tested with 3,000 documents on identical hardware:

Database Throughput Avg Latency vs MDDB
MDDB (Batch) 25,863 docs/s 39ยตs 1.00x
MongoDB 5,452 docs/s 182ยตs 4.74x slower
PostgreSQL 3,360 docs/s 297ยตs 7.69x slower
MySQL 1,183 docs/s 845ยตs 21.86x slower
CouchDB 310 docs/s 3,201ยตs 83.39x slower

๐Ÿ” Security #

  • No authentication by default (add reverse proxy for production)
  • Runs as non-root user in container
  • Read-only mode available (MDDB_MODE=ro)
  • Volume permissions: 750 (owner: mddbd)

๐Ÿ“ฆ Volume Management #

# Create named volume
docker volume create mddb-data

# Backup database (stop the server first: a copy of an open file is not a backup;
# the image's entrypoint is mddbd, so cp needs --entrypoint)
docker run --rm --entrypoint cp \
  -v mddb-data:/data \
  -v $(pwd)/backups:/backups \
  tradik/mddb:latest \
  /data/mddb.db /backups/mddb-backup-$(date +%Y%m%d).db

# Restore database
docker run --rm --entrypoint cp \
  -v mddb-data:/data \
  -v $(pwd)/backups:/backups \
  tradik/mddb:latest \
  /backups/mddb-backup-20250107.db /data/mddb.db

๐Ÿ› ๏ธ Troubleshooting #

Check logs #

docker logs mddb

Check health #

curl http://localhost:11023/stats

Performance issues #

  • Enable extreme mode: MDDB_EXTREME=true
  • Use batch operations for bulk inserts
  • Use gRPC for better performance than HTTP
  • Increase Docker resources (CPU/Memory)

Database locked #

  • Ensure only one instance is running
  • Check file permissions on volume
  • Use read-only mode for multiple readers

๐Ÿ“š Documentation #

  • GitHub: https://github.com/tradik/mddb
  • API Documentation: https://mddb.tradik.com/docs/api/
  • Examples: https://mddb.tradik.com/docs/examples/
  • Changelog: https://github.com/tradik/mddb/blob/main/CHANGELOG.md

๐Ÿค Support #

  • Issues: https://github.com/tradik/mddb/issues
  • Discussions: https://github.com/tradik/mddb/discussions
  • Email: team@mddb.io

๐Ÿ“„ License #

Business Source License 1.1 for the server image (free to run inside your organisation; offering MDDB to third parties as a product needs a commercial licence; Apache-2.0 four years after each release). Client libraries are BSD-3-Clause. See LICENSING.

๐ŸŒŸ Why MDDB? #

  • Performance First: 29 optimizations for maximum throughput
  • Developer Friendly: Simple API, easy deployment
  • Production Ready: Battle-tested, stable, reliable
  • Zero Dependencies: Embedded database, no external services
  • Modern Protocols: HTTP/3, gRPC, Protobuf
  • Rich Features: Metadata, revisions, search, backup
  • Source Available: the whole codebase is on GitHub; BUSL-1.1 server, BSD-3-Clause clients

Made with โค๏ธ by the MDDB Team

Star us on GitHub if you find MDDB useful!