devdocs README

The project's README from github.com/freeCodeCamp/devdocs. As one markdown file: README.md.

DevDocs — API Documentation Browser

DevDocs combines multiple developer documentations in a clean and organized web UI with instant search, offline support, mobile version, dark theme, keyboard shortcuts, and more.

DevDocs was created by Thibaut Courouble and is operated by freeCodeCamp.

We are currently searching for maintainers

Please reach out to the community on Discord if you would like to join the team!

Keep track of development news:

Table of Contents: Quick Start · Vision · App · Scraper · Commands · Contributing · Documentation · Related Projects · License · Questions?

Quick Start

Unless you wish to contribute to the project, we recommend using the hosted version at devdocs.io. It's up-to-date and works offline out-of-the-box.

The easiest way to run DevDocs locally is using Docker:

docker run --name devdocs -d -p 9292:9292 ghcr.io/freecodecamp/devdocs:latest

This will start DevDocs at localhost:9292. We provide both regular and Alpine-based images:

Images are automatically built and updated monthly with the latest documentation.

Alternatively, you can build the image yourself:

git clone https://github.com/freeCodeCamp/devdocs.git && cd devdocs
docker build -t devdocs .
docker run --name devdocs -d -p 9292:9292 devdocs

Manual Installation

DevDocs is made of two pieces: a Ruby scraper that generates the documentation and metadata, and a JavaScript app powered by a small Sinatra app.

DevDocs requires Ruby 4.0.6 (defined in Gemfile), libcurl, and a JavaScript runtime supported by ExecJS (included in OS X and Windows; Node.js on Linux). On Arch Linux run pacman -S ruby ruby-bundler ruby-erb ruby-irb.

Once you have these installed, run the following commands:

git clone https://github.com/freeCodeCamp/devdocs.git && cd devdocs
gem install bundler
bundle install
bundle exec thor docs:download --default
bundle exec rackup

Finally, point your browser at localhost:9292 (the first request will take a few seconds to compile the assets). You're all set.

The thor docs:download command is used to download pre-generated documentations from DevDocs's servers (e.g. thor docs:download html css). You can see the list of available documentations and versions by running thor docs:list. To update all downloaded documentations, run thor docs:download --installed. To download and install all documentation this project has available, run thor docs:download --all.

Note: there is currently no update mechanism other than git pull origin main to update the code and thor docs:download --installed to download the latest version of the docs. To stay informed about new releases, be sure to watch this repository.

Vision

DevDocs aims to make reading and searching reference documentation fast, easy and enjoyable.

The app's main goals are to:

Note: DevDocs is neither a programming guide nor a search engine. All our content is pulled from third-party sources and the project doesn't intend to compete with full-text search engines. Its backbone is metadata; each piece of content is identified by a unique, "obvious" and short string. Tutorials, guides and other content that don't meet this requirement are outside the scope of the project.

App

The web app is all client-side JavaScript, powered by a small Sinatra/Sprockets application. It relies on files generated by the scraper.

Many of the code's design decisions were driven by the fact that the app uses XHR to load content directly into the main frame. This includes stripping the original documents of most of their HTML markup (e.g. scripts and stylesheets) to avoid polluting the main frame, and prefixing all CSS class names with an underscore to prevent conflicts.

Another driving factor is performance and the fact that everything happens in the browser. A service worker (which comes with its own set of constraints) and localStorage are used to speed up the boot time, while memory consumption is kept in check by allowing the user to pick his/her own set of documentations. The search algorithm is kept simple because it needs to be fast even searching through 100,000 strings.

DevDocs being a developer tool, the browser requirements are high:

This allows the code to take advantage of the latest DOM and HTML5 APIs and make developing DevDocs a lot more fun!

Scraper

The scraper is responsible for generating the documentation and index files (metadata) used by the app. It's written in Ruby under the Docs module.

There are currently two kinds of scrapers: UrlScraper which downloads files via HTTP and FileScraper which reads them from the local filesystem. They both make copies of HTML documents, recursively following links that match a set of rules and applying all sorts of modifications along the way, in addition to building an index of the files and their metadata. Documents are parsed using Nokogiri.

Modifications made to each document include:

These modifications are applied via a set of filters using the HTML::Pipeline library. Each scraper includes filters specific to itself, one of which is tasked with figuring out the pages' metadata.

The end result is a set of normalized HTML partials and two JSON files (index + offline data). Because the index files are loaded separately by the app following the user's preferences, the scraper also creates a JSON manifest file containing information about the documentations currently available on the system (such as their name, version, update date, etc.).

More information about scrapers and filters is available in the docs folder.

Available Commands

The command-line interface uses Thor. To see all commands and options, run thor list from the project's root.

# Server
rackup              # Start the server (ctrl+c to stop)
rackup --help       # List server options

# Docs
thor docs:list      # List available documentations
thor docs:download  # Download one or more documentations
thor docs:manifest  # Create the manifest file used by the app
thor docs:generate  # Generate/scrape a documentation
thor docs:page      # Generate/scrape a documentation page
thor docs:package   # Package a documentation for use with docs:download
thor docs:clean     # Delete documentation packages and cached responses

# Console
thor console        # Start a REPL
thor console:docs   # Start a REPL in the "Docs" module

# Tests can be run quickly from within the console using the "test" command.
# Run "help test" for usage instructions.
thor test:all       # Run all tests
thor test:docs      # Run "Docs" tests
thor test:app       # Run "App" tests
thor test:coverage  # Run coverage report on "App" tests

# Assets
thor assets:compile # Compile assets (not required in development mode)
thor assets:clean   # Clean old assets

If multiple versions of Ruby are installed on your system, commands must be run through bundle exec.

Contributing

Contributions are welcome. Please read the contributing guidelines.

Documentation

DevDocs Quick Usage Cheatsheet

Below are some helpful shortcuts and usage tips that are not immediately obvious to new users:

These shortcuts make DevDocs faster to navigate and more efficient for daily use.

Made something cool? Feel free to open a PR to add a new row to this table! You might want to discover new projects via https://github.com/topics/devdocs.

Project Description Last commit Stars
yannickglt/alfred-devdocs Alfred workflow Latest GitHub commit GitHub stars
Merith-TK/devdocs_webapp_kotlin Android application Latest GitHub commit GitHub stars
gruehle/dev-docs-viewer Brackets extension Latest GitHub commit GitHub stars
egoist/devdocs-desktop Electron application Latest GitHub commit GitHub stars
skeeto/devdocs-lookup Emacs function Latest GitHub commit GitHub stars
astoff/devdocs.el Emacs viewer Latest GitHub commit GitHub stars
naquad/devdocs-shell GTK shell with Vim integration Latest GitHub commit GitHub stars
hardpixel/devdocs-desktop GTK application Latest GitHub commit GitHub stars
qwfy/doc-browser Linux application Latest GitHub commit GitHub stars
dteoh/devdocs-macos macOS application Latest GitHub commit GitHub stars
Sublime Text plugin Sublime Text plugin Latest GitHub commit GitHub stars
mohamed3nan/DevDocs-Tab VS Code extension (view as tab) Latest GitHub commit GitHub stars
deibit/vscode-devdocs VS Code extension (open the browser) Latest GitHub commit GitHub stars
mdh34/quickDocs Vala/Python based viewer Latest GitHub commit GitHub stars
girishji/devdocs.vim Vim plugin & TUI (browse inside Vim) Latest GitHub commit GitHub stars
romainl/vim-devdocs Vim plugin Latest GitHub commit GitHub stars
waiting-for-dev/vim-www Vim plugin Latest GitHub commit GitHub stars
emmanueltouzery/apidocs.nvim Neovim plugin Latest GitHub commit GitHub stars
toiletbril/dedoc Terminal based viewer Latest GitHub commit GitHub stars
Raycast Devdocs Raycast extension Unavailable Unavailable
chrisgrieser/alfred-docs-searches Alfred workflow Latest GitHub commit GitHub stars

Copyright 2013–2026 Thibaut Courouble and other contributors

This software is licensed under the terms of the Mozilla Public License v2.0. See the COPYRIGHT and LICENSE files.

Please do not use the name DevDocs to endorse or promote products derived from this software without the maintainers' permission, except as may be necessary to comply with the notice/attribution requirements.

We also wish that any documentation file generated using this software be attributed to DevDocs. Let's be fair to all contributors by giving credit where credit's due. Thanks!

Questions?

If you have any questions, please feel free to ask them on the #contributors chat room on Discord.

devdocs (freeCodeCamp/devdocs)

Searching Database…

39.6K ·GitHub
这是什么?DevDocs 将众多编程语言、框架和工具的文档整合到一个快速、可搜索的网页界面中,并支持离线使用、移动版、深色主题和键盘快捷键。
这是托管网站,还是需要我自己运行的程序?两者都有:大多数人直接使用 devdocs.io 上免费的托管版本,但如果你想参与贡献或定制功能,也可以用 Docker 或手动配置 Ruby/Sinatra 来自行部署。
我该如何自己运行它?最简单的方法是使用 Docker:拉取 'ghcr.io/freecodecamp/devdocs:latest'(或体积更小的 '-alpine' 标签),应用会在 localhost:9292 上提供服务。如果选择手动安装,需要自己安装 Ruby/Sinatra 应用,并使用 Thor 命令行工具(例如 'thor docs:download html css')下载文档集。
手动(非 Docker)安装需要准备什么?Ruby 4.0.6、libcurl,以及 ExecJS 支持的 JavaScript 运行时——macOS 和 Windows 已内置,但 Linux 需要安装 Node.js。
有自动更新功能吗?没有。你需要用 'git pull origin main' 更新代码,并用 'thor docs:download --installed' 刷新已安装的文档——程序内置没有自动更新器。
它实际支持哪些浏览器?它只面向现代浏览器:较新版本的 Firefox、Chrome 或 Opera、Safari 11.1+、Edge 17+ 以及 iOS 11.3+,因为它依赖较新的 DOM 和 HTML5 API。
离线模式真的能在没有网络时使用吗?可以——通过 Service Worker 和“离线模式”开关,你可以把指定的文档集下载到 localStorage,之后无需联网即可阅读。
如何只下载指定的文档集,而不是全部下载?使用 Thor 命令行工具,例如 'thor docs:download html css' 下载指定文档,或使用 'thor docs:download --all' 安装所有可用的文档集。
为什么 DevDocs 不收录教程或指南?该项目只索引通过简短且唯一的字符串标识的参考/API 内容,因为其搜索算法需要在 10 万条以上的条目中保持快速——全文教程和指南被有意排除在范围之外。
有哪些实用的键盘快捷键?按 / 或 Ctrl+K 聚焦搜索框,按 ? 打开帮助浮层,用方向键浏览结果,按 Enter 打开选中的结果,按 Shift+S 切换侧边栏。
爬虫实际是如何生成文档的?基于 Ruby 的 UrlScraper 和 FileScraper 类负责抓取或读取源页面,借助 Nokogiri 和 HTML::Pipeline 过滤器对其进行清理和改写,然后输出标准化的 HTML 片段,以及 JSON 索引和离线数据文件。
What are similar projects?zeal, jsdoc, gollum, VibeOffice, redoc, oxynote, PandaWiki, squoosh
Size
32.8 MB
Stars
39.6K
Updated
CommitOct 16
Age
12y
Commits · 90 Days