跪拜 Guibai
← All articles
Frontend · Backend · Architecture

MiniDocs: A Self-Hosted Knowledge Base That Makes Sharing a First-Class Feature

By Cosolar ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

MiniDocs removes the operational headache of either forcing recipients through a login or rebuilding a static site for every edit, giving small teams a self-hosted option where external sharing is granular, revocable, and passworded. It won't replace a full office suite or a large-scale search stack, but for Markdown-heavy teams that need clean outward sharing, it fills a real gap without adding a database or middleware.

Summary

MiniDocs enters a crowded field with an opinionated answer to a common pain: sharing docs with someone outside your team usually means either forcing them through a registration wall (Notion, Feishu) or maintaining a static site that needs a full rebuild for every typo fix. The project splits the difference. Each share is an independent object with its own scope, password, expiry, and revocable link; view counts are deduplicated by session and day. Permissions stay at four axes, all enforced through a single AccessService, so there is exactly one place where access decisions happen.

The backend is Spring Boot 3 with SQLite by default, deployable as a single container with one port and one volume. Full-text search runs on an in-memory inverted index capped at around 2,000 documents, a deliberate trade-off to avoid running Elasticsearch for a small team. The portal and share pages share one rendering pipeline, so what you see is what gets sent. Edit locks renew every 60 seconds and optimistic concurrency returns HTTP 412 on conflicts. MiniDocs is at v1.2.11, Apache-2.0, and open-sourced at the end of September by a single author who asks for early feedback while the project is still green.

Takeaways
— Each share can be scoped to a whole library or a single document, with optional password protection and a 12-hour grace period after entry.
— Shares support configurable expiry and can be revoked at any time; custom short links are 6-32 characters, globally unique, and replacing one kills the old link immediately.
— Access counts by session: the same visitor within 30 minutes counts once, and unique visitors are deduplicated per day.
— The permission model uses four axes: library visibility (public/org/private), maintenance scope (owner_only/members/org_all), member role (OWNER/EDITOR/VIEWER), and sharing, all checked through a single AccessService.
— Deployment is one container, one port, one data volume, using built-in SQLite; MySQL is available by switching the Spring profile to prod and adding three connection parameters.
— Full-text search uses an in-memory inverted index with a limit of about 2,000 documents, avoiding an external search middleware.
— The reading and share pages use the same rendering pipeline with a cache key of kbId+path+mtime+size, ensuring consistent output.
— Edit lock renews every 60 seconds and times out; optimistic concurrency returns HTTP 412 on conflicts to prevent silent overwrites.
— The demo site hosts 6 knowledge bases and 243 real documents, and the current version is v1.2.11 under Apache-2.0.
Conclusions

The share-as-object model treats links as disposable artifacts with a lifespan, which matches how teams actually hand out documents to clients or reviewers, and that's a step beyond the public/private dichotomy in most knowledge bases.

Capping full-text search at roughly 2,000 documents is a sensible trade-off for a single-container deployment, but it means the tool will outgrow itself for archives that scale past a small team's notes.

The four-axis permission model is a deliberate reaction to enterprise RBAC systems that are so complex they get ignored entirely; reducing the switch count makes misconfiguration less likely, but also leaves no room for unusual access patterns.

Source: juejin.cn ↗ Google Translate ↗ Backup ↗