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

@ploxii/expo-feature-router

v1.0.2

Published

Auto-generate Expo Router routes from feature-based folders.

Downloads

38

Readme

expo-feature-router

🤔 Problem Statement

Currently, expo-router does not support collocation (feature-based folder structure) out of the box. This means developers have to:

  1. Set up routes in the app folder using the standard file routing system
  2. Maintain their actual screen components in a separate features folder
  3. Manually import each screen from the features folder into its corresponding route file in the app directory

This creates unnecessary duplication and makes it harder to maintain a clean, feature-based project structure.

🚀 Solution

📁 Enable feature-based routing in expo-router with automatic route generation from your features/ folder.

expo-feature-router scans your features directory and mirrors corresponding files into the app directory expected by expo-router, preserving layouts, nested routes, and more.


✨ Features

  • ✅ Auto-generates route files from your features directory into app
  • 📂 Supports deeply nested folder structures and dynamic routes ([id].tsx, etc.)
  • 🔥 Supports hot reload via file watching during development
  • ⚙️ Supports both CLI arguments and external config files (.js or .json)
  • 🔍 Ignores folders/files by prefix (e.g. _) or glob pattern (*.utils.tsx, etc.)

📦 Installation

npm install --save-dev expo-feature-router
# or
yarn add -D expo-feature-router

🚀 Usage

CLI

npx expo-feature-router --watch

Or generate routes once:

npx expo-feature-router

You can pass CLI flags or define a config file.


Example CLI options:

npx expo-feature-router \
  --features src/features \
  --app src/app \
  --excludePrefix _ \
  --include _layout.tsx \
  --ignorePatterns *.utils.*,*.view.* \
  --watch

⚙️ Configuration

Instead of passing CLI flags, you can add a config file named expo-feature-router.config.js or .json to your project root:

expo-feature-router.config.js

module.exports = {
    featuresDir: 'src/features',
    appDir: 'src/app',
    excludePrefix: '_',
    include: ['_layout.tsx'],
    ignorePatterns: ['*.utils.*', '*.view.*'],
    extensions: ['.tsx', '.ts', '.jsx', '.js'],
    watch: true, 
    forceClean: false,
    dryRun: false,
    verbose: true
}

expo-feature-router.config.json

{
  "featuresDir": "src/features",
  "appDir": "src/app",
  "excludePrefix": "_",
  "include": [
    "_layout.tsx"
  ],
  "ignorePatterns": [
    "*.utils.*",
    "*.view.*"
  ],
  "extensions": [
    ".tsx",
    ".ts",
    ".jsx",
    ".js"
  ],
  "watch": true,
  "forceClean": false,
  "dryRun": false,
  "verbose": true
}

Then simply run:

npx expo-feature-router --config expo-feature-router.config.js

You can also use --config to specify a different config file name or path.

Usage in package.json scripts:

  • A recommnended approach is to modify your dev script in package.json to include the route generation command using concurrently.
  • Be sure to have concurrently installed as a dev dependency:
npm install --save-dev concurrently

Then, update your package.json scripts section like this:

{
  "scripts": {
    "start": "expo start",
    "dev": "concurrently --raw --kill-others \"npm start\"  \"expo-feature-router --config expo-feature-router.config.json --watch\""
  }
}