Skip to content

Add kind field ("api" | "page" | "action" | "websocket") to EndpointInfo #2

Description

@jorgeraad

EndpointInfo today exposes the wire shape of a route (method, path, handler, file, params, auth) but not its categorical role. Consumers like apex currently derive that with hand-written file-path regex, which puts framework-specific knowledge in the wrong repo.

Add a required kind field to EndpointInfo in src/types.ts, plus an optional kind? parameter to the endpoint() factory in src/utils.ts (defaulting to "api" for migration ergonomics). Existing extractors get explicit kind: "api" calls — mechanical no-op since the factory default matches.

Four values:

  • "api" — REST / GraphQL / RPC / generic JSON HTTP routes.
  • "page" — server-rendered or client-routed page returning HTML/RSC.
  • "action" — RPC-style call invoked from UI (Next.js Server Actions). Companion to `method: "ACTION"`.
  • "websocket" — persistent bidirectional channel. Companion to `method: "WS"`.

The factoring is deliberate: method carries the HTTP verb (or wire-shape distinction for WS / ACTION today, until they migrate to kind), kind carries the protocol/role category. Two fields, orthogonal concepts.

Foundation for the Next.js page extraction work and future page detection in Rails / Django / FastAPI / Spring view-rendering routes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions