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

bunflow

v1.0.0

Published

🌊 BunFlow — The blazing-fast full-stack framework for Bun

Readme

🌊 BunFlow

El framework full-stack más rápido para Bun. Inspirado en Spring Boot, Laravel y Angular — reimaginado desde cero para Bun.

Bun TypeScript License: MIT


¿Qué es BunFlow?

BunFlow es un framework de Node.js/Bun que combina lo mejor de los mejores frameworks:

| Feature | Inspirado en | |---------|-------------| | IoC Container & Providers | Spring Boot | | Router & Eloquent ORM | Laravel | | Estructura modular | Angular | | Velocidad & APIs nativas | Bun |

Sin dependencias externas en el core — todo usa las APIs nativas de Bun.


Instalación

# Instalar BunFlow CLI globalmente
bun add -g bunflow

# Crear un proyecto nuevo
bunflow new mi-api --template=rest-api

# Entrar al proyecto
cd mi-api && bun install

# Iniciar en desarrollo
bunflow serve

Inicio Rápido

import { createApp, response, cors } from "bunflow";

const app = createApp({ port: 3000 });

app.use(cors());

app.routes((router) => {
  router.get("/", () => response.ok({ message: "Hello BunFlow! 🌊" }));

  router.post("/echo", async (ctx) => {
    const body = await ctx.json();
    return response.ok(body);
  });
});

app.listen();

CLI Commands

bunflow new <nombre>                    # Crear proyecto
bunflow new <n> --template=rest-api     # Con template específico
bunflow new <n> --template=microservice
bunflow new <n> --template=websocket

bunflow generate controller UserController   # Generar controller
bunflow generate model Post                  # Generar model
bunflow generate middleware AuthMiddleware   # Generar middleware
bunflow generate service EmailService       # Generar service

bunflow serve    # Dev server con hot reload
bunflow build    # Build para producción

Templates Disponibles

| Template | Descripción | |----------|-------------| | rest-api | REST API completa con JWT, ORM, validación | | microservice | Microservicio ligero con métricas | | websocket | Real-time con WebSocket nativo de Bun | | fullstack | API + SSR/HTML rendering |


Módulos del Framework

🛣️ Router

app.routes((router) => {
  // Métodos HTTP
  router.get("/users", handler);
  router.post("/users", handler);
  router.put("/users/:id", handler);
  router.patch("/users/:id", handler);
  router.delete("/users/:id", handler);

  // Grupos con prefijo y middlewares
  router.group({ prefix: "/api/v1", middlewares: [auth(secret)] }, (r) => {
    r.get("/dashboard", dashboardHandler);
  });

  // Resource (CRUD automático)
  router.resource("/posts", PostController);
});

🗄️ FlowORM

import { connect, Schema, table } from "bunflow";

// Conexión
connect("./database.sqlite");

// Migraciones
Schema.create("users", (t) => {
  t.id();
  t.string("name");
  t.string("email");
  t.boolean("active", true);
  t.timestamps();
});

// Query Builder
const users = table("users")
  .where("active", true)
  .orderBy("name")
  .paginate(1, 10)
  .all();

const user = table("users").find(1);
const newUser = table("users").insert({ name: "Ana", email: "[email protected]" });
table("users").where("id", 1).update({ name: "Ana García" });
table("users").where("id", 1).delete();

✅ Validación

import { validate } from "bunflow";

const { valid, errors } = validate(body, {
  name: "required|string|min:2|max:50",
  email: "required|email",
  password: "required|string|min:8",
  role: "required|in:admin,user,editor",
});

if (!valid) return response.badRequest("Validation failed", errors);

🔐 Auth JWT

import { auth, signJWT, verifyJWT, hash } from "bunflow";

// Middleware de protección
router.group({ middlewares: [auth(process.env.JWT_SECRET!)] }, (r) => {
  r.get("/me", (ctx) => response.ok(ctx.user));
});

// Generar token
const token = await signJWT({ userId: 1 }, secret, 3600);

// Verificar
const payload = await verifyJWT(token, secret);

// Hash passwords (Bun nativo)
const hashed = await hash.make("password123");
const valid = await hash.verify("password123", hashed);

📦 IoC Container

import { createApp } from "bunflow";

const app = createApp();

// Registrar providers
app.register({
  register(container) {
    container.singleton("db", () => new Database());
    container.bind("emailService", (c) => new EmailService(c.make("db")));
  },
  async boot(container) {
    await container.make<Database>("db").connect();
  }
});

🔄 EventEmitter

import { EventEmitter } from "bunflow";

const events = new EventEmitter();

events.on("user:created", async (user) => {
  await sendWelcomeEmail(user.email);
});

events.emit("user:created", { email: "[email protected]" });

💾 Cache

import { cache } from "bunflow";

cache.set("key", value, 300); // TTL: 5 min
const value = cache.get("key");

// Cache-aside pattern
const data = await cache.remember("users:all", 60, async () => {
  return await fetchFromDB();
});

Middlewares Built-in

import { cors, auth, rateLimit, logger } from "bunflow";

app
  .use(cors({ origin: "https://myapp.com", credentials: true }))
  .use(rateLimit({ windowMs: 60_000, max: 100 }))
  .use(logger());

Response Helpers

import { response } from "bunflow";

response.ok(data)           // 200
response.created(data)      // 201
response.noContent()        // 204
response.badRequest(msg)    // 400
response.unauthorized(msg)  // 401
response.forbidden(msg)     // 403
response.notFound(msg)      // 404
response.serverError(msg)   // 500

Estructura de Proyecto

mi-api/
├── src/
│   ├── main.ts              # Entry point
│   ├── controllers/         # HTTP Controllers
│   │   └── UserController.ts
│   ├── models/              # Data Models
│   │   └── User.ts
│   ├── middlewares/         # Custom Middlewares
│   │   └── AdminMiddleware.ts
│   ├── services/            # Business Logic
│   │   └── AuthService.ts
│   └── routes/              # Route definitions
│       └── api.ts
├── .env
├── package.json
└── tsconfig.json

Benchmark (vs otros frameworks)

| Framework | Req/s | Latency | |-----------|-------|---------| | BunFlow | ~180,000 | ~0.5ms | | Express (Node) | ~45,000 | ~2.2ms | | Fastify (Node) | ~75,000 | ~1.3ms | | Hono (Bun) | ~190,000 | ~0.5ms |

BunFlow usa Bun.serve nativo, sin overhead adicional.


Licencia

MIT © BunFlow Team