# Project export: LiteRAG

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: Cal Hacks 12.0
- Tagline: LiteRAG is a storage-efficient retrieval engine for the edge—delivering high-recall semantic search with 50× less storage, faster startup, and on-device intelligence without loss in quality.
- Devpost: https://devpost.com/software/literag
- GitHub: https://github.com/PvRao-29/liteRAG
- Team: 2 GitHub contributor(s) — Pranshu Rao (12 commits), Aayan Rizvi (4 commits)

## Devpost submission (written by the team)

### Inspiration

We’ve been researching retrieval-augmented generation (RAG) and storage-efficient embedding systems at Berkeley, and noticed a gap: most retrieval engines are built for the cloud. They’re powerful but bulky—too large for laptops, edge servers, or mobile devices. We wanted to see if we could bring the same high-recall semantic search to the edge, with minimal storage and no loss in quality.

### What it does

LiteRAG is a storage-optimized retrieval engine designed for the edge. It compresses indexes to under 5% of raw data, achieving up to 50× smaller footprints than standard vector databases while maintaining comparable recall. LiteRAG can ingest any GitHub repo, build a graph-based index, and let users query side-by-side against a Chroma baseline—with optional Groq acceleration for instant, context-aware answers.

### How we built it

We built LiteRAG with a FastAPI backend managing ingestion, indexing, and evaluation, and a Next.js frontend for visualization and benchmarking. Each run creates isolated Chroma stores and reproducible builds to ensure fair comparisons. We experimented with graph compression, text normalization, and quantization strategies to achieve near-lossless retrieval quality in a tiny footprint.

### Challenges we ran into

Our biggest challenge was balancing recall quality with aggressive compression. Pushing storage down 50× without breaking semantic precision required iterating on embedding sparsification, graph layouts, and normalization pipelines. We also had to ensure consistent benchmarks across multiple frameworks, which meant designing reproducible evaluation loops from scratch.

### Accomplishments we're proud of

We achieved a working retrieval system that’s orders of magnitude smaller than existing solutions—yet delivers nearly identical recall quality. LiteRAG runs cleanly on devices with limited memory, cold-starts instantly, and supports deterministic comparisons with Chroma. Seeing a 50× reduction in storage without measurable loss in accuracy was a huge milestone.

### What we learned

We deepened our understanding of graph-based retrieval, index compression, and storage-aware design for RAG systems. We also learned how small architectural decisions—like memory layout or token normalization—can drastically affect both performance and reproducibility. These lessons tie directly into our ongoing research on efficient, adaptive retrieval models.

### What's next

If possible we will try to pitch this idea to a couple of VC's! We believe this can be BIG.

## README (from the GitHub repository)

# LiteRAG

A small Next.js app and Python backend that build tiny LiteRAG and Chroma indexes, show on-disk size, and let you query both. LiteRAG is the focus; Chroma is included solely as a baseline for comparison. Optionally, responses are summarized by a Groq LLM. A separate Flask app demonstrates a local Ollama streaming chat UI.

## What’s in here

- Next.js 14 frontend (`app/`) with Tailwind UI
- FastAPI backend (`backend.py`) exposing:
  - `GET /setup` — builds the LiteRAG index and a persistent Chroma collection (baseline), returns storage stats
  - `GET /ask?q=...` — searches both and returns results plus optional Groq LLM response
- Optional Flask SSE server (`chat.py`) that streams responses from a local Ollama model

> Note: Chroma is only used as a familiar baseline to highlight LiteRAG’s advantages (smaller storage footprint with comparable results on this demo dataset).

## Prerequisites

- Node.js 18+ and npm
- Python 3.10+
- Optional for Groq summaries: a Groq API key
- Optional for local chat: [Ollama] installed with a local model pulled (e.g. `qwen7b`)

## Quick start

1) Install frontend deps

```bash
npm install
```

2) Install Python deps (add missing runtime libs used by the code)

```bash
python -m venv .venv && source .venv/bin/activate  # optional but recommended
pip install -r requirements.txt
pip install fastapi uvicorn chromadb leann groq flask
```

3) Start the backend (FastAPI)

```bash
uvicorn backend:app --reload --port 8000
```

4) Start the frontend (Next.js)

```bash
npm run dev
```

Open http://localhost:3000

5) In the UI

- Click “Download & Build Demo” to run `GET /setup` and build both indexes
- Ask a question; the app calls `GET /ask?q=...` and shows results for LiteRAG (primary) and Chroma (baseline)

## API reference (FastAPI)

### GET /setup
Builds a tiny LiteRAG index and a persistent Chroma collection (baseline) under `demo_data/`, then returns storage stats.

Response shape:

```json
{
  "leann_size_kb": 1.23,
  "chroma_size_kb": 8.45,
  "storage_reduction_percent": 85.4
}
```

Notes
- LiteRAG index path: `demo_data/leann_index.index` (field name `leann_*` is legacy in code and refers to LiteRAG)
- Chroma data dir: `demo_data/chroma_db/`

### GET /ask?q=...
Searches both backends and includes an optional Groq-generated answer per context.

Response shape (truncated):

```json
{
  "query": "your question",
  "leann": {
    "results": [
      { "text": "...", "score": 0.1234, "metadata": {} }
    ],
    "groq_response": "...",
    "context": "..."
  },
  "chroma": {
    "results": {
      "documents": [["...", "..."]],
      "distances": [[0.12, 0.34]]
    },
    "groq_response": "...",
    "context": "..."
  }
}
```

## Optional: Local Ollama streaming chat (separate app)

`chat.py` runs a minimal Flask server that streams tokens from a local Ollama model via SSE.

Run it (cannot share port 8000 with the FastAPI backend at the same time):

```bash
python chat.py
```

Endpoints
- `/` — simple in-browser chat UI
- `/ping_ollama` — health check (non-streaming)
- `/stream_test` — SSE smoke test
- `/chat_sse?session_id=...&text=...` — main streaming endpoint

Environment
- `OLLAMA_HOST` (default `http://127.0.0.1:11434`)
- `MODEL_NAME` (default `qwen7b`) — must exist in `ollama list`

Port note: `chat.py` is hardcoded to `127.0.0.1:8000`. If the FastAPI backend is running, stop it first or change the port in `chat.py`.

## Environment and configuration

Groq (optional summaries in `backend.py`)
- The function `get_groq_response()` currently contains a hardcoded API key. Replace it with an env read (e.g., `os.environ.get("GROQ_API_KEY")`) before committing or sharing the code.
- If Groq is not installed or the key is missing/invalid, the backend returns an error string in `groq_response`, and the demo still functions.

Frontend backend URL
- The UI calls `http://localhost:8000`. If you change the backend host/port, update the URLs in `app/LiteRAGDemo.tsx` (`/setup`, `/ask`).

Data locations
- LiteRAG index (legacy name in code): `demo_data/leann_index.index`
- Chroma DB: `demo_data/chroma_db/`
- Delete the `demo_data/` folder to reset.

## Troubleshooting

- ModuleNotFoundError for `fastapi`, `uvicorn`, `chromadb`, `leann`, `groq`, or `flask` → install the packages shown above.
- Port already in use (`8000`) → stop the other server or change the port (and adjust the frontend URLs if needed).
- CORS errors → `backend.py` already allows all origins; ensure you are calling the correct host/port.
- Groq errors in `groq_response` → install `groq` and set a valid API key; or ignore if summaries are not needed.
- LiteRAG import error → ensure the `leann` Python package installs successfully for your platform.

## License

No license specified in this repository.

---

Made for a simple, reproducible comparison that showcases LiteRAG, with Chroma included only as a baseline.


## Detected evidence (automated analysis)

Indexed codebase: 12 recognized source files, 44 KB.
- CSS (language) — detected in the code
- JavaScript (language) — detected in the code
- Next.js (technology) — detected in the code
- Python (language) — detected in the code
- React (technology) — detected in the code
- Streamlit (technology) — detected in the code
- Tailwind CSS (technology) — detected in the code
- TensorFlow (technology) — detected in the code
- TypeScript (language) — detected in the code
- FastAPI (technology) — claimed on Devpost, not found in the code

## Codebase structure (from repository index)

### Files (26 of 26)

```
.gitignore
app/demo/page.tsx
app/globals.css
app/landing/page.tsx
app/layout.tsx
app/LiteRAGDemo.tsx
app/page.tsx
backend.py
demo_data/.DS_Store
demo_data/chroma_db/.DS_Store
demo_data/chroma_db/chroma.sqlite3
demo_data/chroma_db/current_path.txt
demo_data/chroma_db/demo/chroma.sqlite3
demo_data/chroma_db/working/run_1761491775/chroma.sqlite3
demo_data/leann_index.index
demo_data/leann_index.index.meta.json
demo_data/leann_index.index.passages.idx
demo_data/leann_index.index.passages.jsonl
next-env.d.ts
next.config.js
package.json
postcss.config.js
README.md
requirements.txt
tailwind.config.js
tsconfig.json
```

### Dependencies

- package.json: @types/node@^20.0.0, @types/react@^18.2.0, @types/react-dom@^18.2.0, autoprefixer@^10.4.16, eslint@^8.0.0, eslint-config-next@14.0.0, next@14.0.0, postcss@^8.4.31, react@^18.2.0, react-dom@^18.2.0, tailwindcss@^3.3.5, typescript@^5.0.0
- requirements.txt: absl-py@==2.3.0, altair@==5.5.0, annotated-types@==0.7.0, anyio@==4.9.0, appnope@@ file:///home/conda/feedstock_root/build_artifacts/appnope_1733332318622/work, asttokens@@ file:///home/conda/feedstock_root/build_artifacts/asttokens_1733250440834/work, astunparse@==1.6.3, attrs@==25.3.0, beautifulsoup4@==4.13.4, blinker@==1.9.0, bs4@==0.0.2, cachetools@==6.1.0, certifi@==2025.6.15, charset-normalizer@==3.4.2, choreographer@==1.0.9, click@==8.2.1, comm@@ file:///home/conda/feedstock_root/build_artifacts/comm_1733502965406/work, contourpy@==1.3.2, cycler@==0.12.1, debugpy@@ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_6a37he2v_t/croot/debugpy_1736267437603/work, decorator@@ file:///home/conda/feedstock_root/build_artifacts/decorator_1740384970518/work, exceptiongroup@@ file:///home/conda/feedstock_root/build_artifacts/exceptiongroup_1746947292760/work, executing@@ file:///home/conda/feedstock_root/build_artifacts/executing_1745502089858/work, fastjsonschema@==2.21.1, flatbuffers@==25.2.10, fonttools@==4.58.4, gast@==0.6.0, gitdb@==4.0.12, GitPython@==3.1.45, google-pasta@==0.2.0, grpcio@==1.73.0, h11@==0.16.0, h5py@==3.14.0, httpcore@==1.0.9, httpx@==0.28.1, idna@==3.10, importlib_metadata@@ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_importlib-metadata_1747934053/work, ipykernel@@ file:///Users/runner/miniforge3/conda-bld/ipykernel_1719845458456/work, ipython@@ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_ipython_1748713870/work, ipython_pygments_lexers@@ file:///home/conda/feedstock_root/build_artifacts/ipython_pygments_lexers_1737123620466/work, ipywidgets@==8.1.7, jedi@@ file:///home/conda/feedstock_root/build_artifacts/jedi_1733300866624/work, Jinja2@==3.1.6, joblib@==1.5.1, jsonpatch@==1.33, jsonpointer@==3.0.0, jsonschema@==4.24.0, jsonschema-specifications@==2025.4.1, jupyter_client@@ file:///home/conda/feedstock_root/build_artifacts/jupyter_client_1733440914442/work, jupyter_core@@ file:///home/conda/feedstock_root/build_artifacts/jupyter_core_1748333051527/work, jupyterlab_widgets@==3.0.15, kaleido@==1.0.0, keras@==3.10.0, kiwisolver@==1.4.8, langchain-core@==0.3.66, langgraph@==0.4.10, langgraph-checkpoint@==2.1.0, langgraph-prebuilt@==0.2.3, langgraph-sdk@==0.1.70, langsmith@==0.4.2, libclang@==18.1.1, logistro@==1.1.0, lxml@==6.0.0, Markdown@==3.8.2, markdown-it-py@==3.0.0, MarkupSafe@==3.0.2, matplotlib@==3.10.3, matplotlib-inline@@ file:///home/conda/feedstock_root/build_artifacts/matplotlib-inline_1733416936468/work, mdurl@==0.1.2, ml_dtypes@==0.5.1, namex@==0.1.0, narwhals@==1.46.0, nbformat@==5.10.4, nest_asyncio@@ file:///home/conda/feedstock_root/build_artifacts/nest-asyncio_1733325553580/work, numpy@==2.1.3, opt_einsum@==3.4.0, optree@==0.16.0, orjson@==3.10.18, ormsgpack@==1.10.0, packaging@==24.2, pandas@==2.3.0, parso@@ file:///home/conda/feedstock_root/build_artifacts/parso_1733271261340/work, patsy@==1.0.1, pexpect@@ file:///home/conda/feedstock_root/build_artifacts/pexpect_1733301927746/work, pickleshare@@ file:///home/conda/feedstock_root/build_artifacts/pickleshare_1733327343728/work, pillow@==11.2.1, platformdirs@@ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_platformdirs_1746710438/work, plotly@==6.2.0, prompt_toolkit@@ file:///home/conda/feedstock_root/build_artifacts/prompt-toolkit_1744724089886/work, protobuf@==5.29.5, psutil@@ file:///private/var/folders/k1/30mswbxs7r1g6zwn8y4fyt500000gp/T/abs_10oa1k8l11/croot/psutil_1736367646006/work, ptyprocess@@ file:///home/conda/feedstock_root/build_artifacts/ptyprocess_1733302279685/work/dist/ptyprocess-0.7.0-py2.py3-none-any.whl#sha256=92c32ff62b5fd8cf325bec5ab90d7be3d2a8ca8c8a3813ff487a8d2002630d1f, pure_eval@@ file:///home/conda/feedstock_root/build_artifacts/pure_eval_1733569405015/work, pyarrow@==21.0.0, pydantic@==2.11.7, pydantic_core@==2.33.2, pydeck@==0.9.1, pyfiglet@==1.0.3, Pygments@@ file:///home/conda/feedstock_root/build_artifacts/pygments_1736243443484/work, pyparsing@==3.2.3, python-dateutil@@ file:///home/conda/feedstock_root/build_artifacts/python-dateutil_1733215673016/work, pytz@==2025.2, PyYAML@==6.0.2, pyzmq@@ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_95lsut8ymz/croot/pyzmq_1734709560733/work, referencing@==0.36.2, requests@==2.32.4, requests-toolbelt@==1.0.0, rich@==14.0.0, rpds-py@==0.26.0, scikit-learn@==1.7.0, scipy@==1.15.3, simplejson@==3.20.1, six@@ file:///home/conda/feedstock_root/build_artifacts/six_1733380938961/work, smmap@==5.0.2, sniffio@==1.3.1, soupsieve@==2.7, stack_data@@ file:///home/conda/feedstock_root/build_artifacts/stack_data_1733569443808/work, statsmodels@==0.14.4, streamlit@==1.48.0, tenacity@==9.1.2, tensorboard@==2.19.0, tensorboard-data-server@==0.7.2, tensorflow@==2.19.0, tensorflow_keras@==0.1, tensorflow-io-gcs-filesystem@==0.37.1, termcolor@==3.1.0, threadpoolctl@==3.6.0, toml@==0.10.2, tornado@@ file:///private/var/folders/k1/30mswbxs7r1g6zwn8y4fyt500000gp/T/abs_63s3osc0_1/croot/tornado_1748956943583/work, tqdm@==4.67.1, traitlets@@ file:///home/conda/feedstock_root/build_artifacts/traitlets_1733367359838/work, typing_extensions@@ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_typing_extensions_1748959427/work, typing-inspection@==0.4.1, tzdata@==2025.2, urllib3@==2.5.0, wcwidth@@ file:///home/conda/feedstock_root/build_artifacts/wcwidth_1733231326287/work, Werkzeug@==3.1.3, widgetsnbextension@==4.0.14, wrapt@==1.17.2, xxhash@==3.5.0, zipp@@ file:///home/conda/feedstock_root/build_artifacts/zipp_1749421620841/work, zstandard@==0.23.0

### Recent commits (newest first)

- add all
- changes
- Added github ingestion :)
- changes
- added github ingestion
- added clearing algo
- Merge branch 'main' of https://github.com/PvRao-29/leann-chatbots
- Delete chat.py
- Update README.md
- differences in README
- Merge branch 'main' of https://github.com/PvRao-29/leann-chatbots
- cool wbesite
- added requirements.txt
- updoots
- whoopsy
- built v0.0 webapp, and setup minimal backend
- yippee
- Made README

## Key source files (fetched from GitHub, selected and truncated for size)

### package.json

```
{
  "name": "literag-demo",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "next": "14.0.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0"
  },
  "devDependencies": {
    "@types/node": "^20.0.0",
    "@types/react": "^18.2.0",
    "@types/react-dom": "^18.2.0",
    "autoprefixer": "^10.4.16",
    "eslint": "^8.0.0",
    "eslint-config-next": "14.0.0",
    "postcss": "^8.4.31",
    "tailwindcss": "^3.3.5",
    "typescript": "^5.0.0"
  }
}

```

### requirements.txt

```
absl-py==2.3.0
altair==5.5.0
annotated-types==0.7.0
anyio==4.9.0
appnope @ file:///home/conda/feedstock_root/build_artifacts/appnope_1733332318622/work
asttokens @ file:///home/conda/feedstock_root/build_artifacts/asttokens_1733250440834/work
astunparse==1.6.3
attrs==25.3.0
beautifulsoup4==4.13.4
blinker==1.9.0
bs4==0.0.2
cachetools==6.1.0
certifi==2025.6.15
charset-normalizer==3.4.2
choreographer==1.0.9
click==8.2.1
comm @ file:///home/conda/feedstock_root/build_artifacts/comm_1733502965406/work
contourpy==1.3.2
cycler==0.12.1
debugpy @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_6a37he2v_t/croot/debugpy_1736267437603/work
decorator @ file:///home/conda/feedstock_root/build_artifacts/decorator_1740384970518/work
exceptiongroup @ file:///home/conda/feedstock_root/build_artifacts/exceptiongroup_1746947292760/work
executing @ file:///home/conda/feedstock_root/build_artifacts/executing_1745502089858/work
fastjsonschema==2.21.1
flatbuffers==25.2.10
fonttools==4.58.4
gast==0.6.0
gitdb==4.0.12
GitPython==3.1.45
google-pasta==0.2.0
grpcio==1.73.0
h11==0.16.0
h5py==3.14.0
httpcore==1.0.9
httpx==0.28.1
idna==3.10
importlib_metadata @ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_importlib-metadata_1747934053/work
ipykernel @ file:///Users/runner/miniforge3/conda-bld/ipykernel_1719845458456/work
ipython @ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_ipython_1748713870/work
ipython_pygments_lexers @ file:///home/conda/feedstock_root/build_artifacts/ipython_pygments_lexers_1737123620466/work
ipywidgets==8.1.7
jedi @ file:///home/conda/feedstock_root/build_artifacts/jedi_1733300866624/work
Jinja2==3.1.6
joblib==1.5.1
jsonpatch==1.33
jsonpointer==3.0.0
jsonschema==4.24.0
jsonschema-specifications==2025.4.1
jupyter_client @ file:///home/conda/feedstock_root/build_artifacts/jupyter_client_1733440914442/work
jupyter_core @ file:///home/conda/feedstock_root/build_artifacts/jupyter_core_1748333051527/work
jupyterlab_widgets==3.0.15
kaleido==1.0.0
keras==3.10.0
kiwisolver==1.4.8
langchain-core==0.3.66
langgraph==0.4.10
langgraph-checkpoint==2.1.0
langgraph-prebuilt==0.2.3
langgraph-sdk==0.1.70
langsmith==0.4.2
libclang==18.1.1
logistro==1.1.0
lxml==6.0.0
Markdown==3.8.2
markdown-it-py==3.0.0
MarkupSafe==3.0.2
matplotlib==3.10.3
matplotlib-inline @ file:///home/conda/feedstock_root/build_artifacts/matplotlib-inline_1733416936468/work
mdurl==0.1.2
ml_dtypes==0.5.1
namex==0.1.0
narwhals==1.46.0
nbformat==5.10.4
nest_asyncio @ file:///home/conda/feedstock_root/build_artifacts/nest-asyncio_1733325553580/work
numpy==2.1.3
opt_einsum==3.4.0
optree==0.16.0
orjson==3.10.18
ormsgpack==1.10.0
packaging==24.2
pandas==2.3.0
parso @ file:///home/conda/feedstock_root/build_artifacts/parso_1733271261340/work
patsy==1.0.1
pexpect @ file:///home/conda/feedstock_root/build_artifacts/pexpect_1733301927746/work
pickleshare @ file:///home/conda/feedstock_root/build_artifacts/pickleshare_1733327343728/work
pillow==11.2.1
platformdirs @ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_platformdirs_1746710438/work
plotly==6.2.0
prompt_toolkit @ file:///home/conda/feedstock_root/build_artifacts/prompt-toolkit_1744724089886/work
protobuf==5.29.5
psutil @ file:///private/var/folders/k1/30mswbxs7r1g6zwn8y4fyt500000gp/T/abs_10oa1k8l11/croot/psutil_1736367646006/work
ptyprocess @ file:///home/conda/feedstock_root/build_artifacts/ptyprocess_1733302279685/work/dist/ptyprocess-0.7.0-py2.py3-none-any.whl#sha256=92c32ff62b5fd8cf325bec5ab90d7be3d2a8ca8c8a3813ff487a8d2002630d1f
pure_eval @ file:///home/conda/feedstock_root/build_artifacts/pure_eval_1733569405015/work
pyarrow==21.0.0
pydantic==2.11.7
pydantic_core==2.33.2
pydeck==0.9.1
pyfiglet==1.0.3
Pygments @ file:///home/conda/feedstock_root/build_artifacts/pygments_1736243443484/work
pyparsing==3.2.3
python-dateutil @ file:///home/conda/feedstock_root/build_artifacts/python-dateutil_1733215673016/work
pytz==2025.2
PyYAML==6.0.2
pyzmq @ file:///private/var/folders/nz/j6p8yfhx1mv_0grj5xl4650h0000gp/T/abs_95lsut8ymz/croot/pyzmq_1734709560733/work
referencing==0.36.2
requests==2.32.4
requests-toolbelt==1.0.0
rich==14.0.0
rpds-py==0.26.0
scikit-learn==1.7.0
scipy==1.15.3
simplejson==3.20.1
six @ file:///home/conda/feedstock_root/build_artifacts/six_1733380938961/work
smmap==5.0.2
sniffio==1.3.1
soupsieve==2.7
stack_data @ file:///home/conda/feedstock_root/build_artifacts/stack_data_1733569443808/work
statsmodels==0.14.4
streamlit==1.48.0
tenacity==9.1.2
tensorboard==2.19.0
tensorboard-data-server==0.7.2
tensorflow==2.19.0
tensorflow-io-gcs-filesystem==0.37.1
tensorflow_keras==0.1
termcolor==3.1.0
threadpoolctl==3.6.0
toml==0.10.2
tornado @ file:///private/var/folders/k1/30mswbxs7r1g6zwn8y4fyt500000gp/T/abs_63s3osc0_1/croot/tornado_1748956943583/work
tqdm==4.67.1
traitlets @ file:///home/conda/feedstock_root/build_artifacts/traitlets_1733367359838/work
typing-inspection==0.4.1
typing_extensions @ file:///home/conda/feedstock_root/build_artifacts/bld/rattler-build_typing_extensions_1748959427/work
tzdata==2025.2
urllib3==2.5.0
wcwidth @ file:///home/conda/feedstock_root/build_artifacts/wcwidth_1733231326287/work
Werkzeug==3.1.3
widgetsnbextension==4.0.14
wrapt==1.17.2
xxhash==3.5.0
zipp @ file:///home/conda/feedstock_root/build_artifacts/zipp_1749421620841/work
zstandard==0.23.0

```

### app/page.tsx

```typescript
import { redirect } from 'next/navigation';

export default function Page() {
  redirect('/landing');
}

```

### app/layout.tsx

```typescript
import type { Metadata } from 'next'
import './globals.css'

export const metadata: Metadata = {
  title: 'LiteRAG Demo - Vector Database Comparison',
  description: 'Compare LiteRAG and Chroma vector databases - storage efficiency, speed, and AI-powered responses',
  keywords: 'LiteRAG, Chroma, vector database, RAG, AI, machine learning',
}

export default function RootLayout({
  children,
}: {
  children: React.ReactNode
}) {
  return (
    <html lang="en">
      <head>
        <link rel="preconnect" href="https://fonts.googleapis.com" />
        <link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="anonymous" />
        <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap" rel="stylesheet" />
      </head>
      <body className="antialiased">
        {children}
      </body>
    </html>
  )
}

```

### app/demo/page.tsx

```typescript
import LiteRAGDemo from '../LiteRAGDemo';

export default function DemoPage() {
  return <LiteRAGDemo />;
}

```

### app/landing/page.tsx

```typescript
"use client";

import { useState } from "react";
import Link from "next/link";

export default function LandingPage() {
  const [isMenuOpen, setIsMenuOpen] = useState(false);

  return (
    <div className="min-h-screen bg-black text-white overflow-hidden">
      {/* Navigation */}
      <nav className="fixed top-0 left-0 right-0 z-50 bg-black/80 backdrop-blur-sm border-b border-white/10">
        <div className="max-w-7xl mx-auto px-6 py-4">
          <div className="flex items-center justify-between">
            <div className="text-2xl font-bold tracking-tight">
              <span className="text-white">#</span>
              <span className="text-gray-300">LiteRAG</span>
            </div>
            
            <div className="hidden md:flex items-center space-x-8">
              <Link href="/" className="text-white text-sm font-medium flex items-center">
                <span className="w-1 h-1 bg-white rounded-full mr-2"></span>
                Home
              </Link>
              <Link href="/demo" className="text-gray-400 hover:text-white text-sm font-medium transition-colors">
                Demo
              </Link>
              <Link href="/docs" className="text-gray-400 hover:text-white text-sm font-medium transition-colors">
                Docs
              </Link>
              <button className="border border-white/20 px-4 py-2 text-sm font-medium hover:bg-white/5 transition-colors">
                Contact
              </button>
            </div>

            {/* Mobile menu button */}
            <button 
              className="md:hidden text-white"
              onClick={() => setIsMenuOpen(!isMenuOpen)}
            >
              <svg className="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
                <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M4 6h16M4 12h16M4 18h16" />
              </svg>
            </button>
          </div>
        </div>
      </nav>

      {/* Main Content */}
      <div className="pt-20 min-h-screen flex items-center">
        <div className="max-w-7xl mx-auto px-6 w-full">
          <div className="grid grid-cols-1 lg:grid-cols-3 gap-12 items-center">
            
            {/* Left Side - Main Heading */}
            <div className="lg:col-span-1">
              <h1 className="text-5xl lg:text-7xl font-light leading-tight tracking-tight">
                Rethinking The Science of 
                <span className="block font-bold">Vector Search</span>
              </h1>
            </div>

            {/* Center - Abstract Visual */}
            <div className="lg:col-span-1 flex justify-center">
              <div className="relative">
                {/* Abstract data visualization */}
                <div className="w-32 h-96 relative">
                  {/* Vertical helix-like structure */}
                  <div className="absolute left-1/2 top-0 w-px h-full bg-gradient-to-b from-white/20 via-white/60 to-white/20 transform -translate-x-1/2"></div>
                  
                  {/* Horizontal data lines */}
                  {Array.from({ length: 40 }).map((_, i) => (
                    <div
                      key={i}
                      className="absolute bg-white/30 h-px"
                      style={{
                        left: `${50 + Math.sin(i * 0.3) * 20}%`,
                        top: `${i * 2.5}%`,
                        width: `${20 + Math.sin(i * 0.2) * 10}px`,
                        opacity: 0.3 + Math.sin(i * 0.1) * 0.3
                      }}
                    />
                  ))}
                  
                  {/* Floating particles */}
                  {Array.from({ length: 15 }).map((_, i) => (
                    <div
                      key={i}
                      className="absolute w-1 h-1 bg-white/40 rounded-full"
                      style={{
                        left: `${30 + Math.sin(i * 0.5) * 40}%`,
                        top: `${20 + i * 5}%`,
                        animationDelay: `${i * 0.2}s`
                      }}
                    />
                  ))}
                </div>
              </div>
            </div>

            {/* Right Side - Description */}
            <div className="lg:col-span-1">
              <div className="border-t border-white/20 pt-8">
                <h2 className="text-2xl font-light mb-6">Reconstructing Hierarchical Knowledge</h2>
                
                <div className="space-y-6 text-gray-300 leading-relaxed">
                  <p>
                    <strong className="text-white">LiteRAG</strong> is a
                    <strong className="text-white"> storage-optimized approximate nearest neighbor (ANN) </strong>
                    retrieval engine designed for <strong className="text-white">edge intelligence</strong> and
                    distributed environments.
                  </p>

                  <p>
                    It integrates a <strong className="text-white">lightweight graph-based index</strong> with an
                    <strong className="text-white"> adaptive on-demand recomputation layer</strong>, delivering
                    <strong className="text-white"> high-recall retrieval</strong> at <strong className="text-white">minimal storage cost</strong>
                    — even under constrained compute conditions.
                  </p>

                  <p>
                    Benchmarks show that LiteRAG compresses index size to
                    <strong className="text-white"> under 4% of the raw dataset</strong>, achieving up to
                    <strong className="text-white"> 50× lower storage footprint</strong> than conventional indexes, while
                    preserving <strong className="text-white">hierarchical navigability</strong> across
                    <strong className="text-white"> multi-layer embeddings</strong> for efficient retrieval on the edge.
                  </p>
               
[truncated — 1748 more characters]
```

### postcss.config.js

```javascript
module.exports = {
  plugins: {
    tailwindcss: {},
    autoprefixer: {},
  },
}

```

### next.config.js

```javascript
/** @type {import('next').NextConfig} */
const nextConfig = {
  experimental: {
    appDir: true,
  },
}

module.exports = nextConfig

```

### next-env.d.ts

```typescript
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.

```

### tailwind.config.js

```javascript
/** @type {import('tailwindcss').Config} */
module.exports = {
  content: [
    './pages/**/*.{js,ts,jsx,tsx,mdx}',
    './components/**/*.{js,ts,jsx,tsx,mdx}',
    './app/**/*.{js,ts,jsx,tsx,mdx}',
    './*.{js,ts,jsx,tsx,mdx}',
  ],
  theme: {
    extend: {
      animation: {
        'fade-in': 'fadeIn 0.5s ease-in-out',
        'slide-up': 'slideUp 0.3s ease-out',
        'pulse-slow': 'pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite',
      },
      keyframes: {
        fadeIn: {
          '0%': { opacity: '0' },
          '100%': { opacity: '1' },
        },
        slideUp: {
          '0%': { transform: 'translateY(10px)', opacity: '0' },
          '100%': { transform: 'translateY(0)', opacity: '1' },
        },
      },
      backgroundImage: {
        'gradient-radial': 'radial-gradient(var(--tw-gradient-stops))',
        'gradient-conic': 'conic-gradient(from 180deg at 50% 50%, var(--tw-gradient-stops))',
      },
    },
  },
  plugins: [],
}

```

[3 more indexed source files omitted to keep this export small. The full file list is in the Codebase structure section above.]