Skip to main content

Markdown CMS as a Python package - embed in FastAPI/Starlette applications

Project description

MD Studio

A standalone Python package that provides a modern Markdown CMS for FastAPI and Starlette applications.

Features

  • 📝 Markdown-first: Write content in Markdown with frontmatter support
  • 🎨 Modern UI: React-based interface with dark mode
  • 🚀 Easy Integration: Mount as an ASGI app in any FastAPI/Starlette app
  • 📁 Flexible Storage: Filesystem storage for content and uploads
  • 🔒 Public Sharing: Share documents publicly with unique URLs
  • 📤 Import/Export: Bulk operations with ZIP archives
  • 🖼️ File Uploads: Built-in file upload and attachment handling
  • 🔍 Search & Filter: Full-text search with sorting and filtering

Installation

pip install md-studio

Quick Start

FastAPI

from fastapi import FastAPI
from md_studio import MDStudio

app = FastAPI()

app.mount(
    "/md-studio",
    MDStudio(
        title="My Documentation",
        scan_dirs=["./docs", "./markdowns", "./"],
        write_dir="./docs",
    )
)

Provide at least one of scan_dirs or write_dir (or set MD_STUDIO_SCAN_DIRS/MD_STUDIO_WRITE_DIR) so the content store can be located. scan_dirs controls where existing content is scanned (list or comma-separated string). write_dir selects where new/imported documents are saved. uploads_path defaults to <write_dir>/uploads (or <scan_dirs[0]>/uploads if write_dir is unset). metadata_path controls where the index metadata is stored (default: <uploads_path>/.md-studio-metadata.json).

Starlette

from starlette.applications import Starlette
from starlette.routing import Mount
from md_studio import MDStudio

app = Starlette(
    routes=[
        Mount(
            "/md-studio",
            MDStudio(
                title="My Markdown Docs",
                scan_dirs=["./docs", "./markdowns", "./"],
                write_dir="./docs",
            )
        )
    ]
)

Run the server

uvicorn main:app --reload

Then visit http://localhost:8000/md-studio

Frontend build (SPA)

The UI is a Remix SPA that is built with Node.js and then served by the Python package. No Node runtime is needed in production, but Node is required to build the static assets.

cd ui
npm install
npm run build

The build output in ui/build/client should be copied to md_studio/static. You can use the helper script:

bash ./build_and_run.sh

Note: Some dependencies require Node 20.19+, 22.12+, or 24+ to avoid EBADENGINE warnings.

Configuration

MDStudio(
    scan_dirs=["./docs", "./markdowns", "./"],            # Where existing markdown files are scanned
    write_dir="./docs",              # Where new/imported markdown files are written
    uploads_path="./docs/uploads",   # Optional override (defaults to write_dir/uploads)
    metadata_path="./docs/uploads/.md-studio-metadata.json",  # Optional override
    title="MD Studio",
)

Environment Variables

  • MD_STUDIO_SCAN_DIRS: Comma-separated scan roots (alternative to scan_dirs)
  • MD_STUDIO_CONTENT_DIRS: Legacy alias for MD_STUDIO_SCAN_DIRS
  • MD_STUDIO_WRITE_DIR: Write root for new/imported documents
  • MD_STUDIO_API_PATH: API prefix injected into the frontend (default: /md/api)

For deployment to production environments, see DEPLOYMENT.md.

License

MIT License - see LICENSE file for details

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

md_studio-1.0.3.tar.gz (592.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

md_studio-1.0.3-py3-none-any.whl (602.7 kB view details)

Uploaded Python 3

File details

Details for the file md_studio-1.0.3.tar.gz.

File metadata

  • Download URL: md_studio-1.0.3.tar.gz
  • Upload date:
  • Size: 592.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for md_studio-1.0.3.tar.gz
Algorithm Hash digest
SHA256 2d2dd657f166d14da38fa2bcd33b665fefff145bf01967f410bb391ec3b17171
MD5 f48839014970450282bb7d5161e5e7f8
BLAKE2b-256 8c47aadbe44f19c3032ac571209de20927ef5311c63b584583f673b5696c9151

See more details on using hashes here.

File details

Details for the file md_studio-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: md_studio-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 602.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for md_studio-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c4d407b30f4cc35b86b86fb164f47793deb7b414ab8ffe4932be3a39fd15e739
MD5 d17d63f457220d8dd8983bd86ab5d948
BLAKE2b-256 58e553d8ecbaaf994ca262e79f204e3b60da184b7baed5c0bda6d4ff8d126a56

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page