npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@effect-stack/router-vue

v0.3.0

Published

First-party Vue adapter for EffectStack Router

Readme

@effect-stack/router-vue

Client-side Vue routing with typed links, nested outlets, route composables, and boundaries over the @effect-stack/router core.

Install and define routes

pnpm add @effect-stack/router-vue @effect-stack/router @effect/atom-vue@rc effect@rc vue

Define routes in a plain .ts module, register the router type once, and mount the provider from your root component.

// router.ts
import { createRootRoute, createRoute, createRouter, Outlet } from "@effect-stack/router-vue"
import { Effect, Schema } from "effect"
import { h } from "vue"
import ProjectView from "./ProjectView.vue"

const root = createRootRoute({ component: () => h(Outlet) })
export const project = createRoute({
  getParentRoute: () => root,
  path: "projects/:id",
  params: { id: Schema.FiniteFromString },
  loader: ({ params }) => Effect.succeed({ title: `Project ${params.id}` }),
  component: ProjectView
})
export const router = createRouter({ routeTree: root.addChildren([project]) })

declare module "@effect-stack/router-vue" {
  interface Register {
    router: typeof router
  }
}
<!-- App.vue -->
<script setup lang="ts">
import { RouterProvider } from "@effect-stack/router-vue"
import { router } from "./router.ts"
</script>

<template>
  <RouterProvider :router="router" />
</template>

Vue reactivity

route.useParams(), route.useSearch(), route.useLoaderData(), and route.useMatch() return ComputedRef values, and useRouterState() returns a readonly Ref. Read them with .value in setup code; templates auto-unwrap refs, so an existing route component updates reactively when params, search, or loader data change while its local state remains mounted:

<!-- ProjectView.vue -->
<script setup lang="ts">
import { Link } from "@effect-stack/router-vue"
import { project } from "./router.ts"

const data = project.useLoaderData()
const params = project.useParams()
</script>

<template>
  <h1>{{ data.title }}</h1>
  <nav>
    <Link to="/projects/:id" :params="params" exact>Overview</Link>
  </nav>
</template>

Route hooks accept selectors, such as project.useLoaderData((data) => data.title). useRouter() returns the registered router, and useNavigate() returns a function accepting the same typed destination as Link and router.href; the returned Promise completes with its own navigation, and useNavigateEffect() exposes typed Effect composition bound to the provider's registry. Navigate performs declarative navigation. In .ts render functions that return h(Link, ...), annotate the result as VNode so the route type and the Register augmentation stay non-circular; SFC views importing route composables avoid this entirely.

Routes, loading, and boundaries

Views are ordinary Vue components: SFCs, defineComponent results, or functional render functions. A root owns the application layout. Child paths are relative; / defines an index route, and an id in place of path defines a pathless layout. Params and search Schemas are inherited, and route.to is the full literal route pattern; Link, useNavigate, and router.href share destination typing.

loader prepares data; lazy imports code. Present default/component exports must be Vue components. An explicit route component wins; modules with neither export use Outlet. Invalid selected views reach the nearest error boundary.

Declare pendingComponent, errorComponent, and notFoundComponent on routes. Error components receive { error, reset } props. See navigation contracts for completion, cancellation, snapshots, and recovery.

Effect service injection and lifetimes

Loaders request Context.Service values directly. Supply their implementations with createRouter({ layer }), composing with Effect's Layer.provide and Layer.merge. The type system requires the tree's application services and rejects unresolved Layer dependencies; tests can substitute Layer.succeed implementations. history is a separate Layer option, defaulting to BrowserHistory; supply MemoryHistory.layer() in tests.

RouterProvider owns an Atom registry by default and disposes it with its component scope; a supplied registry prop remains caller-owned. See resource lifetime, the Projects service, and its router wiring.

Link renders a real anchor and preserves modifiers, targets, downloads, and prevented clicks; active links expose aria-current="page" and data-active="true", and exact disables descendant-path active matching.

See the Vue example for nested layouts, typed links, injected services, and a lazy SFC view.