Many teams reach for Next.js on Node when they need authenticated dashboards, API routes, and server rendering. This project solves the same problems with Astro on Cloudflare, but the architectural trade-offs are easier to understand if you know how a Node-based stack would look.
What Next.js on Node provides
Next.js combines file-based routing, React components, and API route handlers in one repository. Deploying to Node (Vercel, Docker, or a VPS) gives you long-lived processes, familiar middleware, and direct access to PostgreSQL drivers—ideal for heavy CRUD admin panels and WebSocket streams.
Mapping concepts to this site
- Pages router / app router → Astro
.astropages and layouts. - API routes →
src/pages/api/*.tsexporting HTTP method handlers. - getServerSideProps → frontmatter
awaitcalls before HTML renders. - Middleware → auth checks in layouts and API routes via Supabase cookies.
- Environment variables → Cloudflare/W wrangler secrets and
.envlocally.
When Next.js is still the better pick
Choose Next.js when you need deep React ecosystem integration, incremental static regeneration at massive scale, or long-running background jobs on the same Node host. Real-time charts with websockets, complex client state, and shared component libraries with an existing React product all push toward Next.
Why Astro was chosen here
ThermalTrace is read-heavy: fetch probes, render tables, export CSV. Most dashboard forms work with plain HTML POSTs. Astro keeps bundles small, ships less JavaScript to phones, and deploys to Cloudflare’s edge without maintaining a Node server. API routes cover Stripe webhooks and auth callbacks without adopting a full React runtime on every page.
Hybrid architectures
Production systems often mix both: Next.js admin consoles, Python relays for probes, and static marketing sites. The about section documents each layer independently so you can swap Astro for Next on the dashboard while keeping Arduino and Python pieces unchanged. JSON feed contracts are the stable interface.
Local Node development
Developers still use Node 22 locally to run astro dev, build pipelines, and Wrangler previews.
The runtime on Cloudflare is Workers-compatible rather than a traditional Node process, but tooling remains
familiar. See Astro applications for how this
repository is organized day to day.