Skip to content

Repository files navigation

Documentation Tool

A web-based documentation viewer and editor for Markdown-based manuals stored as git repositories.

Architecture

┌─────────────────────────────────────────────────────┐
│ Docker Container │
│ │
│ ┌──────────────┐ ┌──────────────────────┐ │
│ │ Vite Dev │ proxy │ Express Server │ │
│ │ (port 5173) │ ──────> │ (port 3000) │ │
│ │ Vue 3 SPA │ /api │ │ │
│ └──────────────┘ │ ├─ File API │ │
│ │ ├─ Search API │ │
│ │ ├─ Editor API │ │
│ │ ├─ Git Service │ │
│ │ └─ Write Queue │ │
│ └──────────┬───────────┘ │
│ │ │
│ ┌──────────▼───────────┐ │
│ │ /docs/ │ │
│ │ └─ marva-manual/ │ │
│ │ (git repo) │ │
│ └──────────────────────┘ │
└─────────────────────────────────────────────────────┘

Frontend: Vite + Vue 3 (Options API) Backend: Node.js + Express Git: simple-git for programmatic git operations Infrastructure: Docker Compose with volume mounts for live development

Quick Start

With Docker (recommended)

# Clone and configure
cp .env.example .env
# Edit .env with your GitHub credentials and editor password# Start
docker compose up
# Access:# Viewer: http://localhost:5173# Editor: http://localhost:5173/edit/documentation-marva-manual/index.md

Local Development

# Install dependenciescd server && npm install
cd ../client && npm install
# Configure
cp .env.example .env
# Start server (in one terminal)cd server && npm run dev
# Start client (in another terminal)cd client && npm run dev
# Access at http://localhost:5173

Configuration (.env)

VariableDescriptionDefault
EDITOR_PASSWORDShared password for editor accesschangeme
GIT_USERGitHub username for push authentication
GIT_TOKENGitHub personal access token
NODE_ENVdevelopment or productiondevelopment
PORTServer port3000

Features

Viewer (/view/:repoName/:filePath)

  • Two-column layout: navigation sidebar + rendered markdown
  • Cross-file search (Ctrl-F / Cmd-F) that searches all markdown files
  • Images rendered with macOS-style subtle drop shadows
  • Relative links between documents work seamlessly

Editor (/edit/:repoName/:filePath)

  • Protected by HTTP basic auth (any username, shared password)
  • Three-column layout: file tree | markdown editor | live preview
  • Markdown toolbar (headings, bold, italic, links, lists, code, etc.)
  • Drag files from tree to editor to auto-insert relative links
  • Drag-and-drop images into editor (saves to /images/, inserts link)
  • Clipboard paste images (converts to PNG, saves, inserts link)
  • Save with commit message (each save = git commit under your name)
  • Write queue serializes concurrent saves to prevent conflicts

API Reference

Public Endpoints

MethodPathDescription
GET/api/reposList available documentation repos
GET/api/repos/:repo/treeGet file tree
GET/api/repos/:repo/file/*pathRead a markdown file
GET/api/repos/:repo/images/*pathServe an image
GET/api/repos/:repo/search?q=termSearch across all files
GET/api/repos/:repo/navGet navigation structure

Protected Endpoints (require basic auth)

MethodPathDescription
POST/api/repos/:repo/file/*pathSave file + git commit
DELETE/api/repos/:repo/file/*pathDelete file
POST/api/repos/:repo/images/uploadUpload image (multipart)
POST/api/repos/:repo/images/pasteSave clipboard image (base64)
GET/api/repos/:repo/git/statusGit status
GET/api/repos/:repo/git/logRecent commits
POST/api/repos/:repo/git/pullPull from remote

Adding New Documentation Repos

Documentation repos are cloned into the docs/ directory. To add a new repo:

  1. Clone it into docs/: git clone <url> docs/<repo-name>
  2. Access it at /view/<repo-name>/index.md

The first repo (documentation-marva-manual) is auto-cloned on startup if missing.

Testing

# Run all tests
npm test# Server tests only
npm run test:server
# Client tests only
npm run test:client

Project Structure

documentation-tool/
├── docker-compose.yml # Docker orchestration
├── Dockerfile # Container build
├── .env.example # Environment template
├── server/ # Express backend
│ └── src/
│ ├── index.js # Entry point
│ ├── config.js # Environment config
│ ├── middleware/auth.js
│ ├── routes/ # API routes
│ └── services/ # Business logic
│ ├── git.js # Git operations
│ ├── writeQueue.js # Concurrent write serialization
│ ├── search.js # Full-text search index
│ ├── fileTree.js # File tree builder
│ └── imageHandler.js
├── client/ # Vue 3 frontend
│ └── src/
│ ├── views/ # ViewerLayout, EditorLayout
│ ├── components/ # UI components
│ ├── composables/ # useMarkdown (link/image rewriting)
│ └── utils/ # Path resolution utilities
└── docs/ # Documentation repos (git-ignored)

License

CC0 1.0 Universal

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages