Code Maps

Code Map generates diagrams of your code visually rendered, always accurate, produced from your actual codebase. Use it to understand system structure, trace data flow, map dependencies, or explain architecture to a teammate. Diagrams are rendered using Mermaid directly in your IDE.


Opening Code Map

Open it by selecting Code Map section in the C0 panel


What you can map

Request and data flow

Trace how a request moves through your system from entry point to response, including every service, function, and data transformation along the way.

Module and dependency structure

Visualize how your modules depend on each other. Identify circular dependencies, overly coupled modules, and the natural seams in your system.

Class and inheritance hierarchies

Visualize class relationships inheritance, composition, and interface implementation.

State machines and lifecycle flows

Diagram how an entity moves through states over its lifetime.

System architecture

Get a high-level architectural view of a system or feature area.


How Code Map works

C0 reads your codebase using the knowledge base call graphs, import chains, class relationships, and function interactions and generates a Mermaid diagram that accurately represents the structure or flow you asked for.

The diagram is grounded in your actual code, not a generic template. Function names, class names, module names, and flow paths come from what's really there.


Diagram types

C0 selects the most appropriate Mermaid diagram type based on your request:

What you're mapping
Diagram type

Request or data flow

Flowchart (graph LR or graph TD)

Sequence of interactions between components

Sequence diagram

Module or file dependencies

Graph or flowchart

Class hierarchy or relationships

Class diagram

State transitions

State diagram

Process or lifecycle

Flowchart or sequence diagram

You can also request a specific diagram type:


Example outputs

Request flow — checkout endpoint:

State machine — order lifecycle:

Sequence diagram auth flow:


Saving diagrams to your documentation

Exported Mermaid source renders natively in GitHub, GitLab, Notion, Confluence, and most modern documentation tools. Copy the diagram source from C0 and paste it directly into your docs. You can export as Mermaid source code or an SVG.

Tips

Use Code Map before refactoring. Before restructuring a module or splitting a service, map its dependencies. You'll see every connection that needs to be preserved, moved, or cut before you've changed anything.

Use Code Map when onboarding to unfamiliar code. A five-minute diagram of a system's request flow tells you more than twenty minutes of reading files. Start with the map, then drill into the files you care about.

Follow up with Chat. Code Map and Chat work well together. Generate a diagram to understand the structure, then switch to Chat to ask questions about the specific parts you don't understand.

Map state machines for product clarity. State diagrams are useful beyond engineering. An order lifecycle diagram or a subscription state machine is something a product manager, a support team, or a designer can read and validate. Generate it in C0 and drop it into your team's documentation.

Last updated