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

cobweb-app

v2.0.1

Published

fibjs based microservice framework

Readme

蛛网(Cobweb) - 生产级微服务框架

📋 项目信息

|标题|内容| |--|--| |作者|姚乔锋| |版本|2.0.1| |说明|基于Fibjs的多模态高可用框架| |License|MIT|

🌟 关于 Fibjs

Cobweb 基于 Fibjs 构建,Fibjs 是一个高性能的 JavaScript 运行时环境:

  • 协程(Fiber): 使用协程而非 Promise,所有 I/O 操作都是同步写法
  • 高性能: 基于 V8 引擎,性能优于传统 Node.js
  • 简洁代码: 无需 async/await,代码更简洁易读
  • 内置模块: 丰富的内置模块支持

重要: Cobweb 中的所有方法都使用同步风格编写,不需要 async/await 或 Promise。

✨ 核心特性

  • 🚀 灵活部署 - 支持单机单服务和多机微服务两种部署模式
  • 🔄 热重启 - 无需停机即可更新服务代码
  • 🔗 分布式事务 - 内置分布式事务服务器,保证数据一致性
  • 📡 服务注册与发现 - 集成注册中心,自动服务发现和健康检测
  • 🔍 链路跟踪 - 完整的请求链路追踪能力
  • 📊 日志管理 - 统一的日志收集和管理
  • 📈 监控输出 - 实时监控数据收集和输出
  • 💾 数据库支持 - 开箱即用的 MySQL、PostgreSQL 支持
  • 缓存支持 - 集成 Redis 缓存管理
  • 🎯 多协议支持 - 支持 HTTP、TCP、WebSocket 等多种通信协议

📦 模块说明

|模块名称|说明| |--|--| |cobweb-app|主应用模块,管理所有模块的生命周期和调用| |cobweb-cache|缓存管理模块,封装缓存的连接池和使用| |cobweb-crontab|定时任务模块,提供灵活的定时任务调度| |cobweb-database|数据库管理模块,封装数据库的连接池和使用| |cobweb-kit|工具函数模块,提供一些便捷的函数功能| |cobweb-logger|日志模块,集成日志封装、日志服务器、标准日志处理器| |cobweb-monitor|监控模块,集成监控功能和监控服务器| |cobweb-mysql|MySQL数据库模块,集成数据库连接和SQL语句的处理| |cobweb-pgsql|PostgreSQL数据库模块,集成PostgreSQL的连接和使用| |cobweb-pool|连接池管理模块,提供通用的连接池实现| |cobweb-redis|Redis缓存模块,集成Redis的连接和具体的调用| |cobweb-register|注册中心,开启微服务模式使用,集成服务发现、健康检测等| |cobweb-server|服务器模块,集成TCP、WebSocket、HTTP等协议的封装和抽象| |cobweb-transactions|分布式事务服务器,集成分布式事务的处理|

🚀 快速开始

安装

npm install cobweb-app cobweb-server cobweb-redis cobweb-mysql

创建应用

import {Application} from "cobweb-app";
import {Redis} from "cobweb-redis";
import {MySQL} from "cobweb-mysql";

new Application({
    name: "demo",
    http: {
        host: "0.0.0.0",
        port: 8889
    },
    workPath: {
        services: "./src/services",
        models: "./src/models"
    },
    response: {
        codeField: "code",
        msgField: "message",
        dataField: "data",
        successMsg: "success",
        successCode: "10000",
        unknownFailCode: "0"
    },
    cache: {
        handle: new Redis(),
        size: 10,
        config: {
            host: "127.0.0.1",
            port: 6379
        }
    },
    database: {
        handle: new MySQL(),
        size: 10,
        config: {
            host: "127.0.0.1",
            port: 3306,
            user: "root",
            password: "root",
            database: "mydb"
        }
    },
    logger: {}
});

创建服务

import {Service, Server, Register} from "cobweb-app/service";

@Server
export default class extends Service {
    @Register()
    hello(opts: any): string {
        return "Hello, Cobweb!";
    }

    @Register()
    getUser(opts: any): any {
        return this.model('user').find({id: opts.id});
    }
}

启动应用

fib-typify ./app.ts

访问 http://localhost:8889/hello 即可看到结果。

📖 完整文档

详细文档请查看 docs 目录:

📚 示例项目

项目中包含了完整的示例代码:

🏗️ 架构概览

graph TB
    subgraph 服务层
        A1[HTTP Server<br/>HTTP协议]
        A2[TCP Server<br/>RPC协议]
        A3[WS Server<br/>WebSocket]
    end
    
    subgraph 核心层
        B1[Application Manager<br/>应用管理器]
    end

    subgraph 应用层 
        direction LR
        C1[Services 业务服务]
        C2[Models 数据模型]
    end

    subgraph 抽象层
        D1[Cache<br/>缓存管理]
        D2[Database<br/>数据库管理]
        D3[Logger<br/>日志管理]
    end
    
    subgraph 实现层
        E1[Redis 缓存]
        E2[MySQL 关系型]
        E3[PostgreSQL 关系型]
        E4[Embed 内置日志]
    end
    
    A1 --> B1
    A2 --> B1
    A3 --> B1
    B1 --> C1
    B1 --> D3
    C1 --> C2
    C1 --> D1
    C2 --> D2
    D1 --> E1
    D2 --> E2
    D2 --> E3
    D3 --> E4

详细架构说明请查看 架构设计文档

🤝 贡献

欢迎提交 Issue 和 Pull Request!

📄 License

MIT License

📮 联系方式

  • 作者:姚乔锋
  • 版本:1.3.0