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

fohl

v0.0.13

Published

A React meta-framework powered by Vite

Readme

Fohl

A modern React meta-framework powered by Vite, designed for building fast and scalable web applications.

Features

  • Fast Development: Built on top of Vite for lightning-fast HMR and builds
  • 🔥 Hot Route Reloading: Add/remove pages without restarting the server
  • 🎨 Nuxt 3-Style Layouts: Flexible, declarative layout system
  • ⚙️ Zero Config: Works out of the box with sensible defaults
  • 🔥 React 19: Full support for the latest React features
  • 📝 TypeScript First: Built with TypeScript, fully type-safe
  • 🎁 Flexible Configuration: Extensive configuration options with hooks and layers
  • 📦 Optimized Builds: Automatic code splitting and optimization
  • 🗂️ File-based Routing: Automatic route generation from file structure
  • 🎨 Auto Imports: Automatic imports for React and React Router hooks

Installation

npm install fohl react react-dom
# or
pnpm add fohl react react-dom
# or
yarn add fohl react react-dom

Quick Start

1. Create a new project structure

my-app/
├── app/
│   ├── pages/
│   │   └── index.tsx
│   └── app.tsx (optional)
├── public/
└── fohl.config.ts (optional)

2. Create your first page

Create app/pages/index.tsx:

export default function Home() {
  return (
    <div>
      <h1>Welcome to Fohl!</h1>
    </div>
  )
}

3. Add scripts to package.json

{
  "scripts": {
    "dev": "fohl dev",
    "build": "fohl build",
    "preview": "fohl preview"
  }
}

4. Start development server

npm run dev

The server will start with Hot Module Replacement (HMR) enabled. You can add, remove, or modify pages and the routes will automatically regenerate without restarting the server! 🎉

File-based Routing

Fohl automatically generates routes based on your file structure in app/pages/. Routes are automatically regenerated when you add, remove, or modify files - no server restart needed!

app/pages/
├── index.tsx          → /
├── about.tsx          → /about
├── blog/
│   ├── index.tsx      → /blog
│   ├── [slug].tsx     → /blog/:slug
│   └── layout.tsx     → Layout for /blog/* routes
└── layout.tsx         → Root layout

Dynamic Routes

Use square brackets [] for dynamic segments:

// app/pages/blog/[slug].tsx
export default function BlogPost() {
  const { slug } = useParams()
  
  return <div>Post: {slug}</div>
}

Layouts (Nuxt 3-Style) ✨

Fohl supports Nuxt 3-style layouts where pages can declaratively specify which layout to use!

1. Create layouts in app/layouts/

// app/layouts/default.tsx
import { Outlet } from 'react-router'

export default function DefaultLayout() {
  return (
    <div>
      <header>Header</header>
      <main>
        <Outlet /> {/* Child routes render here */}
      </main>
      <footer>Footer</footer>
    </div>
  )
}
// app/layouts/admin.tsx
import { Outlet } from 'react-router'

export default function AdminLayout() {
  return (
    <div className="admin-layout">
      <aside>Admin Navigation</aside>
      <main>
        <Outlet />
      </main>
    </div>
  )
}

2. Pages specify which layout to use

// app/pages/index.tsx
export const layout = 'default' // Uses default layout

export default function HomePage() {
  return <h1>Home Page</h1>
}
// app/pages/admin/dashboard.tsx
export const layout = 'admin' // Uses admin layout

export default function AdminDashboard() {
  return <h1>Admin Dashboard</h1>
}

If no layout is specified, default is used automatically!

Benefits:

  • ✅ Layouts decoupled from directory structure
  • ✅ Easy to reuse layouts anywhere
  • ✅ Flexible and intuitive
  • ✅ Familiar API (same as Nuxt 3)

📚 See full documentation

Old-Style Layouts (Still Supported)

You can also use directory-based layouts for backwards compatibility:

// app/pages/layout.tsx
export default function Layout() {
  return (
    <div>
      <nav>Navigation</nav>
      <Outlet />
    </div>
  )
}

Configuration

Create a fohl.config.ts file in your project root:

import { defineConfig } from "fohl"

export default defineConfig({
  // Development server options
  devServer: {
    port: 3000,
    host: "localhost",
    open: false,
  },

  // Directory configuration
  dir: {
    app: "app",
    public: "public",
    build: "dist",
    buildAssets: "_fohl/",
  },

  // App configuration
  app: {
    baseURL: "/",
    rootAttrs: {
      id: "__fohl",
    },
  },

  // Build options
  build: {
    sourcemap: false,
    minify: true,
  },

  // Preview server options
  previewServer: {
    port: 4321,
    host: "localhost",
    open: false,
  },

  // Path aliases
  alias: {
    "@components": "./app/components",
    "@utils": "./app/utils",
  },

  // TypeScript config overrides
  tsconfig: {
    compilerOptions: {
      strict: true,
    },
  },
})

CLI Commands

Development

Start the development server with Hot Module Replacement:

fohl dev [--port 3000] [--host localhost]

Features in development mode:

  • ⚡ Hot Module Replacement (HMR) for component changes
  • 🔥 Automatic route regeneration when adding/removing pages
  • 📝 Real-time TypeScript type checking
  • 🎨 Live CSS updates

Build

Build your application for production:

fohl build

Preview

Preview your production build:

fohl preview [--port 4321] [--host localhost]

Auto Imports

The following are automatically imported in your components:

React

// No need to import these
useState, useEffect, useCallback, useMemo, useRef, 
useContext, useReducer, etc.

React Router

// No need to import these
useParams, Outlet

Fohl

// No need to import
defineConfig

Unhead (SEO/Meta tags)

// Available for use
useHead, useSeoMeta, useServerHead, etc.

Layer System

Fohl supports a layer system for modular functionality:

layers/
├── auth/
│   └── pages/
│       └── login.tsx
└── admin/
    └── pages/
        └── dashboard.tsx

Layers are automatically merged with your main application.

TypeScript Support

Fohl is built with TypeScript and provides full type safety out of the box. Auto-generated type definitions are created in the .fohl directory.

Production Build

The production build includes:

  • Automatic code splitting
  • Tree shaking
  • Minification
  • Vendor chunk optimization (React/React DOM)
  • Asset optimization

Advanced Features

Route Loaders

Export a loader function to load data before rendering:

export async function loader({ params }) {
  const data = await fetchData(params.id)
  return data
}

export default function Page({ loaderData }) {
  return <div>{loaderData.title}</div>
}

Route Middleware

Export a middleware function for route protection:

export async function middleware({ params, request }) {
  const isAuthenticated = await checkAuth(request)
  
  if (!isAuthenticated) {
    return redirect("/login")
  }
}

export default function ProtectedPage() {
  return <div>Protected Content</div>
}

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.