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

elysia-atlas

v1.1.0

Published

Strictly typed file-system router and autoloader for ElysiaJS

Readme

elysia-atlas

Advanced file-system router for ElysiaJS featuring automatic type generation and strict type inference.

npm npm downloads GitHub License GitHub stars Bundlephobia Bun

Installation

bun add elysia-atlas

Quick Start

1. Register the plugin

import { Elysia } from "elysia";
import { autoload } from "elysia-atlas";

const app = new Elysia()
    .use(await autoload())
    .listen(3000);

// Export type for Eden or strict type safety
export type App = typeof app;

[!IMPORTANT] It's important to use await when registering the plugin.

2. Create routes

Create a routes directory and add your endpoints. Each file must export a default function that accepts an Elysia instance.

// routes/index.ts
import { Elysia } from "elysia";

export default (app: Elysia) => app.get("/", () => "Hello World");

Strict Type Generation

elysia-atlas can automatically generate a type definition file that aggregates all your route types. This ensures your main App type includes every route defined in your file system, enabling full type safety for Eden clients.

Configuration

Enable typegen in the plugin options:

const app = new Elysia()
    .use(await autoload({
        typegen: true // Generates routes.d.ts in the parent of the routes dir
    }))

Usage

The generated routes.d.ts allows you to cast your app to include all autoloaded routes.

import { Elysia } from "elysia";
import { autoload } from "elysia-atlas";
import type { AutoloadedRoutes } from "./routes"; // Generated file

const app = new Elysia()
    .use(await autoload<AutoloadedRoutes>({ typegen: true }));

export type App = typeof app;

Now App contains the type definitions for every route in your routes directory.

Routing Patterns

Files are mapped to routes based on their path relative to the dir option.

| File Path | Route Path | | --- | --- | | routes/index.ts | / | | routes/users.ts | /users | | routes/posts/index.ts | /posts | | routes/settings/profile.ts | /settings/profile |

Intercepts

Define an intercept.ts file in any route directory to intercept all routes in that directory and its subdirectories. Intercept files export a default function that receives an Elysia instance, just like route files.

Intercepts are ideal for applying authentication checks, logging, or any logic that should run before handling requests for a group of routes.

Basic Usage

routes/
├── intercept.ts        ← applies to ALL routes
├── index.ts
├── users.ts
└── admin/
    ├── intercept.ts    ← applies to /admin/* routes (stacks on root intercept)
    ├── settings.ts
    └── analytics/
        └── overview.ts
// routes/intercept.ts — root-level intercept (logging, headers, etc.)
import type { Elysia } from "elysia";

export default <T extends Elysia>(app: T) =>
    app.onBeforeHandle(({ set }) => {
        set.headers["X-Request-Time"] = new Date().toISOString();
    });
// routes/admin/intercept.ts — auth check for admin routes
import type { Elysia } from "elysia";

export default <T extends Elysia>(app: T) =>
    app.onBeforeHandle(({ headers, set }) => {
        if (!headers.authorization) {
            set.status = 401;
            return { error: "Unauthorized" };
        }
    });

How It Works

  • Intercept files are not registered as routesintercept.ts is excluded from both route loading and type generation.
  • Intercepts stack from parent to child — a route at admin/settings.ts receives the root intercept.ts first, then admin/intercept.ts.
  • Same export pattern as routes — the default export receives an Elysia app instance and returns it with hooks applied.

Options

| Key | Type | Default | Description | | --- | --- | --- | --- | | dir | string | "./routes" | Path to the directory containing your routes | | prefix | string | "/" | Prefix to prepend to all autoloaded routes | | typegen | boolean | string | false | If true, generates routes.d.ts. If string, specifies the output path. |