Installation
Add Exograph to your deps:
def deps do
[
{:exograph, "~> 0.7"}
]
endDuckDB through QuackDB is the default local backend. Postgres is also supported; ParadeDB's pg_search extension is optional for BM25-ranked Postgres search.
The Mix tasks start a managed QuackDB server automatically when --quackdb-uri is omitted. Use --duckdb-database to choose the DuckDB file path. For large Hex.pm corpora, prefer the sharded DuckDB mode shown below, which starts managed shard servers for you.
Index your project
Point Exograph at your source directories with --migrate to create the tables:
mix exograph.index --migrate libTo also index tests and set a custom prefix:
mix exograph.index --migrate --prefix exograph lib testFrom Elixir:
{:ok, index} =
Exograph.index("lib",
repo: MyApp.Repo,
prefix: "exograph",
migrate?: true
)migrate?: true runs Exograph's Ecto migrations under the configured prefix.
Re-running is safe; migrations are idempotent.
Search from CLI
Structural search — finds fragments matching an ExAST pattern:
mix exograph.search 'Repo.get!(_, _)' --migrate libText search:
mix exograph.search 'TODO' --text --migrate libRegex search:
mix exograph.search 'Repo\.get!\(' --regex --migrate libStructural search with predicates:
mix exograph.search 'def _ do ... end' \
--migrate lib \
--contains 'Repo.transaction(_)' \
--not-contains 'IO.inspect(_)'Start the web UI
mix exograph.web --prefix exograph --port 4200Open http://localhost:4200. The editor supports structural, text, and regex
modes. Pass --database-url or set EXOGRAPH_DATABASE_URL when not using an
application repo:
EXOGRAPH_DATABASE_URL=postgres://localhost/mydb \
mix exograph.web --prefix exograph --port 4200Index Hex.pm packages
Download and index packages straight from Hex.pm with the recommended DuckDB sharded backend:
mix exograph.index.hex \
--mode top --limit 1000 \
--duckdb-shards 4 \
--duckdb-threads 1 \
--manifest-path priv/exograph/hex.etfThis streams package sources into independent DuckDB shard files. Already-indexed packages are skipped automatically inside each shard.
Watch progress live by adding --web:
mix exograph.index.hex --mode latest --concurrency 8 --web --port 4200The dashboard at http://localhost:4200/progress shows per-package status,
rate, and ETA.
Modes:
latest— most recent version of each package (default)top --limit N— top N most-downloaded packagesall— every published version
See Package Indexing for scale numbers and full options.
Next steps
- Querying — structural patterns, text/regex search, planning
- DSL — join code facts with structural predicates
- Mix Tasks — all CLI options
- DuckDB and QuackDB — recommended backend, sharding, manifests, tuning
- Postgres and ParadeDB — Postgres backend tuning
- Backend benchmarks — current DuckDB/Postgres benchmark methodology and results