How Compass maps framework routes
Compass detects supported framework registrations during local structural extraction and publishes them in compass.graph/1. Detection stays local: route…
How Compass maps framework routes
Compass detects supported framework registrations during local structural extraction and publishes them in compass.graph/1. Detection stays local: route packs do not download grammars, invoke language servers, or require credentials. This reference lists the route shapes Compass recognizes, the graph records it emits, and the cases it leaves unresolved.
Who this page is for: Compass users and integrators who need to trace application entry points.
You will learn: how route nodes and
routes_toedges work, which framework forms Compass recognizes, and why some dynamic routes remain unresolved.Prerequisites: Graph model.
Reading time: about 8 minutes.
Route records and edges
Compass records a route when it can connect a framework registration to source evidence. The record keeps the path, operation, declaration, and resolution state together so you can inspect the result without guessing.
Each registration becomes a route node with these details:
- Framework and operation: the framework family and HTTP, page, hook, messaging, or subscription operation
- Path: the normalized path plus the original path expression
- Declaration: the source scope and anchor that declared the route
- Stages: ordered middleware and handler stages, with the handler last
- Resolution: the exact target, bounded candidates, or an explicit unresolved state
A routes_to edge points from the route to each exact middleware and handler target. Compass preserves declaration order. It does not create an exact edge when several targets remain valid.
Configuration and file-convention routes keep the rule and source that produced them. Equivalent inputs receive deterministic route identities and ordering.
Read a route through callers
The callers command follows incoming calls and routes_to edges. Use it to see code callers and URL registrations for the same handler:
compass callers UsersController.show --graph compass-out/graph.jsonThe output stays tied to source anchors. Open the listed file and line when you need to verify a registration or investigate an unresolved target.
Supported route shapes
Compass activates a framework pack only when the repository contains direct evidence, such as an import, exact receiver, framework configuration file, or dependency-backed file convention. The lists below describe the supported registration shapes.
Python web frameworks
- Django:
path,re_path, legacyurl, andincludein an activated URL module; positional or namedrouteandviewarguments; function views, dotted string handlers, and class-based.as_view()handlers - Flask:
FlaskandBlueprintroute decorators, constructor and registration-timeurl_prefix, positional or namedrule, and literalmethodslists - FastAPI:
FastAPIandAPIRouterdecorators forget,post,put,patch,delete,options,head, andtrace;api_routeandroutemethod lists; literalpath; constructor andinclude_router(prefix=...)prefixes;Dependsstages
JavaScript and TypeScript frameworks
- Express:
express()andRouter()receivers;get,post,put,patch,delete,options,head, andall; literal paths and ordered middleware chains; opaque inline callbacks remain unresolved - NestJS:
ControllerHTTP method decorators andRequestMapping; GraphQLResolverQueryandMutationoperations at/graphql; typed GraphQL field details;WebSocketGatewaySubscribeMessage;MessagePatternandEventPatterntransport registrations - React Router: JSX
Routeelements withelement={<Component />}orComponent={Component}, plus literal object route configs withcomponent,element, orComponenttargets and loader or action stages - SvelteKit:
src/routes+page.sveltecomponents and+serverendpoints, including[param]and[...rest]segments and source-backed exported HTTP methods;+page.tsload modules are not pages - Vue Router and Nuxt: Vue Router literal route objects; Nuxt
pagescomponents;server/apimethod-suffixed endpoints; dynamic segments; and route-middleware domain facts - Astro:
src/pages.astropages and.tsor.jsendpoints, including[param]and[...rest]segments, exported HTTP methods,ALL, and source-backed default handlers
PHP, Ruby, and JVM frameworks
- Laravel: exact
Illuminate\\Support\\Facades\\Routereceivers, including aliases; HTTP,match,any,prefix(...)->group,resource,apiResource, andonlyorexceptresource modifiers;Controller@actionand controller or action tuple handlers - Drupal:
*.routing.ymland*.routing.yamlpaths with controller, form, entity-form, entity-view, or entity-list handlers; pipe or comma-separated_methodvalues; documentedhook_*implementations and matching functions in.module,.theme,.install, and.incfiles - Rails: HTTP and
matchdeclarations insideRails.application.routes.draw,to:and hash-rocket handlers, literalscopeandnamespaceprefixes with namespaced controller owners, andviamethod lists - Spring: Java and Kotlin controller mappings, including class and method composition, HTTP mapping annotations,
RequestMappingmethods, composed and inherited Java mappings, constants, packages, and overloaded handler signatures - Play: literal
GET,POST,PUT,PATCH,DELETE,OPTIONS, andHEADentries inconf/routes, targeting Java, Scala, or injected controller actions
Go, Rust, and native server frameworks
- Gin, chi, and gorilla/mux: imported router registrations, grouped or closure prefixes, Gin middleware chains, chi method calls, and gorilla
HandleFunc(...).Methods(...), includingPathPrefix(...).Subrouter()chains - Axum, actix-web, and Rocket: Axum nested
.nest(...).route(...)chains, actix scoped resources and.route(...).to(...)handlers, plus Rocket and actix route attributes, including multiline attributes, guarded by framework imports or qualified macros - Vapor: grouped literal and path-component prefixes, closure groups,
app.on(...), and HTTP registrations with explicituse:handlers; opaque closures remain visible as unresolved handlers - ASP.NET Core: MVC controller and action templates,
[controller]and[action]tokens, HTTP method attributes, and absolute/or~/action-template overrides
Special route contracts
Some frameworks expose routes that are not HTTP URLs. Compass keeps their domain meaning instead of assigning a misleading path:
- NestJS messaging and WebSocket subscriptions retain their typed messaging or subscription contracts
- Nuxt middleware retains its middleware domain fact
- GraphQL fields retain the field name in route details while sharing the
/graphqltransport endpoint
These records still retain handler references and source anchors. File-route packs require matching project dependency evidence during a normal repository build. Direct single-file extraction remains available for fixtures and tooling, but it does not activate a repository pack by itself.
Why a route can remain unresolved
Compass publishes a route only when its evidence identifies a framework and a target within bounded limits. The following forms do not become exact route bindings:
- computed or concatenated paths
- dynamic method names and arbitrary metaprogramming
- opaque closures with no source-backed callable
- same-named handlers with more than one valid target
- targets selected only by repository-wide terminal-name similarity
- file-route conventions without matching project dependency evidence
An unresolved route remains visible on its route node. Compass keeps bounded candidates when available and omits a misleading routes_to edge. Limit errors remain explicit diagnostics, never empty successful results. Django include cycles stop without inventing a route.
A practical route investigation workflow
Use this sequence when you need to explain how a request reaches a handler:
- Run
compass update . --no-vizto publish a local graph snapshot - Run
compass callers UsersController.show --graph compass-out/graph.jsonto list code callers and route registrations - Open each source anchor and compare the declaration with the route path, stages, and resolution state
- Treat a missing
routes_toedge as unresolved evidence, not as proof that the route has no handler
Related pages
Next step: build a graph, then run compass callers for a known controller or view.
Document format reference
This page records the current deterministic document boundaries. A file can be discoverable without having a structural extractor; consumers should inspect…
Output reference
Compass outputs range from the current compass-out/ directory to versioned CompassQL results and immutable history exports. This reference describes…