Codeharbor Repo Map
Map a repository: languages, entry points and which folders import which.
How it works
Give a public GitHub address or upload a repository as ZIP or .tar.gz and get its architecture at a glance: the language mix, likely entry points, top-level folders and a diagram of the imports between folders for JavaScript/TypeScript, Python and Go — as an SVG, a table and Mermaid text.
- Imports are read statically, nothing is run: JavaScript/TypeScript (also <script> blocks of .vue/.svelte) with Codeharbor’s own tokenizer — import … from, import(), export … from, require(); Python line by line — import a.b, from .x import y, relative levels; Go — import lines and blocks, with module paths from every go.mod. At most 512 KB and 400 imports per file are read.
- Relative imports are resolved like Node and TypeScript (extensions .ts/.tsx/.js/…, index files, .js written for .ts files, the common @/ → src/ alias); Python modules from the repository root, src/, lib/ and python/; Go packages from their folder. Everything else counts as an external package or a standard-library module.
- File imports are summed per folder at the chosen level (automatic = the smallest level with at least four folders). The diagram is a layered layout: cycles are broken for layering, folders are placed in columns by longest path (importers left), then ordered by six barycentre sweeps; arrows point from the importing folder to the imported one, import cycles are dashed. At most 40 folders are drawn; smaller ones are merged into “(other)”.
- The Mermaid text is checked by re-parsing it with Sketchboard’s Mermaid parser (same nodes, labels and edges). Entry points come from package.json (main, module, exports, bin), pyproject scripts, __main__.py and if __name__ == "__main__", Go package main + func main, Rust src/main.rs and conventional names such as src/index.ts.
Sources
- Mermaid flowchart syntax (Mermaid)
- package.json (npm Docs)
- Writing your pyproject.toml (Python Packaging User Guide)
- Downloading source code archives (GitHub Docs)
Part of Codeharbor
-
Codeharbor Coding IDE
A coding IDE: edit, preview and run web projects safely, then share them.
How to see a repository's architecture — languages, entry points and folder imports
Map a public GitHub repository or a ZIP: language mix, entry points, top-level folders and a diagram of which folders import which, with Mermaid export.
What it is for
When you open an unfamiliar codebase, the first questions are always the same: what is it written in, where does it start, and which parts depend on which? This tool answers them from the files. Give it a public GitHub address or upload the repository as .zip or .tar.gz, and it returns:
- the language mix by files, lines and size;
- likely entry points (from
package.json,pyproject.toml,__main__.py, Gofunc main, Rustsrc/main.rsand common names likesrc/index.ts); - the top-level folders with a guessed purpose;
- a diagram of imports between folders, as an SVG, as a table and as Mermaid text you can paste into documentation.
Imports are read statically for JavaScript/TypeScript, Python and Go — nothing is run. Other languages still appear in the language mix and folder list, but without import arrows. The Codeharbor app shows the same map for any open project.
Worked example
The first example uses the Tidewatch sample repository (uploaded ZIP). The tool reports:
tidewatch-main: 22 files (TypeScript 79.7%, Python 20.3%), 6 folders at level 2 with 6 import connections and 1 cycle, 3 entry points.
The automatic folder level picked level 2, because level 1 has only three code folders. The table lists six connections, for example scripts → scripts/lib (2 imports), src → src/core (2) and tests → src/core (1). One cycle is marked: src ⇄ src/api, because src/index.ts imports the API server and the server imports src/config.ts back. In the diagram that arrow is dashed red.
The entry points are src/cli.ts (the bin of package.json and a conventional name), scripts/fetch_stations.py (it has if __name__ == "__main__") and src/index.ts.
The second example sets Top-level folders only. Now only three folders remain and a single connection, tests → src: imports inside src no longer cross a folder border at that level.
How to read the result
- Arrows point from the importing folder to the folder it imports. Line thickness grows with the number of imports.
- Import cycles — folders that import each other directly or in a loop. They are not errors, but they make code harder to split.
- External packages and standard modules — what the code imports from outside the repository, e.g.
fastifyin two files. - Mermaid flowchart — checked by parsing it again with Sketchboard's Mermaid parser; the assumptions state whether nodes and edges matched.
- Purpose (guessed) — from common folder names like
src,tests,docs,cmdorinternal.
Tips and common mistakes
- If the diagram is a single box, try a deeper folder level; if it is crowded, go shallower. At most 40 folders are drawn, the rest are merged into "(other)".
- Leave out test or example folders with Leave out (
tests/, examples/) to see the production structure. - A warning about unmatched relative imports usually means generated files or path aliases; only the common
@/→src/alias is followed. - The
.svgdownload works in documents and slides; the.mmdfile renders on GitHub and in Mermaid editors.
FAQ
Which languages get import arrows?
JavaScript and TypeScript (also the script blocks of Vue and Svelte files), Python and Go. Others are counted but not parsed for imports.
Does it run or install anything?
No. Files are only read as text; there is no npm install and no code execution.
Why does a Python import show up as an external package?
Modules are resolved from the repository root, src/, lib/, python/ and the importing script's own folder. A package that lives elsewhere looks external.
Is the diagram the same as a call graph?
No. It shows which folders import which files, not which functions call each other at run time.
Guide last updated:
For scripts and AI agents
- JSON API:
POST https://codeharborrepomap.usefulweb.app/api/v1/calculate(same calculation as this page) - Interface description: OpenAPI 3.1 · AI guide: llms.txt
- MCP server (Streamable HTTP):
https://codeharborrepomap.usefulweb.app/mcp· tool namecodeharbor_repo_map
Example request
curl -s -X POST https://codeharborrepomap.usefulweb.app/api/v1/calculate \
-H 'content-type: application/json' \
-d '{…see OpenAPI examples…}'