2023 年的 Node.js 生態系統
隨著技術的不斷演進和創新,Node.js 在 2023 年達到了一個新的高度。Node.js 擁有一個龐大的生態系統,可以幫助開發人員更快地實現復雜的應用。本文就來看看 Node.js 最新的生態系統,以實現快速技術選型!
本文參考自 Node.js Toolbox( https://nodejstoolbox.com/) 中的數據,Node.js Toolbox 是一個開源的 Node.js 工具,用于在 Node.js 生態系統中查找積極維護且流行的庫。
圖片
訪問控制
根據各種訪問控制模式限制用戶操作。
圖片
@casl/CASL
CASL是一個同構授權 JavaScript 庫,它限制允許給定用戶訪問的資源。
圖片
Github:https://github.com/stalniy/casl
casbin
Node.JS 中支持 ACL、RBAC、ABAC 等訪問控制模型的授權庫。
圖片
Github:https://github.com/casbin/node-casbin
accesscontrol
Node.js 基于角色和屬性的訪問控制。
圖片
Github:https://github.com/onury/accesscontrol
瀏覽器測試
編寫在真實瀏覽器環境中運行的自動化測試。
圖片
Cypress
Cypress 是專為現代網絡構建的下一代前端測試工具。
圖片
Github:https://github.com/cypress-io/cypress
puppeteer
通過 DevTools 協議控制無頭 Chrome 的高級 API。
圖片
Github:https://github.com/puppeteer/puppeteer
@playwright/test
用于自動化 Web 瀏覽器的高級 API。
圖片
Github:https://github.com/Microsoft/playwright
SeleniumHQ/selenium
來自 Selenium 項目的官方 WebDriver JavaScript 綁定。
圖片
Github:https://github.com/SeleniumHQ/selenium
webdriverio
Node.js 的下一代瀏覽器和移動自動化測試框架。
圖片
Github:https://github.com/webdriverio/webdriverio
構建系統
管理包含多個不同項目的代碼庫 (Monorepos)。
圖片
Lerna
Lerna 是一個快速、現代的構建系統,用于管理和發布來自同一存儲庫的多個 JavaScript/TypeScript 包。
圖片
Github:https://github.com/lerna/lerna
turbo
Turborepo 是一個用于 JavaScript 和 TypeScript 代碼庫的高性能構建系統。
圖片
Github:https://github.com/vercel/turbo
nx
核心 Nx 插件包含 Nx 的核心功能,如項目圖、nx 命令和任務編排。
圖片
Github:https://github.com/nrwl/nx
構建工具
將應用的源代碼打包到單個文件中,主要用于前端應用程序以最大限度地減少網絡請求。
圖片
Webpack
為瀏覽器打包 ECMAScript/CommonJs/AMD 模塊。允許將代碼庫拆分為多個包,可以按需加載。支持加載器預處理文件,即 json、jsx、es7、css、less 以及自定義內容。
圖片
Github:https://github.com/webpack/webpack
esbuild
一個極其快速的 JavaScript 和 CSS 打包器和壓縮器。
圖片
Github:https://github.com/evanw/esbuild
rollup
下一代 ES 模塊打包工具。
圖片
Github:https://github.com/rollup/rollup
代碼復雜度
分析和可視化代碼復雜性以幫助重構(遺留)代碼庫
圖片
Typhonjs-escomplex
基于 Babel 解析器的下一代 Javascript 和 Typescript 復雜性報告。
圖片
Github:https://github.com/typhonjs-node-escomplex/typhonjs-escomplex
plato
JavaScript 源代碼分析和可視化工具。
圖片
Github:https://github.com/es-analysis/plato
代碼圖
生成代碼內部依賴關系的可視化圖表。
圖片
madge
從模塊依賴關系創建圖表。
圖片
Github:https://github.com/pahen/madge
dependency-cruiser
驗證并可視化依賴關系。按照規則,JavaScript、TypeScript、CoffeeScript。ES6、CommonJS、AMD。
圖片
Github:https://github.com/sverweij/dependency-cruiser
代碼檢查和格式化程序
在交付生產之前格式化代碼并解決問題。
圖片
eslint
一個基于 AST 的 JavaScript 模式檢查器。
圖片
Github:https://github.com/eslint/eslint
Prettier
Prettier 是一個代碼格式化程序。
圖片
Github:https://github.com/prettier/prettier
@typescript-eslint/eslint-plugin
ESLint 的 TypeScript 插件。
圖片
Github:https://github.com/typescript-eslint/typescript-eslint
命令行提示
通過詢問用戶輸入創建交互式命令行工具。
圖片
inquirer
常見交互式命令行用戶界面的集合。
圖片
Github:https://github.com/SBoudrias/Inquirer.js
prompts
輕量、美觀、人性化的提示。
圖片
Github:https://github.com/terkelg/prompts
enquirer
時尚、直觀、人性化的提示系統。對于小型項目來說足夠快速和輕量,對于最先進的用例來說足夠強大和可擴展。
圖片
Github:https://github.com/enquirer/enquirer
命令行樣式
創建漂亮的命令行工具。
圖片
chalk
終端字符串樣式正確完成
圖片
Github:https://github.com/chalk/chalk
命令行實用程序
使用 Node.js 創建強大的命令行應用。
圖片
commander
Node.js 命令行程序的完整解決方案。
圖片
Github:https://github.com/tj/commander.js
yargs
Yargs 框架通過使用 Node.js 構建功能全面的命令行應用,它能輕松配置命令,解析多個參數,并設置快捷方式等,還能自動生成幫助菜單。
圖片
Github:https://github.com/yargs/yargs
minimist
一個用來解析命令行選項的庫。
圖片
Github:https://github.com/minimistjs/minimist
CSV 解析器
從 Node.js 處理 CSV 文件。
圖片
csv-parse
CSV 解析實現 Node.js stream.Transform API。
圖片
Github:https://github.com/adaltas/node-csv
papaparse
適用于瀏覽器的快速而強大的 CSV 解析器,支持 Web Worker 和流式處理大文件。將 CSV 轉換為 JSON 以及將 JSON 轉換為 CSV。
圖片
Github:https://github.com/mholt/PapaParse
時間&日期
比標準庫更直觀的日期和時間方法。
圖片
moment
解析、驗證、操作和顯示日期。
Github:https://github.com/moment/moment
dayjs
2KB的不可變日期時間庫,是Moment.js的現代API的替代方案。
圖片
Github:https://github.com/iamkun/dayjs
date-fns
現代 JavaScript 日期實用程序庫。
圖片
Github:https://github.com/date-fns/date-fns
依賴管理
檢查過時的依賴項并手動(或自動)更新它們。
圖片
depcheck
查找比 package.json 允許的更新版本的依賴項。
圖片
Github:https://github.com/depcheck/depcheck
npm-check-updates
檢查是否有過時、不正確和未使用的依賴項。
圖片
Github:https://github.com/raineorshine/npm-check-updates
npm-check
自動依賴更新。
圖片
Github:https://github.com/dylang/npm-check
電子郵件傳送
從 Node.js 輕松發送電子郵件。
圖片
nodemailer
從 Node.js 應用發送電子郵件。
圖片
Github:https://github.com/nodemailer/nodemailer
Excel 電子表格
在 Node.js 中解析并編寫 Excel 電子表格
圖片
XLSX
SheetJS 電子表格數據解析器和編寫器。
圖片
Github:https://github.com/SheetJS/sheetjs
exceljs
Excel 工作簿管理器 - 讀寫 xlsx 和 csv 文件。
圖片
Github:https://github.com/exceljs/exceljs
文件上傳
在 Node.js 應用中處理文件上傳。
圖片
busboy
Node.js HTML 表單數據的流式解析器。
圖片
Github:https://github.com/mscdex/busboy
formidable
用于解析表單數據(尤其是文件上傳)的 Node.js 模塊。
圖片
Github:https://github.com/node-formidable/formidable
multer
用于操作“multipart/form-data”的中間件。
圖片
Github:https://github.com/expressjs/multer
全棧框架
使用這些框架快速開發全棧應用。
圖片
Nest
Nest - 現代、快速、強大的 Node.js Web 框架 (@core)。
圖片
Github:https://github.com/nestjs/nest
HTML 抓取工具
從 HTML 中輕松查找并提取所需的數據。
jsdom
許多 Web 標準的 JavaScript 實現。
圖片
Github:https://github.com/jsdom/jsdom
cheerio
專為服務器設計的核心 jQuery 的小型、快速且優雅的實現。
圖片
Github:https://github.com/cheeriojs/cheerio
HTTP 客戶端
發送網絡請求并從外部 API 獲取數據。
圖片
node-fetch
一個輕量級模塊,將 Fetch API 引入 Node.js。
圖片
Github:https://github.com/node-fetch/node-fetch
axios
適用于瀏覽器和 Node.js 的基于 Promise 的 HTTP 客戶端。
圖片
Github:https://github.com/axios/axios
HTTP 框架
基于 HTTP verbs和路由的極簡框架。
圖片
express
快速、極簡的 Web 框架。
圖片
Github:https://github.com/expressjs/express
Koa
Koa Web 應用框架。
圖片
Github:https://github.com/koajs/koa
HTTP 模擬
模擬網絡請求并隔離測試模塊。
圖片
superagent
優雅且功能豐富的瀏覽器/Node.js HTTP 以及流暢的 API。
圖片
Github:https://github.com/ladjs/superagent
nock
一個 HTTP 模擬和預期測試庫,用于 Node.js 平臺。
圖片
Github:https://github.com/nock/nock
msw
適用于瀏覽器和 Node.js 的無縫 REST/GraphQL API 模擬庫。
圖片
Github:https://github.com/mswjs/msw
作業隊列
從主線程中安排和處理 CPU 密集型任務。
圖片
bull
基于Redis的一個Node.js任務隊列管理庫。
圖片
Github:https://github.com/OptimalBits/bull
bullmq
基于Redis的消息和作業隊列。
圖片
Github:https://github.com/taskforcesh/bullmq
JSON 模式驗證器
使用 JSON Schema 語言來驗證用戶輸入和其他任何內容。
圖片
ajv
一個流行的JSON模式驗證庫,用于驗證和校驗JavaScript對象是否符合預定義的JSON模式(JSON Schema)。
圖片
Github:https://github.com/ajv-validator/ajv
JSON Web Token (JWT)
在 Node.js 中簽署并驗證 JWT。
圖片
jsonwebtoken
JSON Web Token 實現(對稱和非對稱)。
圖片
Github:https://github.com/auth0/node-jsonwebtoken
日志記錄
日志記錄事件以幫助調試應用中的問題。
圖片
npmlog
npmlog 是一個用于在命令行界面輸出日志的Node.js庫。
圖片
Github:https://github.com/npm/npmlog
winston
幾乎所有內容的日志記錄器。
圖片
Github:https://github.com/winstonjs/winston
loglevel
JavaScript 的最小輕量級日志記錄,向任何可用的 console.log 方法添加可靠的日志級別方法。
圖片
Github:https://github.com/pimterry/loglevel
MongoDB 客戶端
Node.js 的 MongoDB 客戶端。
圖片
mongodb
Node.js 的官方 MongoDB 驅動程序。
圖片
Github:https://github.com/mongodb/node-mongodb-native
mongoose
Node.js環境下一款優秀的MongoDB對象建模工具。
圖片
Github:https://github.com/Automattic/mongoose
MySQL 客戶端
MySQL 的 Node.js 驅動程序。
圖片
mysql
mysql 的 Node.js 驅動程序。它是用 JavaScript 編寫的,不需要編譯。
圖片
Github:https://github.com/mysqljs/mysql
mysql2
一個用于Node.js的MySQL數據庫驅動程序。它是mysql模塊的一種增強版,提供更高性能和更好的功能。
圖片
Github:https://github.com/sidorares/node-mysql2
對象關系映射 (ORM)
將 SQL 數據庫表映射到 JavaScript 對象。
圖片
Prisma
Prisma 是一個開源數據庫工具包。它包括用于 Node.js 的 JavaScript/TypeScript ORM、遷移和用于查看和編輯數據庫中的數據的現代 GUI。
圖片
Github:https://github.com/prisma/prisma
Sequelize
Sequelize 是一個基于 Promise 的 Node.js ORM 工具,適用于 Postgres、MySQL、MariaDB、SQLite、Microsoft SQL Server、Amazon Redshift 和 Snowflake 的數據云。它具有可靠的事務支持、關系、急切和延遲加載、讀取復制等功能。
Github:https://github.com/sequelize/sequelize
typeorm
適用于 TypeScript、ES7、ES6、ES5 的數據映射器 ORM。支持 MySQL、PostgreSQL、MariaDB、SQLite、MS SQL Server、Oracle、MongoDB 數據庫。
圖片
Github:https://github.com/typeorm/typeorm
對象模式驗證
使用對象模式進行簡單直觀的驗證。
圖片
joi
一個用于JavaScript對象模式驗證的庫。
圖片
Github:https://github.com/hapijs/joi
zod
具有靜態類型推斷的 TypeScript-first 模式聲明和驗證庫。
圖片
Github:https://github.com/colinhacks/zod
yup
非常簡單的對象模式驗證。
圖片
Github:https://github.com/jquense/yup
包發布
自動化包發布工作流程。
圖片
semantic-release
一個自動化版本發布工具,它遵循語義化版本規范,根據提交的代碼變動自動生成適當的版本號,并發布到代碼倉庫。
圖片
Github:https://github.com/semantic-release/semantic-release
standard-version
一個基于語義化版本規范的版本管理工具。它幫助開發者自動化生成版本號和生成變更日志,以及標記代碼庫中的重大版本發布。
圖片
Github:https://github.com/conventional-changelog/standard-version
打包為可執行文件
將 Node.js 應用打包成單個可執行文件。
圖片
@vercel/ncc用于將 Node.js 模塊打包成單個文件。它可以將項目中的多個模塊打包成一個獨立的 JavaScript 文件,方便在不需要依賴管理器或構建工具的環境中運行。
圖片
Github:https://github.com/vercel/ncc
pkg
一個命令行工具,用于將 JavaScript 代碼打包成可執行的二進制文件。它提供了一種將 Node.js 應用程序打包為可獨立運行的可執行文件的方法,無需依賴外部的 Node.js 安裝。
圖片
Github:https://github.com/vercel/pkg
PDF 生成
使用 Node.js 生成 PDF 文件。
圖片
jspdf
一個使用 JavaScript 生成 PDF 文檔的開源庫。
圖片
Github:https://github.com/MrRio/jsPDF
pdfmake
一個用于在客戶端中生成 PDF 文檔的庫。它提供了一種簡單而強大的方式來創建具有豐富內容和樣式的 PDF 文件。
圖片
Github:https://github.com/bpampuch/pdfmake
pdfkit
Node.js 的 PDF 生成庫。
圖片
Github:https://github.com/foliojs/pdfkit
pdf-lib
使用 JavaScript 創建和修改 PDF 文件。
圖片
Github:https://github.com/Hopding/pdf-lib
PostgreSQL 客戶端
從 Node.js 與 PostgreSQL 數據庫交互。
圖片
pg
PostgreSQL 客戶端 - 具有相同 API 的純 javascript 和 libpq。
圖片
Github:https://github.com/brianc/node-postgres
查詢生成
編寫 JavaScript 來構建 SQL 查詢。
圖片
knex
一個以 JavaScript 編寫的 SQL 查詢構建器,用于 Node.js 和瀏覽器環境中與數據庫進行交互。它提供了一套簡潔而強大的 API,使開發者能夠以更直觀的方式構建和執行 SQL 查詢。
圖片
Github:https://github.com/knex/knex
Redis 客戶端
Node.js 的 Redis 客戶端。
圖片
ioredis
適用于 Node.js 的強大、注重性能且功能齊全的 Redis 客戶端。
圖片
Github:https://github.com/luin/ioredis
redis
現代、高性能 Redis 客戶端。
圖片
Github:https://github.com/redis/node-redis
調度
按計劃運行任務。
圖片
cron
一個用于執行定期任務的時間調度工具。它是基于時間的作業調度器,可以按照指定的時間規則自動執行預定的任務。
圖片
Github:https://github.com/kelektiv/node-cron
node-schedule
一個用于在 Node.js 中執行定時任務的模塊。它提供了一種簡單而靈活的方式來安排和管理定時任務,可以根據指定的時間規則觸發任務的執行。
圖片
Github:https://github.com/node-schedule/node-schedule
shell 執行
從 Node.js 執行 shell 命令。
圖片
execa一個用于在 Node.js 中執行外部命令的模塊。
圖片
Github:https://github.com/sindresorhus/execa
shelljs
一個基于 Node.js 的輕量級模塊,它提供了一組可在命令行中運行的 Shell 命令的封裝和工具函數。ShellJS 的目標是讓在 Node.js 環境中使用命令行操作變得更加簡單和方便。
圖片
Github:https://github.com/shelljs/shelljs
SQLite客戶端
SQLite 的 Node.js 驅動程序。
圖片
sqlite3
一個用于訪問 SQLite 數據庫的模塊。SQLite 是一種嵌入式關系型數據庫引擎,它以輕量級和高效性而聞名。sqlite3 模塊允許您在 Node.js 應用程序中使用 JavaScript 來執行與 SQLite 數據庫的交互操作。
圖片
Github:https://github.com/TryGhost/node-sqlite3
better-sqlite3
一個在 Node.js 中使用的 SQLite3 數據庫封裝模塊。它提供了一個簡潔、易用和高性能的接口,讓開發者可以方便地在 Node.js 應用程序中與 SQLite 數據庫交互。
圖片
Github:https://github.com/WiseLibs/better-sqlite3
靜態服務器
在 localhost 上提供靜態生成的站點。
圖片
http-server
一個簡單的命令行工具,用于在您的本地開發環境中快速啟動一個基于 HTTP 的靜態文件服務器。它允許您將當前目錄下的文件作為靜態資源托管,并通過 HTTP 協議提供這些文件。
圖片
Github:https://github.com/http-party/http-server
serve
一個用于在本地開發環境中快速啟動靜態文件服務器的命令行工具。它是由 Vercel 開發的,旨在提供一個簡單、輕量級且易于使用的方式來運行靜態網站或應用程序。
圖片
Github:https://github.com/vercel/serve
模板引擎
渲染動態 HTML 輸出。
圖片
ejs
一種簡單而靈活的模板引擎,用于在Node.js和瀏覽器中生成動態HTML頁面。它允許您在你的HTML模板中嵌入JavaScript代碼,以動態地生成內容。
圖片
Github:https://github.com/mde/ejs
handlebars
一個簡單、高效的模板引擎,用于在 Web 應用程序中生成動態的 HTML 頁面。它基于 Mustache 模板語法,并擴展了一些功能。
圖片
Github:https://github.com/handlebars-lang/handlebars.js
測試框架
幫助編寫自動化測試的框架。
圖片
jest
一個用于 JavaScript 測試的現代化、開源的測試框架。它被廣泛應用于前端開發和 Node.js 環境中,旨在提供簡單、高效和可擴展的測試解決方案。
圖片
Github:https://github.com/facebook/jest
mocha
一個靈活且功能強大的 JavaScript 測試框架。它適用于前端和后端的 JavaScript 應用程序,可用于編寫各種類型的測試,包括單元測試、集成測試和端到端測試等。
圖片
Github:https://github.com/mochajs/mocha
Web 認證
處理 Web 應用的用戶身份驗證。
圖片
express-session
一個用于處理會話管理的 Node.js 中間件。它基于 Express 框架,提供了簡單且易于使用的會話管理解決方案。
圖片
Github:https://github.com/expressjs/session
passport
一個用于身份驗證的 Node.js 中間件。它提供了一種簡單且靈活的方式來實現用戶認證功能。
圖片
Github:https://github.com/jaredhanson/passport
Web 抓取框架
使用 Node.js 爬取和抓取整個網站。
圖片
crawlee
適用于 JavaScript/Node.js 的可擴展網絡爬取庫。支持使用無頭 Chrome 和 Puppeteer 開發數據提取和 Web 自動化作業。
圖片
Github:https://github.com/apify/crawlee