Explore repositories, select files, and copy code context for AI agents in seconds. Install with one command, no web server needed.
A lightweight web-based tool for exploring directory structures across multiple repositories and quickly extracting file contents for development workflows.
Especially useful when working with AI coding assistants, allowing developers to quickly browse a project, select relevant files, and copy their contents into prompts.
Built with Python / FastAPI (backend) and Vue.js (frontend). Designed to be self-hosted, simple, and fast.
This is a Python rewrite of the original PHP version. Same features, much simpler installation.
curl -fsSL https://raw.githubusercontent.com/cloudpad9/directory-structure-viewer-python/main/install.sh | bashThis creates a self-contained installation at ~/.dsviewer/ with its own Python virtual environment. No sudo required.
The installer will prompt you to create an admin username and password on first install.
Then open a new terminal (or source ~/.bashrc) and run:
dsviewerThe app starts at http://localhost:9876.
To update to the latest version, run either of the following from any terminal on the machine:
dsviewer --updateOr directly with curl:
curl -fsSL https://raw.githubusercontent.com/cloudpad9/directory-structure-viewer-python/main/update.sh | bashThe update script replaces only the application code — your data directory (~/.dsviewer/data/) and credentials are preserved. If a systemd service is running, it is stopped before the update and restarted automatically afterward.
Python 3.10 or newer. No web server, no database, no PHP.
Check your Python version:
python3 --versiondsviewer [OPTIONS]
Options:
--host HOST Bind address (default: 0.0.0.0)
--port PORT Port number (default: 9876)
--data-dir PATH Data directory (default: ~/.dsviewer/data)
--no-auth Disable authentication
--open Open browser on start
--version Show version and exit
--change-password Change a user's password
--update Update to the latest version from GitHub
Examples:
# Start on a custom port
dsviewer --port 8080
# Start and open browser
dsviewer --open
# Run without login (trusted network)
dsviewer --no-auth
# Change the admin password
dsviewer --change-password
# Update to latest version
dsviewer --updateBrowse & Select
— Explore multiple repositories or directories from a single interface. Enter any path, switch freely between projects using the recent paths dropdown. Select files individually or by directory. Filter with include/exclude keywords (e.g. controller -test).
View & Edit — Preview file contents with syntax highlighting (Ace Editor). View code outlines showing only function/class/method signatures. Expand files to see content blocks and select specific functions. Edit files directly in the browser with Ctrl+S to save.
Search & Replace — Search across all selected files with literal or regex patterns. Replace in bulk with preview. Results show line numbers, match counts, and highlighted context.
Copy & Download — Copy merged file contents to clipboard for pasting into AI prompts. Download individual files or multiple files as a ZIP archive. Generate shareable public links for files.
Workspace Management — Save and load named file lists for recurring tasks. Check all / uncheck visible files. Filter the selected files list. View directory tree of your selection.
Interface — Dark mode. Responsive 3-pane layout with draggable resize handles. Mobile-friendly with hamburger menu. Collapsible panes. State persists across page refreshes.
A typical workflow when working with AI coding assistants:
- Start
dsviewerand open it in your browser - Enter a repository path and click Analyze
- Select the files relevant to your task
- Click View to preview their contents
- Click Copy to copy everything to clipboard
- Paste into your AI assistant as context
Switch to a different repo at any time — just type a new path and Analyze again.
The app uses token-based authentication with bcrypt-hashed passwords.
- User logs in with username and password
- Server creates a session token (valid for 7 days)
- Token is sent with every subsequent request
- Sessions auto-expire and are cleaned up automatically
Change the password at any time:
dsviewer --change-passwordTo disable authentication entirely (e.g. for local-only use):
dsviewer --no-authTo keep dsviewer running in the background:
# /etc/systemd/system/dsviewer.service
[Unit]
Description=Directory Structure Viewer
After=network.target
[Service]
Type=simple
User=youruser
ExecStart=/home/youruser/.dsviewer/bin/dsviewer --port 9876
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.targetsudo systemctl daemon-reload
sudo systemctl enable --now dsviewerFor a full production setup including Cloudflare Tunnel and custom domain, see docs/PRODUCTION_SETUP.md.
All data is stored in ~/.dsviewer/data/ as plain JSON files. No database.
| File | Purpose |
|---|---|
| users.json | User accounts |
| sessions.json | Active login sessions |
| tokens.json | Public link token mappings |
directory-structure-viewer-python/
├── install.sh
├── update.sh
├── pyproject.toml
├── README.md
├── LICENSE
├── docs/
│ ├── DEV_SETUP.md
│ └── PRODUCTION_SETUP.md
├── src/
│ └── dsviewer/
│ ├── __init__.py
│ ├── __main__.py
│ ├── cli.py
│ ├── server.py
│ ├── config.py
│ ├── auth.py
│ ├── api.py
│ ├── file_processor.py
│ ├── block_helpers.py
│ ├── php_helper.py
│ ├── js_helper.py
│ ├── markdown_helper.py
│ ├── simplified_content.py
│ └── static/
│ └── index.html
└── tests/
| Document | Description |
|---|---|
| docs/DEV_SETUP.md | Clone the repo, install dependencies, run tests, and manually verify all features locally |
| docs/PRODUCTION_SETUP.md | Deploy as a systemd service, expose via Cloudflare Tunnel with a custom domain |
rm -rf ~/.dsviewerThen remove this line from ~/.bashrc and/or ~/.zshrc:
export PATH="$HOME/.dsviewer/bin:$PATH"This project is a Python rewrite of directory-structure-viewer (PHP + Vue.js). Same UI and features, simpler installation.
Contributions are welcome.
- Fork the repository
- Create a feature branch
- Submit a pull request
MIT License
