Fly.ioTutorial
Vanilla with Candy Sprinkles
Summary
Vanilla with Candy Sprinkles presents a baseline full-stack Node.js application: a stateful visitor counter that increments across refreshes, tabs, browsers, and machines. The post starts with a dependency-free package.json and a 72-line server.js, then uses node-demo to generate variants with ECMAScript modules, EJS or Mustache templates, and Express. It adds SQLite3 or PostgreSQL for persistence, Tailwind CSS and TypeScript with a build step, and Drizzle, Knex, or Prisma as ORM options, noting differing language and build requirements. WebSockets provide real-time updates, htmx can handle client-side connection and DOM work, and Redis coordinates notifications across multiple servers; Fly.io deployment can scale the setup across eight instances in four regions. The concluding section points to further alternatives, including React, Angular, Lit, SolidJS, Svelte, Vue, esbuild, rollup, and other deployment targets, while inviting alternate implementations.
Context
The post defines a small full-stack baseline as a learning example, a starting point for selectively combining tools, and a debugging aid for larger systems. Its initial target is a stateful web server with a visitor counter, with eventual goals of real-time updates and global deployment.
Approach / What changed
It builds the counter with Node.js, then shows node-demo commands for swapping modules, template engines, Express, databases, CSS and typing tools, ORMs, WebSockets, htmx, Redis, and package managers. It also provides local and Fly.io launch instructions, including scaling across regions.
Takeaways
The baseline application uses a dependency-free package.json, a 72-line server.js, and a counter persisted initially in a text file.
SQLite3 is presented as suitable for development, while PostgreSQL is described as the current best production choice; LiteFS is mentioned for SQLite3 deployment.
WebSockets enable updates between clients, while Redis addresses the limitation that multiple servers otherwise maintain separate WebSocket pools.
Source and freshness
- Source
- fly.io
- Published
- Added to Yomu
- Last updated
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.