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

solid-file-router

v0.7.2

Published

Type safe file router for solid.js

Downloads

621

Readme

solid-file-router

Type-safe file-based routing for Solid and Vite.

solid-file-router scans route modules, generates @solidjs/router route definitions, exposes a ready-to-render <FileRouter />, and writes route path types for navigation. It also supports nested layouts, loading and error inheritance, route metadata, route providers, and build-time SSG (Static Site Generation).

[!WARNING] This project is under active development and is still pre-1.0. Minor releases may contain breaking changes. Review the release notes before upgrading.

This package is ESM only.

Features

  • File routes from src/pages/**/*.{jsx,tsx}
  • Generated path, parameter, and metadata types
  • _app.tsx, pathless _layout.tsx, and 404.tsx conventions
  • Route preload, matchFilters, metadata, and lazy components
  • Inherited loading and error components
  • Built-in Markdown/MDX routes compiled with Satteri
  • Extensible MDX route loading with transformPath and extendLoad
  • Composable route providers for CMS or generated modules
  • Build-time static HTML generation

Install

Install the router and the Solid/Vite dependencies:

bun add solid-file-router @solidjs/router solid-js
bun add -d vite vite-plugin-solid
# Optional: required for Markdown/MDX routes and YAML frontmatter
bun add -d satteri yaml

@babel/core and tinyglobby are already provided through vite-plugin-solid and Vite, so applications do not need to install them directly.

This package does not configure vite-plugin-solid; keep that plugin in your application's Vite config.

Quick Start

Configure Vite:

// vite.config.ts
import { fileRouter } from 'solid-file-router/plugin'
import { defineConfig } from 'vite'
import solidPlugin from 'vite-plugin-solid'

export default defineConfig({
  plugins: [solidPlugin(), fileRouter()],
})

Load the generated virtual-module types:

// tsconfig.json
{
  "compilerOptions": {
    "types": ["solid-file-router/client"],
  },
}

Create a page:

// src/pages/index.tsx
import { createRoute } from 'solid-file-router'

export default createRoute({
  component: () => <h1>Hello</h1>,
})

Render the generated router:

// src/index.tsx
import { render } from 'solid-js/web'
import { FileRouter } from 'virtual:routes'

render(() => <FileRouter />, document.getElementById('root')!)

An _app.tsx root layout is recommended but optional. Without one, the plugin generates a pass-through root component.

Documentation

| Document | Use it for | | ------------------------------ | ----------------------------------------------------------------------- | | Guide | Routes, layouts, data, navigation, metadata, and route providers | | SSG Guide | Prerender setup, route selection, output, templates, and server entries | | MDX Guide | Satteri setup, Markdown routes, component overrides, and HMR | | Reference | Exact plugin options, generated modules, types, and runtime APIs | | Agent Guide | Repository map, invariants, and verification workflows |

Enable the latest opt-in features with fileRouter({ ssg: {} }) or fileRouter({ mdx: true }). SSG requires solidPlugin({ ssr: true }); MDX requires the optional satteri peer dependency. Pass an MDX options object to map source paths or wrap generated content with extendLoad; its mdxContent expression can use the active useMDXComponents() map. Follow the dedicated guides for complete, copyable setup.

routeProviders are additive: the built-in filesystem provider runs first, optional MDX runs next, and the configured providers follow. Markdown/MDX frontmatter is optional, but using it requires the optional yaml peer dependency. See the route provider guide and MDX guide for details.

Development

This repository uses Bun:

bun run build
bun run test
bun run lint
bun run typecheck

Run the playground with bun run play. Repository-specific instructions are in AGENTS.md.

License

MIT

Credit

Inspired by generouted.