|
| 1 | +# sdocs — Offline Documentation Search Engine |
| 2 | + |
| 3 | +sdocs is a lightweight system for building a **fully offline searchable archive of documentation websites**. |
| 4 | +It downloads documentation pages, indexes them locally, and provides a fast browser-based search interface that works **without any internet connection**. |
| 5 | + |
| 6 | +The project is designed for developers who deal with unstable internet connections, restricted networks, or simply want instant local access to documentation. |
| 7 | + |
| 8 | + |
| 9 | +### ✨ Important Note |
| 10 | + |
| 11 | +**This project is vibe coded.** |
| 12 | +The architecture, scripts, and implementation were generated collaboratively with **ChatGPT** through iterative design and refinement. |
| 13 | + |
| 14 | +The goal was to build a **simple, practical, reproducible offline documentation system** with minimal dependencies and transparent tooling. |
| 15 | + |
| 16 | + |
| 17 | +## What sdocs Does |
| 18 | + |
| 19 | +sdocs automates a small pipeline: |
| 20 | + |
| 21 | +1. Download documentation websites |
| 22 | +2. Store them locally |
| 23 | +3. Extract searchable content |
| 24 | +4. Build a search index |
| 25 | +5. Provide a browser-based offline search UI |
| 26 | + |
| 27 | +Everything runs locally. No external services, no cloud indexing, no tracking. |
| 28 | + |
| 29 | + |
| 30 | +## Requirements |
| 31 | + |
| 32 | +To use sdocs locally you only need a few common tools installed, most of them are installed on GNU/Linux distros. |
| 33 | + |
| 34 | +Make sure dependencies are installed: |
| 35 | + |
| 36 | +*Archlinux* |
| 37 | +> `sudo pacman -S wget make python3 git` |
| 38 | +
|
| 39 | +## Preparation |
| 40 | + |
| 41 | +- **Clone the repository:** |
| 42 | + |
| 43 | +```sh |
| 44 | +git clone https://github.com/EhsanAramide/sdocs |
| 45 | +cd sdocs |
| 46 | +``` |
| 47 | + |
| 48 | + |
| 49 | +- **Adding Documentation Sources:** |
| 50 | + |
| 51 | +Edit the file: |
| 52 | + |
| 53 | +``` |
| 54 | +docs.list |
| 55 | +``` |
| 56 | + |
| 57 | +Each line should contain directory name and documentation URL: |
| 58 | + |
| 59 | +Example: |
| 60 | + |
| 61 | +``` |
| 62 | +python3 https://docs.python.org/3/ |
| 63 | +fastapi https://fastapi.tiangolo.com/ |
| 64 | +redis https://redis.io/docs/ |
| 65 | +``` |
| 66 | + |
| 67 | +sdocs will download and archive each site. |
| 68 | + |
| 69 | + |
| 70 | +## Usage |
| 71 | + |
| 72 | +The workflow is controlled through the Makefile. |
| 73 | + |
| 74 | +### 1. Fetch documentation |
| 75 | + |
| 76 | +```sh |
| 77 | +make fetch |
| 78 | +``` |
| 79 | + |
| 80 | +This downloads all documentation sources listed in `docs.list`. |
| 81 | + |
| 82 | + |
| 83 | +### 2. Build the search index |
| 84 | + |
| 85 | +```sh |
| 86 | +make index |
| 87 | +``` |
| 88 | + |
| 89 | +This extracts text and generates: |
| 90 | + |
| 91 | +```txt |
| 92 | +web/search_index.json |
| 93 | +``` |
| 94 | + |
| 95 | + |
| 96 | +### 3. Run the local search engine |
| 97 | + |
| 98 | +```sh |
| 99 | +make serve |
| 100 | +``` |
| 101 | + |
| 102 | +Then open your browser: |
| 103 | + |
| 104 | +``` |
| 105 | +http://localhost:8000 |
| 106 | +``` |
| 107 | + |
| 108 | +You now have a **fully offline documentation search engine**. |
| 109 | + |
| 110 | + |
| 111 | +## Offline Search |
| 112 | + |
| 113 | +The web interface uses **FlexSearch** running entirely in the browser. |
| 114 | + |
| 115 | +Features: |
| 116 | + |
| 117 | +- instant search |
| 118 | +- zero network requests |
| 119 | +- local JSON index |
| 120 | +- fast indexing |
| 121 | +- no backend required |
| 122 | + |
| 123 | +Everything works even on **air‑gapped machines**. |
| 124 | + |
| 125 | + |
| 126 | +## Project Structure |
| 127 | + |
| 128 | +``` |
| 129 | +sdocs/ |
| 130 | +│ |
| 131 | +├─ archives/ # raw files of documentations |
| 132 | +├─ archives/ # compressed files of documentations |
| 133 | +├─ scripts/ # helper scripts |
| 134 | +│ ├─ fetch.sh |
| 135 | +│ └─ indexer.py |
| 136 | +│ |
| 137 | +├─ web/ # search interface |
| 138 | +│ ├─ index.html |
| 139 | +│ ├─ styles.css |
| 140 | +│ ├─ search.js |
| 141 | +│ ├─ search_index.json |
| 142 | +│ └─ lib/ |
| 143 | +│ └─ flexsearch.bundle.min.js |
| 144 | +│ |
| 145 | +├─ config/ |
| 146 | +│ └─ docs.list # list of documentation sources |
| 147 | +├─ Makefile |
| 148 | +└─ README.md |
| 149 | +``` |
| 150 | + |
| 151 | + |
| 152 | +## Philosophy |
| 153 | + |
| 154 | +sdocs follows a few simple principles: |
| 155 | + |
| 156 | +- **offline first** |
| 157 | +- **minimal dependencies** |
| 158 | +- **transparent tooling** |
| 159 | +- **simple architecture** |
| 160 | +- **developer friendly** |
| 161 | + |
| 162 | +No frameworks. No heavy infrastructure. Just simple tools working together. |
| 163 | + |
| 164 | + |
| 165 | +## Possible Future Improvements |
| 166 | + |
| 167 | +Some ideas for future versions: |
| 168 | + |
| 169 | +- better ranking for documentation search |
| 170 | +- result highlighting |
| 171 | +- keyboard navigation |
| 172 | +- automatic deduplication |
| 173 | +- compressed documentation archives |
| 174 | +- improved indexing pipeline |
| 175 | + |
| 176 | + |
| 177 | +## Final Words |
| 178 | + |
| 179 | +sdocs was created as a practical tool for developers who want **fast, reliable access to documentation without depending on the internet**. |
| 180 | + |
| 181 | +If you find it useful, feel free to extend it, fork it, or adapt it to your own workflows. |
0 commit comments