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

express-lyte

v1.0.0

Published

A lyte version of express compatible with express extensions.

Readme

express-lyte

express-lyte is a lightweight library for quickly setting up APIs with Express. It simplifies the API creation process and ensures compatibility with popular Express extensions, like express-rate-limit. With minimal configuration, you can easily structure your API, manage routes, and extend your app's functionality.

Features

  • Simple API and router creation
  • Compatible with popular Express extensions (e.g., express-rate-limit)
  • Easy setup for versioned APIs
  • Flexible routing with minimal configuration
  • Built-in support for rate limiting, authentication, and more

Installation

To install express-lyte, run the following command:

npm install express-lyte

Usage

Basic Setup

express-lyte allows you to create APIs with versioned routes. Below is an example of setting up a versioned API with rate limiting and authentication.

const { API, Router, Auth, RateLimiter } = require("express-lyte");

const Authization = new Auth([                      // Creates an auth gateway for your API.
    "cd9e7837-9194-4009-ad2c-b698368b8423"
]);

const apiV1Router = new Router({ name: "V1 API", path: "/api/v1" });           // Creates a route for /api/v1
const apiV2Router = new Router({ name: "V2 API", path: "/api/v2" });           // Creates a route for /api/v2

apiV1Router.get("/", (req, res) => { res.json({ timestamp: Date.now() }); });  // Creates a GET endpoint at /api/v1/
apiV2Router.get("/", (req, res) => { res.json({ timestamp: Date.now() }); });  // Creates a GET endpoint at /api/v2/

// Rate limiter setup
const limiter = new RateLimiter({
    window: 5 * 60 * 1000,  // Limit requests to every 5 minutes
    max: 100,               // Max 100 requests per window
    message: "Too many requests from this IP, please try again later."
});

const api = new API({                   // Creates an API instance.
    port: 8081,                         // Set the API to run on port 8081.
    Routers: [apiV1Router, apiV2Router]  // Attach versioned routers to the API.
});

// Apply the rate limiter globally
api.use(limiter);

// Apply the authorization gateway globally
api.use(Authization);

api.listen(() => {                      // Start the API.
    console.log("API is running");      // Log a message when the API starts.
});

Explanation

  • Router Setup: You define versioned routes (e.g., /api/v1, /api/v2) using Router. This helps organize your API endpoints into logical versions.

  • Rate Limiting: The RateLimiter class is used to limit the number of requests per IP in a 5-minute window (maximum of 100 requests). If the limit is exceeded, the message "Too many requests from this IP, please try again later" is sent.

  • Authentication: The Auth class provides an easy way to enforce authentication in your API. In the example, an API key "cd9e7837-9194-4009-ad2c-b698368b8423" is required for accessing the routes. If a request doesn't include a valid API key, it is denied.

  • API Initialization: Create an API instance, attach routers, and start the server on port 8081. The rate limiter and authentication middleware are applied globally using api.use().

Compatibility

express-lyte is fully compatible with popular Express extensions. In the above example, RateLimiter is used to manage the rate of requests, and Auth is used to secure the API. You can easily integrate other middlewares or extensions to suit your app’s needs.

Documentation

For more detailed documentation, visit the GitHub repository:

https://github.com/ShadyM00n/express-lyte

Contributing

Feel free to submit issues or pull requests. Contributions are welcome!

License

MIT License. See the License file for more details.