# Getting started

This page takes you from nothing to a first answer by installing ahto, crawling a repository, asking it a question in SQL and opening the web app.

## Install

One line installs the newest release; see `scripts/get.sh --help` for the options:

```sh
curl -fsSL https://ahto.dev/install.sh | sh
```


To build it from source instead, use a checkout:


```sh
mise install    # the pinned tools, then builds ahto into ~/.local/bin (https://mise.jdx.dev)
ahto doctor     # checks Git, the lake directory and DuckDB
```

You need Git 2.42.0 or newer on your `PATH` and a C compiler: ahto uses cgo for
DuckDB and the tree-sitter grammars. `ahto doctor` says what is missing or too old.

The build writes one binary, `dist/ahto`, with DuckDB and the parsers inside, and copies
it to `~/.local/bin/ahto` so `ahto` runs from any directory. Set `AHTO_BIN_DIR` to install
it somewhere else; it never uses sudo, and it says so when the directory is not on your
`PATH`. `mise run install:global` builds and installs it again after a change; `mise run
build` only writes `dist/ahto`.

## First crawl

```sh
ahto crawl https://github.com/golang/example
```

```text
REPOSITORY                 STATUS     REFS  COMMITS  TREES  BLOBS  TAGS  SNAPSHOT      RUN
github.com/golang/example  published  1     76       225    220    0     480ac9e41e15  01a22cb2-f2a6-7747-a1c5-2cbc7b04caaa
```

`RUN` is the id of this crawl.

That took about 2 seconds. Run the same command again and the status is `unchanged`, with 0
new objects. A crawl that is stopped halfway leaves the lake as it was before the crawl.

After it publishes, a crawl also derives the read models and parses the new source files
([parsing](/docs/parsing)), so the symbols and the call graph are there when it ends.

## Choosing what to crawl

By default ahto crawls the default branch. Flags choose more:

```sh
ahto crawl --all-branches <url>              # every branch
ahto crawl --branch 'release-*' <url>        # branches matching a glob
ahto crawl --tag 'go1.23.*' <url>            # tags matching a glob
ahto crawl --depth 1 <url>                   # only the newest commit; a later full crawl fills in the rest
ahto crawl --dry-run <url>                   # list the refs it would crawl, fetch nothing
ahto crawl --no-parse <url>                  # leave the parse stage out of this crawl
ahto crawl ~/src/my-project                  # a local repository
```

`ahto crawl --help` lists every flag. Several URLs in one command are crawled one after
another. For a repository that needs a login, see [private repositories](/docs/private-repositories).

## A first question

```sh
ahto query sql "select author_name, count(*) as commits
                from commits group by 1 order by 2 desc limit 10"
ahto files                        # the files on the default branch
ahto history README.md            # the commits that changed a file, newest first
```

[Querying](/docs/querying) has the tables, the macros and the output formats.

## The gateway and the web app

```sh
ahto serve                        # then open http://127.0.0.1:8080
ahto serve --no-ui                # the gateway alone
mise run dev:all                  # for work on ui/app: the gateway, then the web app on http://127.0.0.1:8081
```

`serve` runs the gateway on one port, on 127.0.0.1 only, with no sign-in (unless
the node is an authority member; see [when sign-in applies](/docs/identity#when-it-applies)): MCP for
coding agents, and REST, gRPC, JSON-RPC, GraphQL and more for programs.
[The gateway](/docs/gateway) explains each surface. To give a coding agent the lake as MCP
tools, point it at `http://127.0.0.1:8080/mcp` while `serve` runs. An agent opened in this
repository finds it already (see [Agents in this repository](/docs/gateway#agents-in-this-repository));
`mise run mcp:add` registers it in Claude Code for every other folder.

The web app (code browser, 3D city, SQL workbench, security pages and these docs) is built
into the released binary, so `ahto serve` answers it at `http://127.0.0.1:8080`, with every
API also below `/api` for it ([the web app](/docs/gateway#the-web-app)). The gateway's own paths
(`/mcp`, `/healthz`, `/openapi.json`, the `/v1` routes) stay at the root. `--no-ui` leaves the
web app out. A binary built in the checkout embeds the web app when `ui/app/dist` holds a
build (`mise run ui:setup` once, then `mise run ui:build`, then `mise install`). To work on
the web app itself, `mise run dev:all` starts the gateway and the web app's dev server, and
stops both on Ctrl-C.

A public demo with Linux, Go, Rust, PHP and Node runs at <https://demo.ahto.dev>.