~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.
Frontend Build System Guide
Overview
Local Deep Research uses a modern frontend build system with npm for package management and Vite for bundling. This ensures all JavaScript libraries and CSS frameworks are served locally without any external CDN dependencies.
Quick Start
Development Mode
Install dependencies (first time only):
npm installStart the LDR web server (uvicorn serving the FastAPI app):
LDR_VITE_DEV_MODE=true ldr-webLDR_VITE_DEV_MODE=truemakes the templates link to the Vite dev server instead of the hashed production manifest. (python -m local_deep_research.web.appruns the same entry point.)Start Vite dev server (in a separate terminal):
npm run devVite will start on http://localhost:5173 with Hot Module Replacement (HMR) for instant updates.
Production Mode
Build production assets:
npm run buildThis creates optimized bundles in
src/local_deep_research/web/static/dist/Start the server normally (production is the default — leave
LDR_VITE_DEV_MODEunset):ldr-webThe app reads
dist/.vite/manifest.jsonand serves the built, hashed assets from thedist/folder.
Architecture
Why No CDNs?
- Security: All code is audited and served from your server
- Privacy: No user data leaks to third-party CDNs
- Reliability: Works offline, no dependency on external services
- Performance: Assets are optimized and cached locally
- Compliance: Important for enterprise/government deployments
Technology Stack
- npm: Package manager for JavaScript dependencies
- Vite: Fast build tool with instant HMR in development
- FastAPI + uvicorn: Python ASGI web framework and server hosting the application
Dependencies
All frontend dependencies are managed in package.json:
| Library | Purpose | License |
|---|---|---|
@fortawesome/fontawesome-free |
Icons throughout the UI | Font Awesome Free |
bootstrap |
CSS framework for some pages | MIT |
bootstrap-icons |
Additional icons | MIT |
chart.js |
Analytics charts | MIT |
highlight.js |
Code syntax highlighting | BSD-3-Clause |
marked |
Markdown rendering | MIT |
socket.io-client |
Real-time updates | MIT |
jspdf & html2canvas |
PDF export | MIT |
File Structure
.
├── package.json # npm dependencies and scripts
├── vite.config.js # Vite configuration
├── node_modules/ # Downloaded packages (git-ignored)
└── src/local_deep_research/web/
├── static/
│ ├── dist/ # Production build output (git-ignored)
│ │ ├── css/ # Bundled CSS
│ │ ├── fonts/ # Font files (Font Awesome, Bootstrap Icons)
│ │ └── js/ # Bundled JavaScript
│ ├── js/
│ │ ├── app.js # Main entry point importing all dependencies
│ │ └── ... # Other application JavaScript
│ └── css/
│ └── styles.css # Application styles
├── templates/
│ └── base.html # Uses Vite helper for asset loading
└── utils/
└── vite_helper.py # Vite/Jinja2 integration for FastAPI
Common Tasks
Update Dependencies
# Update all packages to latest versions
npm update
# Check for security vulnerabilities
npm audit
# Auto-fix vulnerabilities (if possible)
npm audit fix
# Rebuild after updates
npm run build
Add a New Library
Install the package:
npm install library-nameImport in
src/local_deep_research/web/static/js/app.js:import 'library-name/dist/library.css'; // If it has CSS import Library from 'library-name'; // Import JS // Make available globally if needed window.Library = Library;Rebuild:
npm run build
Debug Build Issues
# Clean install (removes node_modules and reinstalls)
rm -rf node_modules package-lock.json
npm install
# Verbose build output
npm run build -- --debug
# Check what's included in the bundle
npm run build -- --sourcemap
Security
Automated Checks
- Pre-commit Hook:
.pre-commit-hooks/check-external-resources.pyprevents CDN references - GitHub Dependabot: Enable it to get automated PRs for security updates
- npm audit: Run in CI/CD pipeline to catch vulnerabilities
Manual Security Audit
# Check for known vulnerabilities
npm audit
# See dependency tree
npm list
# Check outdated packages
npm outdated
Troubleshooting
Icons Not Showing
Problem: Font Awesome or Bootstrap icons appear as squares
Solution:
- Ensure fonts were built: Check
src/local_deep_research/web/static/dist/fonts/ - Rebuild if missing:
npm run build - Clear browser cache: Ctrl+F5 (or Cmd+Shift+R on Mac)
JavaScript Not Loading
Problem: Libraries like marked or Chart.js not working
Solution:
- Check browser console for errors
- Verify npm packages installed:
npm install - Rebuild assets:
npm run build - Check the server is serving from dist: look for
src/local_deep_research/web/static/dist/.vite/manifest.json. If it is missing — or present but unusable (malformed, empty, truncated) — the server logs aNo usable Vite manifest at <path>warning at startup, plus a line naming the specific cause, and every page carries a red "Frontend assets have not been built" banner. A manifest that parses while a chunk it references is missing fromdist/is a different, quieter case: adoption succeeds, so nothing is logged at startup at all. The first log line arrives at the first render that asks for the affected entry, because that is when the entry's files are checked. Watch forVite manifest entry '<name>' cannot be served: ...rather than the startup warning. Per-entry results are asymmetric: a positive check (the file was found) is remembered for_VERIFICATION_TTL_SECONDS(5 seconds) and then re-walked, but a negative check (the file was missing) is never memoised and is re-walked on every render — so the manifest-parses-but-chunk-missing case above recovers on the very first render after the chunk is flushed todist/; there is no window to wait out. The window matters only for the opposite change: a chunk that was verified present and is then deleted fromdist/under a running server (withoutmanifest.jsonitself changing) is not caught by a background timer between renders — nothing runs on its own — it is noticed within that window of the next render, once a render after the memo has expired asks for the entry again, rather than only at the next rebuild or restart. A chunk that the entry loads on demand (dynamicImports— in this build, the canvg chunk behind diagram export) is validated too, but only warns:Vite entry '<name>' is servable, but a chunk it loads on demand is not: .... The page still renders, and the feature that pulls that chunk in is what fails. A rebuild is picked up on the next request and no restart is needed; the banner names restarting the server only as the last resort for when it survives a successful rebuild and reload.
Vite Dev Server Issues
Problem: HMR not working or connection refused
Solution:
- Ensure Vite is running:
npm run dev - Check port 5173 is free:
lsof -i :5173 - Verify the server was started with
LDR_VITE_DEV_MODE=true— without it the templates load the builtdist/assets, not the dev server
Build Errors
Problem: npm run build fails
Solution:
- Check Node.js version:
node --version(should be 16+ or 18+) - Clear cache and reinstall:
rm -rf node_modules package-lock.json npm cache clean --force npm install - Check for conflicting global packages:
npm list -g --depth=0
Development Tips
Using Vite Dev Server
When developing, Vite provides:
- Instant updates: Changes appear immediately without page refresh
- Better errors: Build errors shown in browser
- Fast startup: No bundling needed during development
Production Optimization
Vite automatically:
- Minifies JavaScript and CSS
- Tree-shakes unused code
- Splits code into chunks
- Generates sourcemaps for debugging
- Optimizes images and fonts
- Creates cache-busting hashes
FastAPI Integration
The ViteHelper class (src/local_deep_research/web/utils/vite_helper.py) is
wired up by _setup_template_globals() in web/fastapi_app.py, which calls
vite.init_for_fastapi(STATIC_DIR, templates). That registers exactly three
Jinja2 globals — vite_asset, vite_hmr and vite_missing_assets_banner
(the banner is rendered at the top of <body>, not from the <head> asset
call). templates/base.html uses all three, and so does every template that
does not extend it: templates/auth/login.html,
templates/auth/register.html and templates/auth/change_password.html are
each a standalone page that calls all three globals directly. assets_are_missing()
is not a global; it is the internal predicate the banner helper calls. The helper handles:
- Loading from the Vite dev server when
LDR_VITE_DEV_MODE=true - Loading built assets from the manifest in production
- Fallback if the build hasn't run yet
CI/CD Integration
Add to your CI pipeline:
# Example GitHub Actions
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '24'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Security audit
run: npm audit --audit-level=high
- name: Build assets
run: npm run build
- name: Check for external resources
run: python .pre-commit-hooks/check-external-resources.py
Migration from CDNs
If you're updating from an older version that used CDNs:
- Pull latest changes
- Install npm dependencies:
npm install - Build assets:
npm run build - Clear browser cache: CDN resources may be cached
- Test thoroughly: Ensure all features work offline
Contributing
When adding frontend features:
- No external resources: All assets must be in npm packages
- Update package.json: Add new dependencies properly
- Import in app.js: Ensure libraries are imported
- Test the build: Run
npm run buildbefore committing - Document changes: Update this guide if needed
Support
- Build issues: Check Node.js version and reinstall packages
- Runtime issues: Check browser console and the LDR server logs
- Security concerns: Run
npm auditand update packages - Performance: Vite automatically optimizes; check bundle size with
npm run build
Last updated: August 2024 Vite version: 5.x npm version: 10.x