here’s a clear, no-nonsense comparison for building your IoT backend on Ubuntu 22.04 LTS
| Criteria | Node.js (TypeScript, Express/NestJS) | Python (FastAPI/Django) | Go (Fiber/Gin/Echo) |
|---|---|---|---|
| Strengths | Real-time (WebSockets), huge ecosystem, one language (front+back), fast dev; great SDKs for Stripe, AWS, MQTT | Data processing, ML/analytics, clean async (FastAPI), batteries-included (Django admin), rich scientific libs | Raw speed, low RAM/CPU, easy concurrency, simple deploy (single binary), very stable in production |
| Throughput on 2 vCPU | High for I/O; CPU-heavy tasks need queues/workers | Moderate; great for APIs & jobs; CPU-heavy tasks often offloaded | Highest; efficient for MQTT/websocket fan-out and device APIs |
| RAM footprint (typical small stack) | App ~150–400 MB; add Redis/Postgres as needed | App ~200–500 MB; libs heavier; great with uvicorn+gunicorn | App ~20–120 MB; very lean |
| WebSockets/MQTT clients | Excellent (socket.io/ws, mqtt.js) | Good (FastAPI websockets, paho-mqtt) | Excellent (gorilla/websocket, paho, gmqtt) |
| Ecosystem maturity for SaaS | Outstanding: auth (JWT/OAuth), Stripe, RBAC, CMS/headless | Outstanding: Django admin, DRF; FastAPI + Pydantic great for schema | Good: everything exists, but fewer ready-made SaaS “lego blocks” |
| Developer speed | Very fast, esp. with NestJS (DI, modules, CLI) | FastAPI fast for APIs; Django fastest for CRUD/admin | Fast for pros; slower if new to Go patterns |
| Learning curve | Low-medium | Low (FastAPI) / Medium (Django) | Medium (types/concurrency) |
| Ops & packaging | Docker-first; easy CI/CD | Docker-first; many guides | Single binary or Docker; smallest images |
| When it shines | Real-time dashboards + billing + multi-tenant SaaS | Data/analytics-heavy, dashboards with admin, scientific logic | High-efficiency gateways, low-latency APIs, minimal resource servers |
Bottom line:
- If you want fastest time-to-market with rich SaaS tooling → Node.js (NestJS + TypeScript).
- If you’ll do heavy analytics/ML on the server later → Python (FastAPI).
- If you want lean, ultra-reliable, low-resource services and plan for scale → Go.
2) MQTT Broker Options
| Broker | Pros | Cons | Fit for <100 devices |
|---|---|---|---|
| Mosquitto | Very light, easy, rock-solid | Fewer enterprise features | ⭐⭐⭐⭐ Perfect starter |
| EMQX | Scales well, dashboards, auth plugins, rule engine | Heavier than Mosquitto | ⭐⭐⭐⭐ Great if you want built-in rules/JWT now |
| HiveMQ CE | Good quality, clustering in enterprise | CE is limited | ⭐⭐⭐ Good |
Recommendation: Start Mosquitto (minimal), switch to EMQX if you need rules/analytics built in.
3) Database for Telemetry + SaaS
| Need | Best Pick | Why |
|---|---|---|
| General SaaS (users, plans, billing, devices) | PostgreSQL | Transactions, strong SQL, easy backups |
| Time-series telemetry | TimescaleDB (on Postgres) or InfluxDB | Timescale if you want one DB; Influx if very high write rates |
| Caching/rate-limits/queues | Redis | Lightweight, perfect for plans/quotas and websockets presence |
Recommendation: PostgreSQL + TimescaleDB extension (single DB, simpler ops) + Redis for caching/rate-limits.
4) High-level Architecture (simple, production-ready)
- Nginx (reverse proxy, TLS)
- Backend API (Node.js/NestJS or FastAPI or Go)
- MQTT Broker (Mosquitto)
- PostgreSQL (+ TimescaleDB) for telemetry + SaaS tables
- Redis for rate-limits/sessions/queues
- Worker (same language) for async jobs (billing events, data rollups)
- CDN (Cloudflare) for static dashboard assets to help AU/CA/USA
- Stripe for subscriptions (or Paddle if you want “merchant of record”)
Fits easily in 8 GB RAM with headroom.