B06 · Framework 生態比較 詳細 ROADMAP

計畫文件,不會被 Quartz 渲染。 回主 roadmap → backend/ROADMAP.md


章節目標

Framework 是後端生產力的放大器。本章聚焦跨生態選型(Node.js / Python / Go / Java / PHP / C# / Rust 各自的 framework 比較),各 framework 的深入教學backend/framework/{name}/ 觸發子目錄。


🌱 基本介紹

#主題SlugStage大綱
01Backend Framework 是什麼01-what-is-backend-framework🌱Framework 在後端的角色:路由 / 中介層 / 資料綁定 / 依賴注入 / ORM 整合 / 生命週期

❓ 為什麼需要

#主題SlugStage大綱
02為什麼不用 framework(直接用 stdlib)不行02-why-not-stdlib🌱路由 / middleware / validation / error handling / DI 每個你都要重寫、跟社群脫節、onboarding 新人成本;但 W04 walkthrough 會強迫你寫一次體驗到
03為什麼同語言要有多個 framework03-why-multiple-frameworks🌱使用場景不同(API / 全端 / 微服務 / serverless)、設計哲學不同(explicit vs magic)、樣板量偏好不同
04為什麼 2026 還有 Express / Django / Spring04-why-legacy-frameworks-alive🌱生態慣性、招募市場、既有系統成本、「無聊但可靠」的價值

🕰️ 演進

#主題SlugStage大綱
05Web Framework 演進史05-web-framework-evolution🌱CGI → mod_*(Apache)→ Rails 2004 顛覆 → Node 2009 → async framework 回潮(Node.js / FastAPI / Axum)→ minimal API 簡化(Spring WebFlux / ASP.NET minimal / FastAPI)
06Magic vs Explicit 光譜06-magic-vs-explicit🌱Laravel / Rails / Django 重 magic → Express / Gin / Echo explicit → Spring Boot annotation magic → Go 回歸 explicit;各世代的鐘擺
07Framework 選型方法論⛔️ micro-service/37-framework-selection-methodology🌿跨系列
08Framework 選型實際案例⛔️ micro-service/38-framework-selection-cases🌿跨系列

🧠 知識型

F06-A 各生態選型比較

#生態主題SlugStage大綱
09Node.jsExpress / Fastify / Hono / Elysia / NestJS 比較09-nodejs-framework-comparison🌱5 大 framework 的定位;HTTP 效能 / 中介層機制 / DI / TS 整合
10PythonDjango / FastAPI / Flask / Starlette 比較10-python-framework-comparison🌱async 支援 / 樣板量 / batteries-included 程度
11GoGin / Echo / Chi / Fiber 比較11-go-framework-comparison🌱stdlib 為主還是 framework;middleware 生態
12JVMSpring Boot / Micronaut / Quarkus / Ktor12-jvm-framework-comparison🌱startup time(Quarkus / Micronaut 解 Spring 痛點)、native image
13PHPLaravel / Symfony / Slim13-php-framework-comparison🌱Laravel 全能 vs Symfony 組件、Swoole / RoadRunner 改變傳統 FPM
14C# / .NETASP.NET Core / Minimal API / Orleans14-dotnet-framework-comparison🌱Kestrel 效能、minimal API 的 Express 化、Orleans actor
15RustAxum / Actix / Rocket / Warp15-rust-framework-comparison🌱Tokio 生態(Axum)、Actor 模型(Actix)、型別魔法等級
15-2跨生態純後端 Framework vs Meta-framework15-2-backend-vs-meta-framework🌱Express / Gin / Spring 純後端 vs Next.js / Nuxt / SvelteKit Meta-framework(含後端能力的前端 framework);不懂 Node 去玩 Next/Nuxt 出問題會不知道怎麼修;什麼時候選哪個;DX trade-off

F06-B 跨 framework 關鍵能力比較

#主題SlugStage大綱
16Routing 機制16-routing-comparison🌱Static route / dynamic param / wildcard / route group / route-level middleware;Trie / Radix tree 實作
17Middleware 模型17-middleware-models🌱onion / chain / pipeline;Express next() / Koa await next() / Go handler wrap / Spring interceptor
18依賴注入(DI)18-dependency-injection🌱Spring @Autowired / NestJS @Injectable / FastAPI Depends() / .NET built-in DI;手動注入 vs container
19資料綁定與驗證19-request-binding-validation🌱Pydantic / Zod / JSR-380 (@Valid) / DataAnnotations / Protobuf schema;binding 發生點
20錯誤處理機制20-error-handling-mechanism🌱Exception filter(NestJS / Spring)/ middleware catch / Result 風格(Go / Rust)
21Lifecycle / Hook21-lifecycle-hooks🌱startup / shutdown / before-request / after-request;graceful shutdown 整合
21-2Sync vs Async Instance 設計21-2-sync-vs-async-instance🌱Framework 層的 sync instance(Django / Spring MVC / Laravel)vs async instance(FastAPI / Express / Spring WebFlux / Quarkus);worker model(WSGI vs ASGI、thread pool vs event loop);為什麼同一個 framework 的 sync / async mode 寫法差很多;什麼時候該選 async

🎯 Framework 觸發清單(backend/framework/{name}/

不屬於 B06 章節子題——是預計觸發的子系列清單。目錄不預先建,寫到 5+ 篇才 mkdir(Express 已有 5 篇 🌿 待搬入)。

分級依據:🔴 = proto / 既有 repo 有實戰素材;🟡 = 主流生態代表,無直接素材但優先考慮;🟢 = 選修,等需求觸發。

優先度Framework子目錄預計子題觸發素材
🔴FastAPIbackend/framework/fastapi/~15proto 完整實作(auth / events / RBAC / async SQLAlchemy)
🔴Expressbackend/framework/express/~15既有 5 篇 🌿(init / ESLint / Jest / Base Controller / Generic Log)+ 待補 9 題(Middleware 架構 / Router 拆分 / DI+Service 層 / TypeORM/Prisma / Global Error Handler / 測試分層 / 部署 / clustering+pooling / 遷移 Fastify / Hono)— 見 backend/express/index.md
🔴Spring Bootbackend/framework/spring-boot/~15proto springboot_proto skeleton + 實戰 infra 整合;Bean / AOP / JPA / WebFlux / Spring Security
🔴ASP.NET Corebackend/framework/aspnet-core/~12proto dotnet 實作;Minimal API / MVC / EF Core / SignalR
🟡NestJSbackend/framework/nestjs/~12主流 Node.js 企業框架;Module / Guard / Pipe / Interceptor / Microservice
🟡Djangobackend/framework/django/~15Python 企業經典;ORM / Admin / DRF / Celery / Channels
🟡Ginbackend/framework/gin/~10Go 生態最主流;Context / middleware / binding / validation / error wrap
🟢Fastifybackend/framework/fastify/~10Plugin 系統 / Schema / 效能 / JSON Schema 自動驗證(等需求觸發)
🟢Laravelbackend/framework/laravel/~12Eloquent / Queue / Horizon / Livewire / Filament(等需求觸發)
🟢Axum / Actixbackend/framework/rust-web/~10Rust 生態,配合 Rust walkthrough;extractor / Tower tower-http

🔧 小實作注意事項

#主題SlugStage大綱
22用 3 個 framework 實作同 API(跨生態)22-3-frameworks-same-api🌱FastAPI + NestJS + Spring 各實作同 CRUD,對比樣板量 / 開發速度 / 型別安全度
23Framework benchmark 該怎麼看23-reading-framework-benchmarks🌱TechEmpower 資料讀法、避免 benchmark 騙局、為什麼「hello world 」benchmark 不太實用

💣 Anti-pattern

#主題SlugStage大綱
24Framework 使用 Anti-patterns24-framework-antipatterns🌱把 framework 的 DI container 當 service locator、Controller 塞商業邏輯、middleware 處理資料邏輯、全部功能靠 annotation magic 看不見流程、升級版本卡 breaking change

🧰 對應檢查工具

#主題SlugStage大綱
25Framework 相關工具25-framework-tooling🌱OpenAPI 自動生成(FastAPI built-in / springdoc / Swashbuckle)、DI inspector、framework-specific lint(NestJS / Spring)

📎 補充

#主題SlugStage大綱
S01Micro-framework vs Full-stack frameworks01-micro-vs-full🌱Flask / Echo / Slim vs Django / Laravel / Rails;團隊規模怎麼選
S02Framework lock-in 代價s02-framework-lockin🌱遷移成本、從 Express 遷 NestJS、從 Rails 遷 Django;layered architecture 怎麼降低 lock-in
S03好的後端 Framework 怎麼看⛔️ standards/02-good-backend-framework🌿跨系列

章節進度統計

  • 章節子題:25 + 3 補充 = 28 項(不含觸發清單)
  • 觸發子系列:10 個 framework(~126 子題,另計)
  • 🌿 growing:3(跨系列)
  • 🌱 seed:25

跨系列連結

  • backend/language/ B05(語言 vs framework 分工)
  • backend/conventions/ B07(proto shared 用 FastAPI 實作)
  • micro-service/37-framework-selection-methodology38-framework-selection-cases
  • standards/02-good-backend-framework
  • → W04 walkthrough(無 framework 從零感受 framework 的價值)