codegraph icon indicating copy to clipboard operation
codegraph copied to clipboard

Elysia (Bun): no route nodes, the whole HTTP layer is invisible

Open ChampPABA opened this issue 3 weeks ago • 2 comments

What happens

My backend is Bun + Elysia. Symbols, calls and dependencies all index fine, but there is no Elysia resolver under src/resolution/frameworks/, so not a single endpoint shows up as a route node. codegraph_explore for any endpoint returns everything around the handler and nothing about the route, and I am back to grep for exactly the class of question I adopted codegraph to avoid.

const app = new Elysia({ prefix: '/v1' })  // no GET /v1/healthcheck node
  .get('/healthcheck', () => 'ok')          // no node
  .group('/users', (group) =>               // no GET /v1/users/:id node
    group.get('/:id', getUser)
  )
  .route('TRACE', '/trace', handler)        // no node

Expected: GET /v1/healthcheck, GET /v1/users/{id}, TRACE /v1/trace as route nodes with references edges to the handlers, like Express projects get.

This was already built once

The full paper trail, in order:

  • #1423 asked for it here and was closed as "filed on the wrong repo"
  • kernoio/codegraph-engine#38 recreated the ask on the fork (closed completed)
  • kernoio/codegraph-engine#67 implemented it, merged 2026-07-22: chained .get()/.post()/..., .group() prefixes including guards, new Elysia({ prefix }), .route() custom verbs, :id → {id}, references edges to named handlers, fixture tests plus a validation run on a ConvertX clone (24 routes found)
  • kernoio/codegraph-engine#48, the fork's JS/TS route wave tracker, lists Elysia as first wave, done
  • #967, this repo's route coverage tracker, does not list Elysia at all

Caveat for whoever ports it: the fork put it under src/plugins/elysia/ while upstream uses src/resolution/frameworks/, so it needs a small port, not a straight cherry-pick.

I would rather not pin my team to a fork build over one resolver. Happy to test a port on my repo, report misses, or help however is useful.

ChampPABA avatar Nov 07 '26 03:11 ChampPABA

Thanks for the thorough report and the paper trail back to the fork, @ChampPABA. There was no Elysia resolver here at all, so none of the chained .get(), .group() or .route() registrations became routes. #3405 adds one: routes are named by the full path a request takes, including new Elysia({ prefix }), .group() prefixes and .use() mounts in other files, and are linked to their handlers, so codegraph_explore can follow a request into your code. Path params keep Elysia's own :id spelling, as Express routes do, and Eden Treaty client calls don't link to the routes yet. It is merged to main today (2026-11-18) and ships in the next release; if you try it on your repo, misses are very welcome.

colbymchenry avatar Nov 19 '26 00:11 colbymchenry

Thanks for the quick turnaround on this.

Tested 1.6.4 on four Elysia 1.4 APIs (Bun), each rebuilt with a fresh codegraph index: 113, 77, 62 and 6 routes. Every .get(), .post(), .put(), .patch() and .delete() registration in the source has a route node, with the full path including new Elysia({ prefix }) and .use() mounts in other files, and codegraph callers <service function> lists the route.

We don't use .group() or .route(), so those two are untested here.

One gap: codegraph explore "POST /attendance/sync/activity" returns the controller and service symbols, but the route node itself is not among them. codegraph query "<path>" -k route and codegraph callers do find it.

ChampPABA avatar Nov 24 '26 13:11 ChampPABA