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

@lixinyang123/plankton

v0.2.6

Published

Fast, Sample, Zero dependenecs Node.js mvc web framework

Downloads

153

Readme

Plankton

NPM Version NPM Unpacked Size CI

Plankton is a simple, fast, zero-dependency web framework for Node.js

Features

  • Simple
  • Fast
  • Zero-dependency
  • Small size
  • Support mvc
  • Built-in template engine

Install

This is a Node.js module available through the npm.

npm install @lixinyang123/plankton
# or
yarn add @lixinyang123/plankton

Quick Start

You need create a nodejs project first.

yarn init
yarn add @lixinyang123/plankton
mkdir src
touch src/main.js

copy this code to src/main.js.

import plankton from '@lixinyang123/plankton'

plankton()
    .map('/', (req, res) => {
        res.end('hello world')
    })
    .build()
    .start()

Finally, you can launch your first web app.

node src/main.js
curl localhost:8080

Usage

Here are some basic usages, You can find more in the example folder.

Basic

plankton().map('/', (req, res) => {
    res.end('hello world')
}).build().start()

Group

plankton().mapGroup('api', group => {
    group.map('/', (req, res) => {
        res.end('hello world')
    })
}).build().start()

Middleware

  • src/main.js
import plankton from '@lixinyang123/plankton'
import TestMiddleware from './middlewares/test.js'

let app = plankton()

app.use(async (req, res, next) => {
    console.log('middleware 1 start')
    await next(req, res)
    console.log('middleware 1 end')
})

app.use(TestMiddleware)

app.map('/', (req, res) => {
    res.end('hello world')
})

app.build().start()
  • src/middlewares/test.js
export default async function (req, res, next) {
    res.write('middleware 2 start')
    await next(req, res)
    res.write('middleware 2 end')
}

curl localhost:8080, You can see the output

middleware 1 start
middleware 2 start
middleware 2 end
middleware 1 end

MVC

  • src/main.js
plankton()
    .mapController()
    .build()
    .start()
  • src/controllers/home.js
export default {
    index: async (req, res) => {
        await res.render('index.ejs', { action: 'index' })
    },

    about: async (req, res) => {
        await res.render('about.ejs', { action: 'about' })
    }
}
  • src/views/index.ejs
<body>
    <h1>Hello world from action: <%= action %></h1>
</body>

Layout

  • src/views/_layout.ejs
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Example</title>
</head>
<body>
    <header>Header</header>
        <%{{ content }}%>
    <footer>Footer</footer>
</body>
</html>
  • src/views/home/index.ejs
<%{ '../_layout.ejs' }%>

<%{ content %>
    <div>
        <% for (let i = 0; i < 5; i++) { %>
            <h1>Hello <%= world %></h1>
        <% } %>
    </div>
<%} %>
  • src/main.js
plankton().map('/', async (req, res) => {
    await res.render('index.ejs', { world: 'world' })
}).build().start()

StaticFile

let app = plankton()

// map static file
app.useStaticFile()
app.useStaticFile('static', 'test')

app.map('/', (req, res) => {
    res.redirect('/index.html')
})

app.build().start()

Cors

plankton()
    .useCors()
    .map('/', (req, res) => {
        res.end('hello world')
    }).build().start()

Logger

plankton()
    .useLogger((msg, level) => {
        // handler...
    })
    .map('/', (req, res) => {
        res.end('hello world')
    }).build().start()

Cookie

plankton()
    .map('/', (req, res) => {
        res.cookie('hello', 'world')
        res.end('hello world')
    })
    .map('/test', (req, res) => {
        res.end('hello ' + req.cookie['hello'])
    })
    .build()
    .start(8080)

res.cookie(key, value, expires, path)

Session

plankton()
    .useSession(/* 1000 * 5 */)
    .map('/', (req, res) => {
        res.session.set('hello', 'world')
        res.end('hello world')
    })
    .map('/test', (req, res) => {
        res.end('hello ' + req.session.get('hello'))
    })
    .build()
    .start(8080)

default session expires is 30 mins