HUB
Sign inSign up
sleepy-docs logo

sleepyboy/sleepy-docs

By sleepyboy

โ€ขUpdated about 3 hours ago

Drop docs in a folder, read them anywhere: a Catppuccin web app plus an OPDS catalog for Kobo.

Image
0

88

sleepyboy/sleepy-docs repository overview

SleepyDocs logo

โ SleepyDocs

โ Drop it in a folder. Read it anywhere.

A self-hosted documentation library for the homelab. Put Markdown, EPUB, PDF, text and HTML in one folder, in any structure you like, and read them in a beautiful web app or on every Kobo in the house.

License: AGPL-3.0-only Docker pulls Image size Docker build Python 3.11+ OPDS 1.2 Kobo + KOReader Catppuccin Mocha

Quick startโ  ยท Featuresโ  ยท Kobo setupโ  ยท Configurationโ  ยท Docsโ 


SleepyDocs rendering a Markdown runbook with a table, an admonition and highlighted code

โ ๐ŸŒ™ Why

Documentation ends up everywhere: runbooks in Markdown, appliance manuals as PDFs, saved web pages, a few EPUBs, notes in .txt. SleepyDocs gives all of it one home and one interface, without a database, an import step or an account. The folder is the library: copy a file in and it's there seconds later, in the browser and on your e-readers.

โ โœจ Features

๐Ÿช„Magic folder. Add, edit, move or delete files and every screen updates within seconds. No import, no rescan button.
๐ŸŽจBeautiful web app. Catppuccin Mocha, a file tree, instant search, keyboard navigation, and the file name with its extension always in view.
๐Ÿ“„Every format, rendered natively. Highlighted Markdown, sandboxed HTML, the browser's own PDF viewer, readable EPUBs and plain text.
๐Ÿ“šBuilt for Kobo. An OPDS catalog that mirrors your folders, with search, for KOReader. A no-JavaScript page covers the stock browser.
๐Ÿ”Everything becomes EPUB. Markdown, HTML, text and PDF convert to clean, e-ink-friendly EPUBs with chapters, a table of contents and images.
โšกPre-converted and cached. Conversion runs in the background, so downloads on the Kobo are instant. The cache is disposable.
๐Ÿ”’Read-only and offline. Your folder is mounted read-only, and nothing is loaded from the internet: no CDN, no telemetry, no account.
๐ŸณOne container. A single small Python service. No database, no front-end build, nothing else to run.

โ ๐Ÿ“ธ Screenshots

Welcome screen with document counts and recent changesAn EPUB rendered in the web app
Home: what's in the library and what changedEPUB: books read right in the browser
A saved HTML manual rendered with its own stylesA plain-text file
HTML: saved pages keep their own look, safely sandboxedText: spacing and line breaks preserved

The Kobo page showing search results
Kobo: big tap targets, high contrast and short pages, built for e-ink

โ ๐Ÿ“„ Supported formats

FormatExtensionsIn the browserOn the Kobo
Markdown.md .markdownRendered, with syntax highlighting and tablesEPUB, split into chapters at headings
HTML.html .htmIts own styles and scripts, in a sandboxEPUB, cleaned for e-ink
PDF.pdfThe browser's built-in PDF viewerEPUB (text) or the original PDF
EPUB.epubRendered as one scrolling pageThe original EPUB
Text.txtMonospace, line breaks preservedEPUB

Conversions are done by sleepyconvertโ , a small format-conversion CLI and library from the same author.

โ ๐Ÿš€ Quick start

โ Docker
docker run -d --name sleepydocs \
  -p 8734:8734 \
  -v /path/to/your/docs:/library:ro \
  -v sleepydocs-cache:/cache \
  --restart unless-stopped \
  sleepyboy/sleepy-docs:latest
โ Docker Compose
services:
  sleepydocs:
    image: sleepyboy/sleepy-docs:latest
    container_name: sleepydocs
    restart: unless-stopped
    ports:
      - "8734:8734"
    volumes:
      - /path/to/your/docs:/library:ro # the magic folder
      - sleepydocs-cache:/cache        # converted EPUBs; safe to delete

volumes:
  sleepydocs-cache:
โ From source
git clone https://github.com/anthonybench/sleepy-docs.git && cd sleepy-docs
mkdir library                  # put your documents here
docker compose up -d --build
โ Then open
WhereAddress
๐Ÿ–ฅ๏ธ Any browserhttp://<server>:8734
๐Ÿ“– Kobo with KOReaderhttp://<server>:8734/opds
๐Ÿ“ฑ Kobo stock browserhttp://<server>:8734/kobo

โ ๐Ÿ“– On your Kobo

SleepyDocs recommends KOReaderโ . It runs alongside the stock Kobo software, so nothing is erased and you can switch back at any time. It also has a built-in OPDS client and excellent PDF support.

  1. Why KOReader?โ  The options compared.
  2. Install KOReaderโ  takes about ten minutes per device, with a one-click installer or by hand.
  3. Add the catalogโ : in KOReader, go to Search โ†’ OPDS catalog โ†’ + and enter http://<server>:8734/opds.

Then browse your folders, search, and tap to download. PDFs offer both an EPUB and the original.

No KOReader? Open http://<server>:8734/kobo in the stock Kobo browserโ  and tap a document to download it straight into My Books.

โ โš™๏ธ Configuration

Everything is an environment variable, and every one has a sensible default.

VariableDefaultWhat it does
SLEEPYDOCS_TITLESleepyDocsName shown in the web app, the catalog and on the Kobo
SLEEPYDOCS_PREWARMtrueConvert everything to EPUB in the background for instant downloads
SLEEPYDOCS_FORCE_POLLINGfalsePoll for changes. Turn on when the server mounts the folder over NFS/SMB
SLEEPYDOCS_RESCAN_SECONDS300Interval of the safety-net full rescan
SLEEPYDOCS_PORT8734Port inside the container
SLEEPYDOCS_LIBRARY/libraryFolder to serve (read-only is fine)
SLEEPYDOCS_CACHE/cacheWritable folder for converted files

โ ๐Ÿงญ How it works

   your folder (read-only)                         cache volume
           โ”‚                                            โ–ฒ
   watcher โ”ดโ”€โ–บ index โ”€โ”€โ”€โ”€ new or changed files โ”€โ”€โ”€โ–บ converter โ”€โ”€โ–บ sleepyconvert
           โ”‚                                            โ”‚          (โ†’ EPUB)
           โ–ผ                                            โ–ผ
   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
   โ”‚ Web app  /          โ”‚ OPDS catalog  /opds  โ”‚ Kobo page  /kobo     โ”‚
   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
        browsers               KOReader               stock browser
  • A file watcher (plus a periodic rescan as a safety net) keeps an in-memory index of the folder. There's no database: the folder is the source of truth.
  • Each new or changed file is converted to EPUB in the background and cached under a key derived from the file's path, size and modification time, so stale copies are never served.
  • The web app asks the server for each document already rendered, and polls for library changes every few seconds.

The full story, written for humans, is in docs/โ .

โ ๐Ÿ’ก Good to know

My documents live on a NAS share

If the server mounts the folder over NFS or SMB, file-change events from other machines never arrive. Set SLEEPYDOCS_FORCE_POLLING=true. A folder on the server's own disk doesn't need this, even if you share it out to other machines.

Permissions

The container runs as UID/GID 1000. It only needs to read your folder, and to write to the cache.

Can I put it on the internet?

SleepyDocs has no login. It's designed for a trusted home network. To reach it from outside, put it behind a reverse proxy with authentication, or use a VPN such as WireGuard or Tailscale.

Do downloaded documents update on the Kobo?

OPDS is browse-and-download, so a copy on the Kobo stays as it was. New and changed files appear in the catalog immediately (see Recently changed). Download them again to update.

How do I reset the cache?

docker compose down -v (or delete the sleepydocs-cache volume). It's rebuilt on demand, and your library is never touched.

โ ๐Ÿ› ๏ธ Development

uv venv && uv pip install -e ".[dev]"
./tools/dev.sh       # http://localhost:8734, serving examples/library
./tools/test.sh      # pytest
./tools/format.sh    # shfmt, black, prettier

Start with docs/architecture.mdโ . Every part of the system has its own short doc.

โ ๐Ÿ™ Built with

FastAPIโ  ยท watchfilesโ  ยท Python-Markdownโ  ยท Pygmentsโ  ยท sleepyconvertโ  ยท Catppuccinโ  ยท and it pairs with KOReaderโ 

โ ๐Ÿ“œ License

GNU Affero General Public License v3.0 onlyโ . You're free to use, study, change and share SleepyDocs. If you run a modified version as a network service, you must offer its source code to the people using it.

Tag summary
Recent tags
Content type
Image
Digest
sha256:01ab072d5โ€ฆ
Size
161.1 MB
Last updated
about 3 hours ago
docker pull sleepyboy/sleepy-docs:latest