STACK
Ch 06 · Backend Runtimes & Frameworks
Chapter 06 · Where logic lives

Backend Runtimes — seven ecosystems compared honestly

There's no "best" backend stack — only correct trade-offs. This is the comparison sheet, the framework map per language, and the cross-runtime patterns every backend needs.

6.1 · Four axes to compare runtimes

AxisWhat it decides
Concurrency modelEvent loop, OS threads, goroutines, virtual threads, actors.
Type safetyCompile-time guarantees vs runtime flexibility.
Ecosystem fitLibs for your domain (ML, web, mobile, infra, data).
Hiring & rampPool size in your market.

6.2 · Node / Bun / Deno

Node 22Bun 1Deno 2
JS engineV8JavaScriptCoreV8
Default modulesCJS + ESMESM + TS nativeESM + TS native
Bundler / installer / testvia npm + 3rd-partybuilt-inbuilt-in
Edge targetmoderategreatgreat (Deno Deploy)

Use for: BFFs, real-time, integration glue, AI app backends. Watch out: CPU-bound code blocks the event loop — push to worker_threads or out-of-process.

6.3 · Python

  • 3.12+ has improved CPython perf; PEP 703 aims at no-GIL.
  • Web frameworks: FastAPI, Litestar, Django, Flask.
  • ASGI servers: uvicorn, hypercorn, granian.
  • Data & AI: NumPy, Pandas, Polars, PyTorch, JAX, TensorFlow.
  • Modern toolchain: uv (10–100× faster pip + venv), ruff (lint), pyright (types).

6.4 · Go

  • Goroutines + channels make concurrency cheap.
  • Static binaries; deploy as a single file.
  • Frameworks: net/http directly, Chi, Echo, Fiber, Gin.
  • Excellent stdlib; opinionated tooling.
  • Used by: Docker, Kubernetes, Terraform, CockroachDB, almost everything cloud-native.

6.5 · Rust

  • Memory-safe without GC; zero-cost abstractions.
  • Web: Axum + Tokio + sqlx; Actix; Loco (Rails-style).
  • Cargo handles build, test, deps, docs.
  • Fits: latency-critical APIs, edge runtimes (Workers), data tooling, anywhere C++ would have been.
  • Cost: longer compile times, steeper learning curve.

6.6 · JVM — Java / Kotlin / Scala

  • Virtual threads (Project Loom, JDK 21+) let Java handle millions of concurrent IO without async colour.
  • Frameworks: Spring Boot 3, Quarkus, Micronaut, Helidon, Vert.x, Ktor (Kotlin).
  • GraalVM native-image — AOT compile to tiny startup binaries.
  • Best for enterprise, fintech, anywhere the JVM ecosystem (Kafka clients, Flink, Spark) is rich.

6.7 · .NET

  • .NET 9; cross-platform on Linux/macOS.
  • Minimal APIs + ASP.NET Core for web; EF Core for DB.
  • AOT (Native AOT) for tiny startup; great for Lambda.
  • C# is excellent for typed business logic; F# for functional / domain.

6.8 · Elixir / Erlang

  • BEAM VM: millions of lightweight processes, supervisor trees, hot-code reload.
  • Phoenix + LiveView for real-time UIs without a separate frontend framework.
  • Sweet spot: chat, real-time dashboards, telecom-like workloads.

6.9 · Framework map

LanguageFrameworks (2026)
Node / BunHono, Fastify, Express, NestJS, Elysia.
PythonFastAPI, Litestar, Django, Flask.
GoChi, Echo, Fiber, Gin, Connect-go.
RustAxum, Actix, Loco, Rocket, Poem.
JVMSpring Boot, Ktor, Quarkus, Micronaut.
.NETASP.NET Core (Minimal APIs), MVC, SignalR.
ElixirPhoenix, Plug, Ash.
RubyRails 8, Sinatra, Hanami.
PHPLaravel, Symfony, Slim.

6.10 · Cross-runtime patterns every backend needs

  • Connection pooling — DB + HTTP; size with Little's Law.
  • Graceful shutdown — SIGTERM → stop accepting → drain → exit.
  • Health endpoints — liveness vs readiness vs startup.
  • Timeouts everywhere — DB, HTTP client, RPC, queue consumer.
  • Idempotency on write APIs.
  • Structured logging with trace context.
  • Outbox for "DB write + event publish" atomicity.
  • Worker queues for slow work — keep request paths fast.

6.11 · 12-factor — and the bits to add in 2026

  1. Codebase — one repo per app.
  2. Dependencies — explicitly declared, isolated.
  3. Config — in env vars.
  4. Backing services — attached resources (URL in env).
  5. Build / release / run — strict separation.
  6. Processes — stateless.
  7. Port binding — self-contained.
  8. Concurrency — scale out via process model.
  9. Disposability — fast startup & graceful shutdown.
  10. Dev / prod parity — same OS, deps, services.
  11. Logs — write to stdout as event streams.
  12. Admin processes — run as one-off processes.

Add for 2026: 13) OTel instrumented by default · 14) signed artefacts + SBOM · 15) IaC for every long-lived resource · 16) feature flags decouple deploy/release.

6.12 · Self-check

Q1 · Java's "virtual threads" (Project Loom) primarily solve…
CPU-bound parallelism
Massive concurrent IO without async/await
Lower GC pauses
AOT compilation