Service Dependency Mapping Across Repositories

Kyle · · 22 min read
Service dependency mapping across multiple code repositories

A field change can pass every local test and still break a consumer three repositories away. Service dependency mapping is how you find that consumer before the deploy window gets tense.

What matters is not a prettier diagram. You need evidence: callers, events, shared schemas, config, owners, and release order (the 2 a.m. details).

Start by tracing:

  • Which service consumes the contract you’re changing
  • Which queue, schema, or environment variable creates hidden coupling
  • Who needs to review before the change lands

Make the next PR boring.

The Problem Shows Up Long Before an Incident

A developer changes one response field in an API repo. Local tests pass. The service deploys cleanly. Two hours later, a consumer in another repository starts throwing deserialization errors because it expected the old shape and nobody knew that consumer existed.

That’s the normal failure mode in distributed systems. The outage is just the part everyone notices.

The day to day signs show up earlier:

  • basic architecture questions get answered through Slack archaeology
  • PR reviewers can judge code quality inside one repo, but not blast radius across four
  • refactors stall because nobody can say which services call which endpoints with any confidence
  • deployments turn into careful ceremonies because the service relationships are half-known
  • AI coding assistants give decent file edits and weak system answers because the context is split across repositories

Teams usually describe this as a documentation problem. We don’t think that’s quite right.

It’s a visibility problem. If the structure isn’t current and queryable, docs won’t save you. You still end up changing code with partial context and hoping the hidden edges don’t matter.

The cost is boring and expensive at the same time:

  • slower change velocity
  • more regression risk
  • duplicate patterns that survive because nobody can see them side by side
  • dead paths that stay in production because nobody knows what still depends on them
  • ownership gaps during incidents, migrations, and contract changes

A system you can’t see clearly will train your team to move slowly.

Service dependency mapping reveals problems before an incident occurs

What Service Dependency Mapping Means Across Repositories

Service dependency mapping is a structured view of how services depend on each other across separate repositories. Not just imports. Not just package references. We mean the actual relationships that make the system behave the way it does.

In a distributed system, a dependency can look like several different things:

  • a synchronous API call from one service to another
  • an event producer feeding one or more consumers
  • a shared schema or datastore that quietly couples changes
  • an internal library that shapes runtime behavior across repos
  • a deployment order requirement
  • an environment variable that points one service at another
  • an owner or escalation path that becomes relevant the second something breaks

That’s why the output should look more like an architecture map for distributed systems than a package graph.

A useful microservices dependency graph has a few simple parts:

  • nodes for services, repositories, endpoints, events, schemas, or data stores
  • edges for calls, events, shared data, or deploy-time coupling
  • metadata for owner, criticality, change frequency, and confidence

The confidence field matters more than most teams expect. Some edges come straight from code. Some come from config. Some are inferred and need a human to confirm them. If you mix those together without labels, the graph looks neat and lies to you.

What a Useful Cross Repo Service Map Should Include

A cross repo service map becomes useful the moment someone asks, "If we change this, what else moves?" If it can’t answer that, it’s decoration.

At minimum, each service entry should carry:

  • service name
  • source repository
  • owned endpoints or events
  • upstream callers
  • downstream dependencies
  • data stores or schemas touched
  • deployment dependencies
  • team or individual owner
  • runtime environment
  • key environment variable usage

There’s an important distinction here that teams blur all the time.

Service level edges and code level edges are not the same thing.

orders-service -> payments-service tells you something operationally meaningful.
file X imports package Y tells you something local and mechanical.

You need both, but they answer different questions. One helps you judge system impact. The other helps you edit safely inside a codebase.

It also helps to label every edge by type. Without that, everything collapses into a vague arrow.

For most teams, five edge labels are enough to start:

  1. API contract dependency
  2. Data flow dependency
  3. Shared infrastructure dependency
  4. Build or deployment dependency
  5. Ownership dependency

Track freshness too. A map last updated three months ago is not a map. It’s a rumor with boxes around it.

The value is not the diagram. The value is being able to ask it hard questions.
Service entry fieldWhy it matters
Service nameKeeps the map centered on services rather than repositories alone.
Source repositoryTies the service to the codebase when no single checkout contains the whole story.
Owned endpoints or eventsLists the contracts the service serves or publishes for other repos to call or consume.
Upstream callersIdentifies consumers that may break and need review before a contract change lands.
Downstream dependenciesShows what else moves when this service changes.
Data stores or schemas touchedExposes shared-data coupling that import graphs often miss.
Deployment dependenciesCaptures release order and rollout prerequisites, not just code links.
Team or individual ownerMakes review, approval, and incident routing actionable.
Runtime environmentAdds operational context that local code graphs miss.
Key environment variable usageReveals hidden coupling carried in config between services or infrastructure.

How This Differs From a Monorepo Graph or a Single-Repository Code Graph

There are three separate mapping problems here, and teams often mash them together:

A single repo graph is local. It shows imports, callers, endpoints, and module relationships inside one codebase. That’s useful. We rely on that kind of structure constantly. But it usually can’t show who consumes the service from another repo, what order things must deploy in, or who owns the downstream breakage.

A monorepo graph goes wider, but it still assumes the system lives inside one versioned boundary. That assumption breaks fast when services move at different release cadences, different teams own them, and half the coupling lives in config, contracts, and runtime behavior rather than imports.

Cross repo service dependency mapping needs a different lens:

  • it connects interfaces that span repository boundaries
  • it captures code, config, operations, and ownership together
  • it answers how to see service relationships across repositories when no single checkout contains the whole story

The simplest mental model is this:

  • code graphs explain local structure
  • service maps explain system behavior

If you only have the first one, you can edit files. You still can’t change a distributed system with confidence.

Why Teams Need Service Dependency Mapping Before They Need More Documentation

Most teams don’t fail because they lack documents. They fail because they lack current structure they can query.

That sounds harsh, but you can see it in how work actually gets done. During a contract change, nobody asks for a prettier diagram. They ask who consumes this field, what else depends on this queue, and who has to sign off before deploy.

Service dependency mapping helps with the problems engineering teams actually feel:

  • blast radius estimation before changing contracts
  • faster PR review because affected services and owners are visible
  • safer refactoring across multiple repos
  • easier migration planning when boundaries are moving
  • faster incident response when tracing request paths

The AI angle makes this sharper, not softer. AI coding assistants are strong when they can ask architecture questions before they edit code. Without a service map, they see fragments and fill the gaps with guesses. Sometimes those guesses look plausible enough to be dangerous.

With a queryable graph, the assistant can reason about callers, endpoints, dependency paths, dead code, and likely impact before proposing changes. That changes the shape of the session. You spend less time correcting wrong assumptions and more time deciding whether the change should happen at all.

Experienced teams need this too. Maybe especially experienced teams. Mature systems have more hidden edges, more old consumers, and more stable services nobody thinks about until one field change breaks billing on a Tuesday afternoon.

Stable does not mean simple. It usually means the opposite.

The Dependency Types That Matter Most Across Repositories

Not every edge deserves equal attention. Some edges create work. Some create outages.

API contract dependencies

These are the obvious ones: REST, RPC, GraphQL, internal SDKs, generated clients. The risk lives in versioning, field deprecation, and compatibility drift.

An endpoint change in one repo can affect several consumers elsewhere, even if no direct import points back to them. Generated clients make this worse in a sneaky way. They feel safe because the types line up, right until some consumer hasn’t regenerated or pinned an older contract.

Data flow dependencies

Event streams, queues, webhooks, CDC pipelines, shared schemas. This is where teams get surprised because producer and consumer timing hides breakage until runtime.

The producer ships. Nothing breaks immediately. A consumer fails six hours later when it sees the first malformed event. That edge belongs in the service map, not buried in BI docs or tribal memory.

Deployment dependencies

Sometimes the code change is low risk and the deploy is not. Release order, feature flags, config rollout, service discovery, environment variables - these create real coupling.

We’ve seen harmless looking contract changes turn risky because one side reads the new field before the other side writes it.

Shared library dependencies

Internal packages can create broad coupling without any service call between teams. Reuse is good until it forces lockstep upgrades across five repos for one tiny behavior change.

Shared code is architecture, whether teams admit it or not.

Ownership dependencies

This one gets left out because it doesn’t look technical enough. That’s a mistake. If a dependency changes, who reviews it, approves it, and responds when it goes sideways? Service ownership across repos belongs in the graph.

A graph without owners still leaves you guessing at the worst moment.

How to Build a Service Dependency Map Across Repositories

Don’t start by trying to model everything. That’s how this turns into a six month side project nobody trusts.

Start with one critical flow and build from there.

Step 1: Inventory the services and repositories that matter

Begin with a user facing flow or a critical domain. Record:

  • service name
  • repository
  • runtime
  • owner

If you start from the org chart instead of the request path, you’ll lose momentum fast.

Step 2: Extract signals from code and config

Pull evidence from places that already exist:

  • endpoint definitions and route handlers
  • client calls and SDK usage
  • event producer and consumer declarations
  • queue and topic names
  • environment variables pointing to other services or shared infrastructure
  • deployment manifests and service discovery config

Config often exposes dependencies the code hides. Environment variables are especially revealing.

Step 3: Normalize signals into graph entities

Decide what counts as a node. Usually some mix of:

  • repo
  • service
  • endpoint
  • event
  • schema
  • datastore

Then decide what counts as an edge and what metadata you’ll keep.

Step 4: Connect code evidence to service relationships

Group scattered references into service to service edges. Separate confirmed links from inferred links. Don’t fake certainty.

Step 5: Add ownership and operational context

Attach the details people need during change and failure:

  • team owner
  • on call relevance
  • critical dependencies
  • review requirements for contract changes

Step 6: Validate against real work

Take a recent incident, migration, or API change and test whether the graph matches reality. If it fails there, it won’t help in production.

Step 7: Keep it current

A stale dependency map creates false confidence, which is worse than having none. Update on push matters because architecture drift is constant, not occasional.

That maintenance gap is common in the research literature too. A 2026 systematic review of GraphRAG in AIOps screened 139 unique records and included 31 empirical or systems-oriented studies; among the studies centered on service dependency graphs, 73% did not explicitly describe topology-drift or streaming-update handling. That is not proof that 73% of production maps are stale, but it is a useful warning: treat freshness as a measurable property of the map, not an assumption. Record when each edge was last observed, distinguish live evidence from inferred links, and make an out-of-date map visible before people use it for change approval.

This is one reason we built Pharaoh the way we did. It maps repositories into a knowledge graph across repos, updates on every push, and lets MCP compatible tools query architecture, dependencies, callers, endpoints, environment variable usage, blast radius, and dead code before changes.

A Worked Example of Cross-Repository Service Dependency Mapping

Take a common five service flow:

  • web frontend in repo A
  • API gateway in repo B
  • orders service in repo C
  • payments service in repo D
  • notifications service in repo E

A user places an order.

The frontend calls the gateway. The gateway calls orders. Orders calls payments. Orders emits an order-created event. Notifications consumes that event and sends email.

A raw service map for that flow should capture:

  • API edge: frontend -> gateway
  • API edge: gateway -> orders
  • API edge: orders -> payments
  • event edge: orders -> notifications
  • any shared contract or schema nodes
  • owners for each service
  • deployment dependency if payments must roll out before orders uses a new response field

An adjacency list is enough to start:

frontend-web -> api-gateway [api]
api-gateway -> orders-service [api]
orders-service -> payments-service [api]
orders-service -> order-created [event-producer]
order-created -> notifications-service [event-consumer]
payments-service -> payment-schema-v2 [contract]
orders-service -> payment-schema-v2 [contract-consumer]

Now the useful questions become answerable.

If the payments response shape changes, which repos need review?
If the order-created schema changes, who validates downstream consumers?
If the queue backs up, which service owners need to coordinate first?

That’s the shift. You stop talking about "the system" as a vague thing and start reasoning in edges.

How to See Service Relationships Across Repositories in Daily Engineering Work

A service map matters when it changes how you work on a normal Wednesday.

During a Claude Code, Cursor, or Codex session, you should be able to ask:

  • which services call this endpoint
  • which repositories own consumers of this event
  • what is the likely blast radius of changing this model
  • what dead paths exist around this contract

During PR review, the map should help you catch cases where local tests pass but cross repo risk is still high. If a change touches an endpoint, event, or shared package with external consumers, dependent reviewers should be pulled in automatically or at least be obvious.

During refactoring sprints, the graph helps you find dead edges, repeated integration patterns, and stale contracts. More importantly, it helps sequence changes. Memory is a terrible migration plan.

During incidents, the value is painfully direct. You can trace likely upstream and downstream paths faster and identify service ownership across repos without hunting through old docs.

Pharaoh fits here because it gives AI assisted workflows the system context they usually lack. It works across multiple repos, supports TypeScript, JavaScript, Python, C and C++, and keeps the map refreshed on every push so the assistant is querying current structure instead of stale assumptions.

Service dependency mapping across repositories for daily engineering work

Mapping Service Ownership Across Repositories Without Creating Another Spreadsheet

Ownership is part of dependency mapping. It is not a separate governance problem.

The common failure mode is simple: the team knows a service exists, but nobody knows who approves contract changes or who gets paged when the consumer starts failing. So the dependency is known in theory and useless in practice.

Attach ownership directly to services and, when needed, to edges:

  • team name
  • primary maintainer or escalation contact
  • review expectations for breaking changes
  • domain or bounded context
  • criticality level

This helps with PR routing, incident coordination, migration planning, and AI proposed changes that span repo boundaries.

Keep ownership close to code if you can. Static ownership docs drift fast. The person who wrote the original service may have left two reorganizations ago. If your service map still points to them, that’s not metadata. That’s sabotage by neglect.

Common Mistakes That Make Service Maps Look Useful but Fail Under Change

Most bad service maps fail in predictable ways.

  • Mapping only repositories, not services
    Repos are storage boundaries. They are not always architecture boundaries.

  • Treating the map as a one time artifact
    If it isn’t refreshed, it becomes misleading.

  • Capturing only synchronous calls
    Event driven edges and shared contracts hide a lot of real breakage.

  • Ignoring deployment and config dependencies
    Release order, flags, and environment variables create risk even when code edges look simple.

  • Skipping ownership metadata
    A graph without owners still leaves the team stuck during change.

  • Confusing import graphs with service relationships
    Useful for local reasoning. Not enough for distributed systems.

  • Over-modeling too early
    Start with high risk flows. Don’t spend month three modeling a service nobody plans to touch.

Pretty diagrams can still leave you blind.

Ways to Create a Cross Repo Service Map and the Tradeoffs of Each

You have a few practical options, and they aren’t equally useful for pre change work.

Manual diagrams are fine for initial alignment. They’re weak on freshness and almost never queryable.

Infrastructure first mapping shows deployed services and network paths. That helps operations, but it often misses contract details, code intent, and ownership context.

Runtime tracing is strong for live request paths. It’s weaker for planned changes, dead code, and dormant dependencies that only matter during refactors.

Code and config derived graphs are usually better for blast radius analysis and architecture aware development. They still need ongoing refresh and service level normalization or they become noisy.

A knowledge graph approach fits best when both humans and AI assistants need to ask system questions before editing code. That’s the niche Pharaoh is built for: hosted, cross repo codebase intelligence rather than isolated repo analysis.

If you’re deciding between approaches, use blunt criteria:

  • does it stay current
  • does it span multiple repos
  • does it capture contracts, data flows, deploy dependencies, and ownership
  • does it help during PRs and refactors, not just architecture reviews

If the answer is no on the last point, it probably won’t change team behavior.

How to Start This Week Without Turning It Into a Six-Month Project

Keep this small.

Pick one critical user flow that crosses repositories. Identify the services, repos, interfaces, and owners involved. Capture only the edge types that would change your decisions:

  • API calls
  • events
  • shared data contracts
  • deployment order

Then validate that map against one recent bug, incident, or risky refactor. If it explains what happened, you’re on the right track. If it doesn’t, fix the model before you expand it.

Make the result queryable. That matters more than making it pretty.

If your team already uses AI coding assistants, the fast path is adding a codebase graph through an MCP compatible setup so the assistant can answer architecture questions before changes are made. If PR review is the immediate pain, PR Guard is the relevant next step when you want architecture aware checks to show up in GitHub review flow.

Conclusion

Service dependency mapping is how distributed systems stop feeling like disconnected repos and start becoming a usable graph of contracts, flows, ownership, and risk.

The distinctions matter:

  • a single repository graph explains local code structure
  • a monorepo graph explains shared code inside one boundary
  • a cross repo service map explains how the system actually behaves across boundaries

Start with one change your team is nervous about. Map the upstream and downstream service edges across repositories. Add owners to each edge. Use that map to guide the next PR or refactor.

If you want that graph maintained automatically for AI assisted development, Pharaoh is one approach.

Article Record

ReferencesPrimary sources used for this article
  1. Map a dependency graph across multiple repos - Graphify
  2. How JupiterOne Uses CAASM to Understand Service Coupling | JupiterOne | JupiterOne
  3. [2308.09637] Visually Analyzing Company-wide Software Service Dependencies: An Industrial Case Study
  4. System graph & map · repowise docs
  5. Multi-repository dependency analysis with enola
  6. Formal Model of Contract Evolution for APIs and Messages in Event-Driven Systems: Compatibility, Versioning, and the Prevention of Breaking Changes
  7. Customer Story: How Innovation Norway Automatically Updates Their Integration Landscape In Ardoq | Ardoq Help
Update HistoryMeaningful revisions to this article
Initial publication.
← Back to blog