Skip to main content
Glama
README.md
<p align="center">
  <img src="./assets/logo-devmap.png" alt="DevMap Logo" width="180" />
</p>

<h1 align="center">DevMap</h1>

> The first command you run after git clone.


<p align="center">
  <img src="https://img.shields.io/github/stars/itsflaid/devmap?style=flat-square" alt="Stars" />
  <img src="https://img.shields.io/github/license/itsflaid/devmap?style=flat-square" alt="License" />
  <img src="https://img.shields.io/badge/node-%3E%3D22-green?style=flat-square" alt="Node.js" />
  <img src="https://img.shields.io/badge/status-MVP-2EE6D6?style=flat-square" alt="Status" />
</p>

<p align="center">
Analyze once. Reuse context everywhere.
Structured project intelligence for developers and AI agents.
</p>

Built by [Muhammad Fadil (@itsflaid)](https://github.com/itsflaid) · [www.flaid.my.id](https://www.flaid.my.id)

---

## The Problem

Before doing real work, developers and AI agents need context.

They open files, trace dependencies, follow feature flows, and rebuild understanding of the project.

The process repeats every time you:

- start a new session
- switch AI tools
- bring in a new agent
- revisit a project weeks later

The code stays the same.

The context gets rebuilt again and again.

---

## The Solution

DevMap turns project knowledge into reusable context.

It analyzes your codebase and generates structured project intelligence that can be reused across developers, sessions, and AI agents.

Instead of rediscovering the codebase every time, agents and developers start with:

- An operation map: what each endpoint, page and action checks, reads and writes
- Project overview and entry points
- Critical files
- Feature maps
- Architecture summaries
- Onboarding guidance

Analyze once.

Reuse everywhere.

---

## Operation Map

Before changing what a request does, ask for its card. This one is from a real
Next.js project:

```txt
$ devmap trace "POST /api/snippets/[id]/copy"

POST /api/snippets/[id]/copy
  file     apps/web/src/app/api/snippets/[id]/copy/route.ts:5
  access   requireUserId (apps/web/src/lib/apiAuth.ts) -> 401
  reads    Snippet.findFirst [where id, userId]  :10
  writes   Snippet.update [where id]  :16
  errors   401, 404
  used by  apps/web/src/components/snippet/shared/CopyButton.tsx, ...
  screens  /dashboard, /explore, /share/[shareId], /workspaces/[id]
```

`devmap data <Model>` answers the other direction: every operation that reads or
writes a model, with the filter keys of each query.

Cards come from static reading of JavaScript and TypeScript. They name what was
seen, with a file and line, and say where reading stopped. `no check found` does
not mean a route is public: global middleware and hooks are only noted. Coverage
and limits are in [docs/commands.md](./docs/commands.md#devmap-trace).

---

Without DevMap:

```txt
Repository
   ↓
Claude explores files
   ↓
Context rebuilt

Repository
   ↓
Codex explores files
   ↓
Context rebuilt

Repository
   ↓
New session
   ↓
Context rebuilt
```

With DevMap:

```txt
Repository
   ↓
devmap analyze
   ↓
Shared Project Context
   ├─ Claude Code
   ├─ OpenAI Codex
   ├─ Gemini CLI
   ├─ Cursor
   ├─ Windsurf
   └─ Future Agents
```

---

## How It Works

```txt
devmap init
  → configures provider
  → generates DEVMAP.md
  → prepares project

devmap analyze
  → runs static analysis
  → builds the operation map
  → builds project intelligence
  → generates navigation files
  → generates reusable context

devmap trace / devmap data
  → answer one question from that context

Generated Context
  → reusable across sessions
  → reusable across agents
  → reusable across developers
```

---

## Generated Files

| File                      | Role                            |
| ------------------------- | ------------------------------- |
| `DEVMAP.md`               | DevMap project documentation    |
| `AGENTS.md`               | Agent instructions              |
| `.devmap/index.json`      | Agent entry point               |
| `.devmap/features/*.json` | Feature-level navigation        |
| `.devmap/snapshot.json`   | Complete project intelligence, including the operation map |

Recommended navigation order for agents:

```txt
index.json
   ↓
devmap trace / devmap data
   ↓
the files and lines they name
   ↓
feature maps, then snapshot.json, when the map does not cover the task
```

The snapshot remains the complete project context and can also be copied into web-based AI tools when needed.

---

## For AI Agents

DevMap provides reusable project context that works across tools.

Instead of exploring a repository from scratch, agents start with generated project intelligence.

Supported workflows include:

- Claude Code
- OpenAI Codex
- Gemini CLI
- Cursor
- GitHub Copilot
- etc.

Without DevMap:

```txt
Agent
   ↓
Explore repository
   ↓
Trace dependencies
   ↓
Guess architecture
   ↓
Start task
```

With DevMap:

```txt
Agent
   ↓
index.json
   ↓
devmap trace / devmap data
   ↓
named files and lines
   ↓
Start task
```

One analysis.

Reusable across sessions, tools, and agents.

---

## MCP Server

Run DevMap as an [MCP](https://modelcontextprotocol.io) server and agents can
query the project map with tool calls instead of reading a dumped context file.

```bash
# Claude Code
claude mcp add devmap -- npx -y @flaid/devmap mcp
```

```json
{
  "mcpServers": {
    "devmap": { "command": "npx", "args": ["-y", "@flaid/devmap", "mcp"] }
  }
}
```

`devmap init --mcp opencode,claude,cursor` writes this entry for you
(`opencode.json`, `.mcp.json`, `.cursor/mcp.json`) and merges into an existing
file without touching other servers. Interactive `devmap init` offers it too.

The server is read-only and static by default (no AI provider is contacted unless
you start it with `--allow-ai`).

| Tool | Answers |
| ---- | ------- |
| `devmap_overview` | What is this project? Entry points, critical files, features, flows |
| `devmap_trace` | What does this endpoint, page or action check, read, write and answer? |
| `devmap_data` | Which operations read and write this model? |
| `devmap_map` | How is this feature or file wired? |
| `devmap_flow` | How does this request or feature work end to end? |
| `devmap_routes` | Which pages and API routes exist? |
| `devmap_impact` | What breaks if I change this file? |
| `devmap_find` | Where is the code for this concept? |
| `devmap_analyze` | Refresh the snapshot when it is stale |
| `devmap_explain` | Explain this file, feature or function (needs `--allow-ai`) |

Every answer says whether the snapshot is stale. Setup for Claude Code, Cursor,
opencode and Codex, plus the privacy model, is in [docs/mcp.md](./docs/mcp.md).

---

## Vision

DevMap is not an AI coding assistant.

AI coding assistants help write code.

DevMap helps developers and AI agents understand how codebases are organized, how features connect, and where work should begin.

Use DevMap to understand the project.

Use your preferred AI tool to change it.

> DevMap is a shared project context layer for developers and AI agents.

---

## Supported Stacks

### Full support — framework detection + route mapping

- Next.js (App Router and Pages Router)
- Astro
- Nuxt
- SvelteKit
- Remix
- React Router v7 (framework mode)
- TanStack Router and TanStack Start
- Expo Router
- SolidStart
- Qwik City
- Angular
- Express
- Fastify
- Hono
- Elysia
- Koa
- AdonisJS
- NestJS

### SPA client-side routing — routes read from the client router

- React (Create React App, Vite) — React Router `<Route>` trees and `createBrowserRouter`, TanStack Router code-based routes
- Vue — Vue Router route arrays
- Svelte — `svelte-spa-router` maps

### Operation map

Endpoints, pages and server actions of the frameworks above, plus tRPC procedures.
JavaScript and TypeScript only.

### Databases

| Database layer | Schema (entities) | Reads and writes in the operation map |
| --- | --- | --- |
| Prisma | Fields and relations | Yes |
| Drizzle | Columns and foreign keys | Yes |
| TypeORM | Detected | Repository calls |
| Supabase | Detected | `.from()` queries |
| Raw SQL (`pg`, `mysql2`, `better-sqlite3`) | Table names | Listed without table names (Prisma raw queries) |
| Mongoose | Detected | No |

### Planned

- PHP (Laravel)
- Python, Go, Java, Rust, Dart, C# 

---

## AI Provider Setup

DevMap is free and open source.

The API key is optional. Static analysis, the generated files and the MCP server work without one; AI-written narration and `devmap explain` need a provider key. DevMap uses Groq by default — analysis runs on free-tier infrastructure.

| Provider                       | Status  |
| ------------------------------- | ------- |
| Groq                            | MVP     |
| OpenRouter                      | MVP     |
| Custom (any OpenAI-compatible)  | MVP     |

`devmap init` lets you choose Groq, OpenRouter, or a custom OpenAI-compatible
endpoint with the arrow keys. Groq shows the available model list and stores
the selected model. For OpenRouter, pressing Enter at
`OpenRouter model [openrouter/free]:` keeps the free router; typing another
model ID uses that free or paid model instead. Change it later with
`devmap config model <model-id>`.

Press Enter at the key prompt to skip AI and add a key later with
`devmap config key` (or `devmap config key <key>`; it also reads
`GROQ_API_KEY` / `OPENROUTER_API_KEY`).

API keys are stored locally:

```txt
~/.devmap/config.json
```

DevMap does not require a backend server.

Requests go directly from your machine to the selected provider.

---

## Installation

```bash
# npm
npm install -g @flaid/devmap

# pnpm
pnpm add -g @flaid/devmap

# run without installing
npx @flaid/devmap analyze
```

Requirements:

```txt
Node.js 22.12+
```


---

## Documentation

- [docs/commands.md](./docs/commands.md)
- [docs/mcp.md](./docs/mcp.md)
- [docs/architecture.md](./docs/architecture.md)
- [docs/generated-files.md](./docs/generated-files.md)
- [docs/design.md](./docs/design.md)
- [docs/benchmarking.md](./docs/benchmarking.md)
- [docs/roadmap.md](./docs/roadmap.md)
- [docs/releasing.md](./docs/releasing.md)
- [CHANGELOG.md](./CHANGELOG.md)
- [CONTRIBUTING.md](./CONTRIBUTING.md)

---

## Contributing

DevMap is open source and welcomes contributions.

```bash
git clone https://github.com/itsflaid/devmap
cd devmap

pnpm install
pnpm link --global

devmap analyze
```

Before contributing:

1. Read `docs/architecture.md`
3. Read `CONTRIBUTING.md`

---

## License

MIT License — use it, fork it, improve it, build on top of it.