jsonapi_frontend_menu
No security coverage
JSON:API Frontend Menu is an optional add-on for jsonapi_frontend">jsonapi_frontend that exposes a ready-to-render menu tree for decoupled frontends.
Features
- Menu tree JSON endpoint: nested
childrenstructure (no client-side tree building required). - Role-aware filtering: only returns links the current Drupal user can access (no “leaky” menu items).
- Active trail (optional): pass
pathto markactiveandin_active_trail. - Hybrid routing hints (optional): per-link
resolveoutput compatible with/jsonapi/resolve
(includesheadless,jsonapi_url/data_url, ordrupal_url). - Cache-safe defaults: anonymous responses can be cached; authenticated responses are
no-store.
Post-Installation
Install and enable the module, then call the endpoint from your frontend:
composer require drupal/jsonapi_frontend_menu drush en jsonapi_frontend_menu
Examples:
GET /jsonapi/menu/main?_format=json GET /jsonapi/menu/main?path=/about-us&_format=json
Optional query parameters:
path: compute active trail flags for the current page.langcode: forwarded to the resolver for alias/language resolution.min_depth/max_depth: limit returned depth.parent: return a subtree under a specific parent plugin id.resolve=0: skip per-link resolver decoration for maximum performance/caching.
Additional Requirements
- jsonapi_frontend (required)
- Drupal core menus (built-in)
Recommended modules/libraries
- @codewheel/jsonapi-frontend-client (optional TypeScript helpers)
- Starter templates: Next.js and Astro (optional)
Similar projects
- jsonapi_menu_items: exposes menu links via JSON:API Resources. This module focuses on a turnkey frontend contract: nested tree + optional active trail + optional
/jsonapi/resolvestyle routing hints.
Supporting this Module
Please file issues and patches in the project issue queue. Contributions and co-maintainers are welcome.
Community Documentation
- jsonapi_frontend project page and documentation
- Migration guide: see the
MIGRATION.mdin the project repository