|
| 1 | +# Contributing to Lance Data Viewer |
| 2 | + |
| 3 | +Thanks for your interest in contributing. This document covers what the |
| 4 | +project is, the design constraints that shape it, and how to propose changes. |
| 5 | + |
| 6 | +## What This Project Is |
| 7 | + |
| 8 | +Lance Data Viewer is a read-only, mount-and-go web UI for browsing Lance and |
| 9 | +LanceDB tables. The intended flow is: |
| 10 | + |
| 11 | +1. Point a Docker container at a directory of Lance files. |
| 12 | +2. Open a browser. |
| 13 | +3. Browse. |
| 14 | + |
| 15 | +There is no setup, no database to configure, no writes. The viewer is meant |
| 16 | +for local development, data inspection, and sanity-checking datasets produced |
| 17 | +by other pipelines. |
| 18 | + |
| 19 | +## Design Constraints |
| 20 | + |
| 21 | +A few constraints are load-bearing. They are the reason the project is small, |
| 22 | +fast to start, and easy to drop into a Docker Compose stack next to other |
| 23 | +services. Proposals that move away from them need a strong justification and |
| 24 | +are best discussed in an issue before code is written. |
| 25 | + |
| 26 | +### Vanilla JS, no build step |
| 27 | + |
| 28 | +The frontend is plain JavaScript, HTML, and CSS served directly from the |
| 29 | +container. There is no Webpack, Vite, esbuild, `tsc`, or `npm install` in the |
| 30 | +build path. This keeps the container image small, the contributor onboarding |
| 31 | +bar low, and the edit-refresh loop instant. |
| 32 | + |
| 33 | +Proposals to introduce TypeScript, React, Vue, Svelte, jQuery, or a CSS |
| 34 | +framework such as Tailwind fall under this constraint. |
| 35 | + |
| 36 | +### GET-only, stateless API |
| 37 | + |
| 38 | +Every endpoint in `backend/app.py` is a GET. There are no sessions, no |
| 39 | +server-side state between requests, and no POST/PUT/DELETE surface. The |
| 40 | +viewer's single job is to read Lance files and serialize them to JSON. |
| 41 | + |
| 42 | +Proposals that introduce POST endpoints, server-side query state, or filtering |
| 43 | +that accepts raw SQL from the client fall under this constraint. |
| 44 | + |
| 45 | +### No metadata database |
| 46 | + |
| 47 | +The Lance files in the mounted directory are the only source of truth. The |
| 48 | +viewer does not maintain a separate SQLite, DuckDB, or Redis alongside them. |
| 49 | +Adding one would introduce a lifecycle (migrations, eviction, consistency) |
| 50 | +that conflicts with the mount-and-go model. |
| 51 | + |
| 52 | +### No in-app authentication |
| 53 | + |
| 54 | +There is no login, no token check, and no RBAC. Deployments that need access |
| 55 | +control are expected to run the container on localhost or behind a reverse |
| 56 | +proxy (Nginx, Traefik, Caddy) that handles auth at the edge. |
| 57 | + |
| 58 | +### Read-only access |
| 59 | + |
| 60 | +The viewer never writes to the mounted Lance directory. The examples in the |
| 61 | +README mount `/data` with `:ro`, and the code path contains no write |
| 62 | +operations. This is deliberate: the viewer should be safe to point at |
| 63 | +production data without any fear of corruption. |
| 64 | + |
| 65 | +## Proposing Changes |
| 66 | + |
| 67 | +For small bug fixes and direct improvements, opening a PR is fine. For |
| 68 | +anything that touches the design constraints above, adds a new dependency, or |
| 69 | +meaningfully changes the architecture, please open an issue first so the |
| 70 | +approach can be discussed before code is written. |
| 71 | + |
| 72 | +Recent examples of the "issue first" path: |
| 73 | + |
| 74 | +- Adding media previews for columns that reference external assets: see the |
| 75 | + approach discussion in #29. |
| 76 | +- Replacing the vanilla JS frontend with a framework or toolkit: see #5 |
| 77 | + (TypeScript) and #39 (jQuery + DataTables + DuckDB) for prior discussions of |
| 78 | + why this direction does not fit. |
| 79 | + |
| 80 | +## Where To Start |
| 81 | + |
| 82 | +The improvement plan lives in the issue tracker. A few good starting points |
| 83 | +for new contributors: |
| 84 | + |
| 85 | +- Issues labeled `bug` for direct fixes. |
| 86 | +- Issues labeled `documentation` for low-risk contributions while learning the |
| 87 | + codebase. |
| 88 | +- Issues labeled `enhancement` for feature work. Read the design constraints |
| 89 | + above first. |
| 90 | + |
| 91 | +## Development Workflow |
| 92 | + |
| 93 | +```bash |
| 94 | +# Build with a specific Lance version (default: 0.29.2) |
| 95 | +docker build -f docker/Dockerfile \ |
| 96 | + --build-arg LANCEDB_VERSION=0.29.2 \ |
| 97 | + -t lance-data-viewer:dev . |
| 98 | + |
| 99 | +# Run with your data |
| 100 | +docker run --rm -p 8080:8080 -v $(pwd)/data:/data:ro lance-data-viewer:dev |
| 101 | + |
| 102 | +# Open the UI |
| 103 | +open http://localhost:8080 |
| 104 | +``` |
| 105 | + |
| 106 | +No frontend build step. Edit files in `web/vanilla/` and reload the browser. |
0 commit comments