簡介:本次調查由阿里巴巴、騰訊等公司領銜,調查時間從 2020 年 2 月至 4 月,以中文進行。截止至 4 月 10 日共有 1113 名受訪者參加調研。本報告將從 Nodejs 開發者人羣、應用場景、開發場景等多個維度分析當下 Nodejs 開發生態的現狀。前端
做者:冰森 git
更多優質內容:點擊這裏github
![image.png image.png](http://static.javashuo.com/static/loading.gif)
導讀:本次調查由阿里巴巴、騰訊等公司領銜,調查時間從 2020 年 2 月至 4 月,以中文進行。截止至 4 月 10 日共有 1113 名受訪者參加調研。本報告將從 Nodejs 開發者人羣、應用場景、開發場景等多個維度分析當下 Nodejs 開發生態的現狀。
更好的閱讀體驗:更高清的數據圖表和交互體驗能夠點擊閱讀原文跳轉至相關 GitHub 頁面查看。sql
受訪者
人物來源
本次調查問卷中,填寫問卷的 Node.js 開發者主要年齡分佈以下: 數據庫
![image.png image.png](http://static.javashuo.com/static/loading.gif)
他們的主要分佈狀況爲: npm
![image.png image.png](http://static.javashuo.com/static/loading.gif)
其中以城市角度看,人數分佈主要是: 編程
![image.png image.png](http://static.javashuo.com/static/loading.gif)
職業簡歷
- 典型的受訪者來自兩種公司,分別是百人左右的小型公司,以及 5k 人以上的大公司。
- 他們一般是 7 人左右的團隊內的前端或者全棧工程師。
![image.png image.png](http://static.javashuo.com/static/loading.gif)
工做內容
應用場景
- Node.js 的典型應用場景是網站開發。
- 大公司內會有更多的人使用 Node.js 進行工具 & 自動化開發。
- 中小公司會更樂意在移動應用中嘗試 Node.js。
- 很多人 (35.01%) 學習 Node.js 是出於業餘愛好,在小公司更加明顯。
![image.png image.png](http://static.javashuo.com/static/loading.gif)
開發場景
- 總體而言有 87.50% 使用 Node.js 開發服務端 API,有 51.19% 的人開發 CLI & 工具。
- 隨着使用年限增長將 Node.js 做爲服務端 API 的比率略有降低 (5%) 而 BFF 的使用場景略有上漲 (4%)。
- 越年輕的使用者越願意在 SSR 場景中使用 Node.js。
![image.png image.png](http://static.javashuo.com/static/loading.gif)
多語言
- 與 Node.js 開發最契合的是前端開發語言(JavaScript/HTML/CSS)。
- 除了前端,總體上與 Node.js 最多見並存的語言分別是 Java(25.27%)、Python(22.24%) 和 Go(17.73%)。
![image.png image.png](http://static.javashuo.com/static/loading.gif)
開發流程
代碼轉譯
- 隨着 Node.js 使用年限增長,不轉譯的比率大幅降低 (45% 到 25%)。
- TypeScript 是最經常使用的轉譯語言。
![image.png image.png](http://static.javashuo.com/static/loading.gif)
代碼檢查
- 總體上有 90% 的 Node.js 開發者使用過 ESLint。
- 隨着團隊規模的增大 TSLint 的使用存在微小的增幅。
![image.png image.png](http://static.javashuo.com/static/loading.gif)
配置方式
- 文件配置是最流行的配置方式。
- 雖然配置中心使用機率不高,不過公司規模越大則配置中心的使用機率越高。
![image.png image.png](http://static.javashuo.com/static/loading.gif)
編輯器
- VS Code 一騎絕塵,是 Node.js 開發者最喜好開發工具
![image.png image.png](http://static.javashuo.com/static/loading.gif)
進程管理
- 公司越大使用 Docker 的比例越高。
- 中型公司使用 PM2 的比例更高。
![image.png image.png](http://static.javashuo.com/static/loading.gif)
操做系統
![image.png image.png](http://static.javashuo.com/static/loading.gif)
技術棧
一個典型的 Node.js Web 應用:性能優化
- 使用 Express/Koa 框架
- 使用 Mysql/MongoDB + Redis 數據
- 同時配置了 Nginx 做爲反向代理
Web 框架
- 雖然感覺上 Koa.js 的教程更多,可是實際上 Express.js 依舊是最多見的框架。
- 除了 Koa/Express 以外較流行的 Web 框架分別有 Egg.js (38%)、Nest.js (15%)、Next.js (7%) 和 Midway.js (6%)。
![image.png image.png](http://static.javashuo.com/static/loading.gif)
數據庫
在 2020 年,若是要學三個數據庫,那麼請學習 MySQL (79%)、MongoDB (60%) 和 Redis (49%)。多線程
![image.png image.png](http://static.javashuo.com/static/loading.gif)
反向代理
- Noder 們對於反向代理的概念是約等於 Nginx 的。
- 使用反向代理的基本都會使用 Nginx。
- 越大的公司越傾向於使用反向代理。
![image.png image.png](http://static.javashuo.com/static/loading.gif)
RPC
- HTTP 是最多見的 RPC 方式,此外使用最多的是消息隊列。
- 中型公司使用消息隊列的比率最高。
- 大公司使用自研 RPC 協議的比率最高。
![image.png image.png](http://static.javashuo.com/static/loading.gif)
消息隊列
- 經常使用的消息隊列(多選) 僅 18% 的同窗填寫消息隊列(問卷星渠道不包括)
![image.png image.png](http://static.javashuo.com/static/loading.gif)
開發生態
Node 版本
- 在 2020 年,開發者們廣泛使用 12.x 或更高版本 13.x。
- 除了 NPM, 最流行的管理工具主要是 yarn 以及 cnpm。
- 僅有不到 6% 的開發者在使用非 LTS 版本的 Node.js。
![image.png image.png](http://static.javashuo.com/static/loading.gif)
依賴管理
- NPM 影響力巨大,僅有不到 6% 的同窗能夠擺脫 NPM 只使用其餘的依賴管理工具。
- 除了 NPM, 最流行的管理工具主要是 yarn 以及 cnpm。
- 隨着開發經驗的增長,開發者會更多的試圖尋找 NPM 之外的依賴管理工具。
![image.png image.png](http://static.javashuo.com/static/loading.gif)
NPM 鏡像
- 使用鏡像加速的同窗超過 57%,可是這對 NPM 的下載速度並無起到決定性的影響。
- 經過比例分析能夠發現,除了鏡像加速,下載速度越快的同窗中公司部署私有 NPM 鏡像的比例越高。
![image.png image.png](http://static.javashuo.com/static/loading.gif)
學習提高
學習途徑
- 老司機更多的從開源代碼 (Github & NPM) 來學習 Node.js。
- 新同窗相比之下會更多的經過學習視頻以及博客 & 期刊等渠道學習。
![image.png image.png](http://static.javashuo.com/static/loading.gif)
使用困惑
- Node 開發者使用困惑的前三分別是性能優化 (58%)、內存泄漏 (42.4%) 以及 Debug (24.89%)。
- 新人更容易面臨的困惑前三分別是 異步編程、事件驅動以及 Debug。
- 隨着開發經驗的增長,內存泄漏的比例也逐步上升。
![image.png image.png](http://static.javashuo.com/static/loading.gif)
資源需求
- 文檔是你們最期待的資源。
- 新同窗對視頻教程和免費在線課程的呼聲最高。
- 隨着開發經驗的增長,開發更加關注文檔、大會活動以及線下沙龍。
![image.png image.png](http://static.javashuo.com/static/loading.gif)
將來關鍵字
- Serverless 和多線程是 2020 年的 Noder 們最關注的新關鍵字。
- 從業經驗越高則越關注 WebAssembly (WASI) 和 N-API。
- 越年輕的同窗越關注 Deno。
![image.png image.png](http://static.javashuo.com/static/loading.gif)
生態指望
- Node.js 開發者中呼聲最高的需求是更好的性能以及開發效率。
- 此外不滿 1 年的開發者更關心學習成本,年限越長越關心維護成本。
![image.png image.png](http://static.javashuo.com/static/loading.gif)
最後
一樣的數據在不一樣的人眼裏能夠衍生出不一樣的見解,本報告內的解讀僅供參考。同時歡迎社區同窗對本報告進行解讀和分析。框架
若是發現有疏漏或者有你本身的想法/吐槽均可以在GitHub上提 issue 反饋。