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

@acai/server

v3.0.0-beta.45

Published

The base server for the açai framework

Readme

Açai Server Module

https://gitlab.com/acaijs/server.git https://www.npmjs.com/package/@acai/server https://www.npmjs.com/package/@acai/server https://www.npmjs.com/package/@acai/server

The server is responsible for actually handling incoming requests, and delivering them back to the user. It has support for middlewares and providers.

Usage

import server from "@acai/server";

// we are going to use Açai's router to control our routes, but you can easily overwrite this, will be shown next
const route = server.getRoute();

route.options({ middleware: ["test"] }, () => {
  route.get("/", "file/test@index");
});

const instance = new server();

// Middlewares are optional
instance.addMiddleware("test", (data, next) => next(data));

instance.run();

Overwriting router

If you do not wish to use our router, you can easily overwrite it:

const instance = new server();

instance.setOnRequest((url: string, method: string) => {
  return {
    route: match.path,
    // file to load from the route match
    controller: ".",
    // method to call inside of the file (optional)
    method: "index",
    // extra options, such as middleware, etc
    options: match.options,
    // variables match from the dynamic route
    params: match.variables,
    // query params
    query: query,
    // request body
    fields: content.fields,
    // request files (in case of formdata)
    files: content.files,
  };
});

You can use this for example, if you wish to point all routes to a single frontend, in case of a SPA.

Providers

Providers are the main way to boot things in your application, helping you setup your application in an organized manner.

const instance = new server();

class Provider {
  public boot() {
    /* do something */
  }
}

// aliased middleware
instance.addProvider(Provider);

instance.run();

Middlewares

Middleware is a pipeline that runs before the request actually reaches your code, making changes to the request content, or even bailing it out. You can use them for authentication, validation or anything alike.

const instance = new server();

// aliased middleware
instance.addMiddleware("test", (data, next) => next(data));

// grouped aliased middlewares
instance.addMiddlewares({
  test: (data, next) => next(data),
  auth: (data, next) => "404",
});

// global middleware
instance.addGlobalMiddleware([(data, next) => next(data)]);

instance.run();
  • global middlewares will run in every request of your application
  • aliased middleware are middlewares that you can call through your routes, for privileged requests, and such.

Responses

We provide you with a response utility method that can help you import files, return request status codes, etc. Remember that the server smart guesses from the response you are giving, turning json into actual json and etc.

import { response } from "@acai/server";

// return this to the server to load a file from the project root
response().view("./views/index.html");
// change the response status code
response().status(201).data({});