Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Wayfinder Laravel Package

laravel/wayfinder

Laravel Wayfinder bridges your Laravel backend and TypeScript frontend by generating fully-typed, importable TypeScript functions for your controllers and routes—no more hardcoded URLs or manual syncing. Includes a Vite plugin that regenerates definitions automatically during builds and dev server r...

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit Wayfinder is a build-time code generator, not a runtime library. A Laravel artisan command (wayfinder:generate) introspects the registered router and controller signatures and emits typed TypeScript modules into resources/js/{wayfinder,actions,routes}. The Vite plugin (@laravel/vite-plugin-wayfinder) wires generation into dev-server file watching and the production build. Architecturally this means: zero runtime dependency, zero production PHP footprint, and a hard build-time coupling between the Laravel app and the frontend build. It fits cleanly only where the Laravel backend and the TS frontend live in the same repository and the same build pipeline — the canonical Inertia monolith. It is a poor fit for a decoupled SPA/API or mobile client consuming a remote Laravel API, because generation requires booting the PHP app.

Integration feasibility Install is two steps (composer require laravel/wayfinder, npm i -D @laravel/vite-plugin-wayfinder) plus a one-block vite.config.ts change. Output is conventional: named exports per controller method and per named route, each callable or exposing .url(), .get(), .head(), .form(), plus an options argument for query/mergeQuery. First-class Inertia interop (form.submit(store()), <Link href={show(1)}>) is the strongest adoption lever — it removes an entire class of hand-written URL strings. Cost is genuinely low: roughly a half-day spike plus CI wiring for a team already on Inertia.

Technical risk

  • Beta status is explicit. The README states the API is subject to change before v1.0.0. Changelog cadence (v0.1.9 → v0.1.13 with behavioural fixes like barrel name collisions, reserved-keyword handling, strict-mode query typings, runtime URL defaults) signals that rough edges are still being discovered in the wild.
  • Zero dependents despite ~1.9k stars. Adoption is individual-organic, not yet embedded in downstream packages — no ecosystem safety net, and no evidence of large-scale production hardening.
  • Deploy ordering hazard is documented and severe. If the app boots with a stale route cache, generation silently omits new routes and the build fails with module-resolution errors ("Could not load resources/js/routes/"). This requires php artisan route:clear before npm run build. Any pipeline that ends with php artisan optimize is latently broken until fixed.
  • Inconsistent generated shapes. Multiple routes mapping to one controller action degrade the export from a callable to a URI-keyed dictionary (index["/clients/{client}/payments"](...)). Correct, but a sharp edge that surfaces only at the call site.
  • Type inference is heuristic. Model docblock fallback and DB type maps (e.g., Postgres int4 added in v0.1.9) imply parameter typing is inferred, not asserted — misclassification produces silent string | number widening or compile breaks.
  • Release metadata anomaly: the recorded last release date is forward-dated. Verify actual cadence against the changelog rather than trusting the field.

Key questions

  1. Is our frontend co-located with the Laravel app, and does the frontend CI runner have PHP + Composer available? If not, the whole value proposition collapses.
  2. What is the deploy pipeline's current route:cache/optimize ordering, and who owns changing it?
  3. Do we have controllers with multiple routes to one action, or JS reserved-word method names (delete, import), that would produce non-obvious generated output?
  4. Are we willing to absorb a pre-1.0 breaking change on upgrade, and do we have a pinning/patch policy for it?
  5. Does our TS config run in strict mode, and does our typecheck step run after generation in CI?

Integration Approach

Stack fit Ideal: Laravel 11/12+ with Inertia + React/Vue, TypeScript, Vite, single repo. Good: same, with Blade forms wanting --with-form for conventional submissions. Poor: separate SPA repo, Next.js/Remix frontends hitting an API, or any consumer without PHP in the build environment.

Migration path Adopt incrementally rather than repo-wide. Pilot on one feature slice: enable the Vite plugin, run wayfinder:generate, and replace hand-written URL strings in that slice only. Compare generated output against existing constants/helpers. Only after the pilot passes a full deploy cycle should we consider replacing shared route helpers. Keep the generated directories out of version control (README explicitly supports .gitignore) so they cannot drift or be hand-edited.

Compatibility Confirm before committing: Laravel version floor, PHP version, Vite major version supported by the plugin, TypeScript version (v0.1.13 landed strict-mode query-param fixes, so pin a recent patch), and Inertia major version. Treat the plugin and the Composer package as a versioned pair — they evolve together and mismatches are the likeliest source of silent breakage.

Sequencing

  1. Spike on a throwaway branch; capture generated output for a representative controller set.
  2. Fix deploy ordering: insert php artisan route:clear before the frontend build step.
  3. Wire CI: route:clear → wayfinder:generate (or npm run build) → tsc --noEmit → tests. Typecheck must run after generation.
  4. Pilot one feature in production.
  5. Roll out team-wide with a short internal note on the three sharp edges (dictionary exports, reserved-word renaming, tree-shaking when importing whole controllers).
  6. Establish an upgrade cadence: review changelog, bump both packages together, run generation diff.

Operational Impact

Maintenance Low steady-state carrying cost — generated code is disposable and fully regenerated each build. The real maintenance surface is the toolchain pair (Composer package + Vite plugin) and the pre-1.0 churn. Budget for periodic upgrade-and-diff reviews rather than continuous work. Because output is gitignored, there is no merge-conflict tax, but also no reviewable record of what changed — pair upgrades with a snapshot diff in CI to make regeneration drift visible.

Support No first-party commercial support; MIT-licensed, community-maintained under the Laravel org. Debugging falls to us. Mitigation: keep the pilot's generated output as a reference fixture and document the failure signatures so on-call engineers recognize them fast.

Scaling Generation is roughly linear in route count; expect sub-10s for typical apps and a manageable hit for very large route tables — measure during the spike. Bundle size is the more real concern: importing individual named functions tree-shakes well, importing a whole controller (PostController.show(1)) prevents tree-shaking and pulls in every action in that controller. Codify a lint/import convention preferring named-function and named-route imports.

Failure modes

  • Stale route cache at build → missing route modules, Vite "Could not load" errors, broken build. Highest-probability, highest-blast-radius failure; mitigated entirely by deploy ordering.
  • Upgrade breakage → renamed exports or changed call signatures after a minor bump; surfaces as TS compile errors (safe, loud) or, worse, as silently different URL construction (unsafe).
  • Inference regressions → parameter types widen to string | number, weakening the guarantee Wayfinder exists to provide.
  • Multi-route actions → call sites using the callable form break when a second route is added to that action; surfaces at typecheck, not runtime.
  • Reserved-word renaming → deleteMethod/importMethod mismatch expectations; low impact, caught at typecheck.

Ramp-up Low for Laravel/Inertia engineers — a half-day to competency, since the mental model is thin (import and call). Medium for frontend-only engineers who will not intuit that these modules are PHP-derived and regenerated, and for platform/DevOps engineers who own the build ordering change. The one concept that must be taught explicitly is the dictionary-export fallback for multi-route actions, because it is the only place the otherwise-uniform API changes shape.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections