Ollama architecture.
Ollama is a tool for running large language models locally. Nodeway mapped the ollama/ollama repository at commit 0541418, from 29 November 2026, and found 774 source files, 9,578 functions, classes and components, 80 routes and 4 database tables. This page is drawn from that map.
- Source files
- 774
- Functions and classes
- 9,578
- Confirmed calls
- 18,988
- Routes
- 80
- Tables
- 4
How the code is laid out
Most of it is Go: 626 files of 774, followed by TypeScript (82), C/C++ (50) and Shell (9).
The repository is split into 29 packages: folders with their own manifest, such as a package.json, pyproject.toml or go.mod. The largest are mlxrunner (172 files), app/ui/app (84 files), mlx (83 files), cmd (52 files), create (35 files) and compatmigrate (32 files).
These are its top-level folders by number of source files, with 1 more file at the root. The biggest ones show their own largest folders underneath.
- mlxrunner/package172 files8 routes
- model/118 files
- nn/8 files
- cache/7 files
- tokenizer/7 files
- xgrammar/5 files
- batch/1 file
- app/152 files29 routes · 4 tables
- ui/88 files29 routes
- cmd/app/18 files
- tools/8 files
- mlx/package83 files
- include/mlx/c/29 files
- mlxthread/6 files
- generator/1 file
- model/58 files
- renderers/33 files
- parsers/25 files
- cmd/package52 files
- launch/28 files
- tui/6 files
- bench/2 files
- create/package35 files
- compatmigrate/package32 files
- server/package30 files43 routes
- discover/package23 files
- llm/package23 files
- internal/15 files
- proxy/6 files
- decisiontest/3 files
- onboarding/2 files
- readline/package11 files
- fs/10 files
- gguf/8 files
- safetensors/1 file
- util/bufioutil/1 file
- decision/package9 files
Where the code starts
Nodeway looked for files that define a main function, and for files named like a starting point (main, server, app, cli and similar) that at most one other file imports, then for index files that nothing imports. Ranked that way, then by how many files each one reaches through its imports:
| File | Reaches |
|---|---|
| app/ui/app/src/main.tsx | 10 files |
| app/cmd/app/app.godefines main | 8 files |
| llm/server.go | 6 files |
| mlxrunner/server.go | 6 files |
| cmd/bench/bench.godefines main | 1 file |
| main.godefines main | 1 file |
Routes
Nodeway found 80 routes and linked 78 to the function that handles them. They by HTTP method: POST 40, GET 24, HEAD 5, DELETE 4, ANY 3, PUT 2. Most are under server (43), app/ui (29) and mlxrunner (8).
Some of them
| Route | Method |
|---|---|
| /Handler · app/ui/ui.go | OPTIONS |
| /GenerateRoutes · server/routes.go | HEAD |
| /v1/scorescoreHandler · mlxrunner/server.go | POST |
| /v1/responsesChatHandler · server/responses_compact.go | POST |
| /Handler · app/ui/ui.go | GET |
| /Handler · app/ui/ui.go | PUT |
| /Handler · app/ui/ui.go | POST |
| /Handler · app/ui/ui.go | PATCH |
Data model
Nodeway found 4 database tables, defined with SQL schema files. Code in the repository reads or writes 4 of them. The most used:
| Table | Used by |
|---|---|
| settings16 columns · app/store/schema.sql | 9 read25 write |
| messages13 columns · links to chats · app/store/schema.sql | 2 read2 write |
| chats3 columns · app/store/schema.sql | 1 read2 write |
| tool_calls6 columns · links to messages · app/store/schema.sql | 0 read2 write |
One request, traced
Nodeway followed GET /api/v1/chats from its route to the code that handles it, then along confirmed calls until it reached the settings table.
- GET /api/v1/chatsroute · app/ui/ui.go
- listChatsmethod · app/ui/ui.go:526
- Chatsmethod · app/store/store.go:474
- ensureDBmethod · app/store/store.go:221
- migrateCloudSettingmethod · app/store/store.go:281
- getAirplaneModemethod · app/store/database.go:1306
- settingstable · read here
The most-called code
Ranked by how many different functions call each one, counting only calls the analyzer could confirm from the code. These are often the helpers worth reading first.
| Function | Callers |
|---|---|
| Dimmethod · mlx/array.go | 246 |
| AsTypemethod · mlx/ops.go | 172 |
| DTypemethod · mlx/array.go | 157 |
| mlxCheckfunction · mlx/mlx.go | 147 |
| Forwardmethod · mlx/nn.go | 133 |
| Reshapefunction · mlx/ops_extra.go | 120 |
| Slicefunction · mlx/slice.go | 117 |
| Forwardmethod · mlxrunner/nn/linear.go | 112 |
Open this repo in Nodeway
Nodeway is a desktop app that draws this map on your own computer, so you can click into any folder, read the code beside the map and trace a request yourself. Clone the repository:
git clone https://github.com/ollama/ollama.git- Install Nodeway for macOS, Windows or Linux: the getting started guide has every installer.
- Open the cloned folder. The first map is drawn on your machine and nothing is uploaded.
- Search for
Dimand trace what it calls, or pick a route and follow it to the database.
New to reading a codebase this size? See how to understand a large codebase and how to read a call graph.
Questions
What language is Ollama written in?
Mostly Go: 626 of its 774 source files at commit 0541418, then TypeScript with 82.
Where does the Ollama code start?
The entry point that reaches the most code is app/ui/app/src/main.tsx, which leads to 10 files through its imports.
How many routes does Ollama have?
Nodeway found 80 routes, 78 of them linked to a handler. The most are under server.
What database tables does Ollama use?
4 tables, defined with SQL schema files. The most used are settings, messages and chats.
How this page was made
Generated from a map Nodeway's analyzer (version 18) made of ollama/ollama at commit 0541418, committed on 29 November 2026. Tests, dependencies and build output are mostly left out. A call counts only when the analyzer could confirm its target from the code, so real totals are higher. The project will have changed since.