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

princejs

v1.8.0

Published

An easy and fast backend framework that is among the top three — by a 13yo developer, for developers.

Readme

👑 PrinceJS

⚡ Ultra-clean, modern & minimal Bun web framework built by a 13 year old. Among the top three in performance.

npm stars downloads license


🚀 Quick Start

bun create princejs my-app
cd my-app
bun dev
import { prince } from "princejs";
import { cors, logger } from "princejs/middleware";

const app = prince();

app.use(cors());
app.use(logger());

app.get("/", () => ({ message: "Hello PrinceJS!" }));
app.get("/users/:id", (req) => ({ id: req.params.id }));

app.listen(3000);

🧰 Features

import { cors, logger, rateLimit, serve } from "princejs/middleware";
import { validate } from "princejs/validation";
import { z } from "zod";

app
  .use(cors())
  .use(logger())
  .use(rateLimit({ max: 100, window: 60 }))
  .use(serve({ root: "./public" }))
  .use(validate(z.object({ 
    name: z.string(),
    age: z.number() 
  })));

✓ Middleware

  • CORS
  • Logger
  • Rate Limiting
  • Static Files

✓ Validation (Zod)

✓ File Uploads

✓ Response Builder

WebSocket Support

Auth & API Keys

Server-Sent Events

Sessions

Response Compression

Database (SQLite)


Performance With Oha (oha -c 100 -z 30s)

| Framework | Req/s | Total | |-----------|----------------|--------| | Elysia | 25,312 req/s | 759k | | Hono | 22,124 req/s | 664k | | PrinceJS | 21,748 req/s | 653k | | Express | 9,325 req/s | 280k |

Among the top three


🎯 Full Example

import { prince } from "princejs";
import { cors, logger, rateLimit, auth, apiKey, jwt, session, compress } from "princejs/middleware";
import { validate } from "princejs/validation";
import { cache, upload, sse } from "princejs/helpers";
import { cron } from "princejs/scheduler";
import { Html, Head, Body, H1, P, render } from "princejs/jsx"
import { db } from "princejs/db";
import { z } from "zod";

const app = prince(true);

app.use(cors());
app.use(logger());
app.use(rateLimit({ max: 100, window: 60 }));

app.use(validate(z.object({ name: z.string() })));

app.use(jwt(key));
app.use(session({ secret: "key" }));
app.use(compress());

const Page = () => (
  Html({
    children: [
      Head({
        children: [
          "Test Page"
        ]
      }),
      Body({
        children: [
          H1({
            children: "Hello World"
          }),
          P({
            children: "This is a test"
          })
        ]
      })
    ]
  })
);

const users = db.sqlite("./db.sqlite", "CREATE TABLE users...");

app.ws("/chat", {
  open: (ws) => ws.send("Welcome!"),
  message: (ws, msg) => ws.send(`Echo: ${msg}`)
});


app.get("/protected", auth(), (req) => ({ user: req.user }));
app.get("/api", apiKey({ keys: ["key_123"] }), handler);

app.get("/", () => ({ message: "Welcome to PrinceJS" }));

app.get("/users/:id", (req) => ({ id: req.params.id }));

app.get("/jsx", () => render(Page()));

app.get("/data", cache(60)(() => ({ time: Date.now() })));

app.post("/upload", upload(), (req) => ({ files: Object.keys(req.files || {}) }));

app.get("/events", sse(), (req) => {
  setInterval(() => req.sseSend({ time: Date.now() }), 1000);
});

app.get("/count", (req) => ({ visits: req.session.visits++ || 1 }));

app.get("/users", () => users.query("SELECT * FROM users"));

cron("*/1 * * * *", () => console.log("PrinceJS heartbeat"));

app.listen(3000);

📦 Installation

npm install princejs
# or
bun add princejs
# or
yarn add princejs

📚 Documentation

Visit: princejs.vercel.app


🤝 Contributing

git clone https://github.com/MatthewTheCoder1218/princejs
cd princejs
bun install
bun test

⭐ Star This Repo

If PrinceJS helped you, star the repo!

GitHub: https://github.com/MatthewTheCoder1218/princejs


🔗 Links


PrinceJS: Small in size. Giant in capability. 🚀