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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@stackpress/ingest

v0.6.3

Published

An unopinionated, event driven, pluggable, server/less framework

Readme

ᗊ Ingest

NPM Package Tests Status Coverage Status Commits License

An unopinionated, event driven, pluggable, server/less framework.

Overview

Ingest is a lightweight, flexible server framework that brings the familiar Express.js-like API to serverless environments. Built on top of the powerful @stackpress/lib event system, Ingest provides a unified approach to building applications that can run anywhere - from traditional Node.js servers to serverless platforms like AWS Lambda, Vercel, and Netlify.

Key Features

  • 🚀 Serverless-First: Designed specifically for serverless environments while maintaining compatibility with traditional servers
  • 🔄 Event-Driven: Built on a robust event system that enables reactive programming patterns
  • 🛣️ Multi-Routing Interface: Four different routing approaches in one framework
  • 🔌 Plugin System: Highly extensible with a simple plugin architecture
  • 📦 Build Support: Exposes routing information for bundlers and build tools
  • 🌐 Cross-Platform: Works with Node.js HTTP, WHATWG Fetch, and various serverless platforms

Installation

npm install @stackpress/ingest
# or
yarn add @stackpress/ingest

Quick Start

Basic HTTP Server

import { server } from '@stackpress/ingest/http';

const app = server();

// Traditional Express-like routing
app.get('/', (req, res) => {
  res.setHTML('<h1>Hello World!</h1>');
});

app.get('/api/users/:id', (req, res) => {
  const userId = req.data.get('id');
  res.setJSON({ id: userId, name: 'John Doe' });
});

// Start the server
app.create().listen(3000, () => {
  console.log('Server running on port 3000');
});

Serverless Function (Vercel)

import { server } from '@stackpress/ingest/whatwg';

const app = server();

app.get('/api/hello', (req, res) => {
  res.setJSON({ message: 'Hello from Vercel!' });
});

export default async function handler(request: Request) {
  return await app.handle(request, new Response());
}

Multi-Routing Interface

Ingest provides four different ways to define routes, giving you flexibility in how you organize your application:

1. Action Router (Traditional)

Express.js-like inline route handlers:

app.action.get('/users', (req, res) => {
  res.setJSON({ users: [] });
});

2. Entry Router (File-based)

Route to files that export default handlers:

app.entry.get('/users', './routes/users.js');

3. Import Router (Lazy Loading)

Dynamic imports for code splitting:

app.import.get('/users', () => import('./routes/users.js'));

4. View Router (Template-based)

Direct template rendering:

app.view.get('/users', './views/users.hbs');

Inferred Routing

Ingest can automatically determine which router to use based on your input:

// Automatically uses action router
app.get('/users', (req, res) => { /* handler */ });

// Automatically uses import router
app.get('/users', () => import('./routes/users.js'));

// Automatically uses view router
app.get('/users', './views/users.hbs');

Plugin System

Ingest features a powerful plugin system that allows you to modularize your application:

Creating a Plugin

// src/plugins/auth.ts
export default function authPlugin(server) {
  server.on('request', (req, res) => {
    // Add authentication logic
    if (!req.headers.get('authorization')) {
      res.setError('Unauthorized', {}, [], 401);
      return false; // Stop processing
    }
  });
}

Registering Plugins

Add plugins to your package.json:

{
  "plugins": [
    "./src/plugins/auth",
    "./src/plugins/logging",
    "@my-org/ingest-plugin"
  ]
}

Bootstrapping

import { server } from '@stackpress/ingest/http';

const app = server();

// Load all plugins
await app.bootstrap();

app.create().listen(3000);

Event-Driven Architecture

Ingest is built on a powerful event system that allows for reactive programming:

// Listen to all requests
app.on('request', (req, res) => {
  console.log(`${req.method} ${req.url.pathname}`);
});

// Listen to specific routes
app.on('GET /api/users', (req, res) => {
  // This runs for GET /api/users
});

// Priority-based listeners
app.on('request', middleware1, 10); // Higher priority
app.on('request', middleware2, 5);  // Lower priority

Deployment Examples

AWS Lambda

import { server } from '@stackpress/ingest/whatwg';

const app = server();
app.get('/api/hello', (req, res) => {
  res.setJSON({ message: 'Hello from Lambda!' });
});

export const handler = async (event, context) => {
  const request = new Request(event.requestContext.http.sourceIp);
  const response = new Response();
  return await app.handle(request, response);
};

Vercel

import { server } from '@stackpress/ingest/whatwg';

const app = server();
app.get('/api/users', (req, res) => {
  res.setJSON({ users: [] });
});

export default async function handler(req: Request) {
  return await app.handle(req, new Response());
}

Netlify

import { server } from '@stackpress/ingest/whatwg';

const app = server();
app.get('/.netlify/functions/api', (req, res) => {
  res.setJSON({ message: 'Hello from Netlify!' });
});

export const handler = async (event, context) => {
  const request = new Request(event.rawUrl);
  const response = new Response();
  return await app.handle(request, response);
};

Build Support

Ingest exposes routing information that can be used by bundlers and build tools:

const app = server();
app.get('/users', () => import('./routes/users.js'));
app.get('/posts', () => import('./routes/posts.js'));

// Access routing information
console.log(app.routes);    // Route definitions
console.log(app.imports);   // Dynamic imports
console.log(app.entries);   // File entries
console.log(app.views);     // View templates

This information can be used by bundlers to:

  • Pre-bundle route modules
  • Generate static route manifests
  • Optimize code splitting
  • Create deployment artifacts

Documentation

Examples

Check out the examples/ directory for complete working examples:

  • with-http - Basic HTTP server
  • with-vercel - Vercel deployment
  • with-lambda - AWS Lambda deployment
  • with-netlify - Netlify deployment
  • with-plugins - Plugin system usage
  • with-handlebars - Template engine integration