Skip to content

1. Git, Node, and Running Pretzel Shop Without Docker

Lesson 1 isn’t really about Git — it’s about running Pretzel Shop’s full stack (React, Express, PostgreSQL, Redis) by hand on pretzel-vm, before Docker hides any of the wiring. Full source: github.com/lastdevops/pretzel-shop-full.

The stack breaks into four pieces: React + Vite in the browser, Express on port 3001 handling /api/..., PostgreSQL for durable data, and Redis for the shopping cart (cart:{sessionId}, 24-hour TTL). Nothing here needs a container — containers just package the same processes later. One detail matters for later lessons: the browser talks to the API directly, with no proxy hiding it behind the same origin as the frontend — which is why CORS has to be configured correctly rather than just working by accident.

Setting up Git the way I actually wanted it

Section titled “Setting up Git the way I actually wanted it”

Rather than cloning the reference repo directly, I forked it as an untouched backup via the GitHub CLI, then created a completely separate, independent private repo from that code and pushed to it — so my working history was never a fork I’d need to detach from later.

Node, Postgres, Redis — installed to match the repo’s own defaults

Section titled “Node, Postgres, Redis — installed to match the repo’s own defaults”

Node via nvm, standardized on the current Active LTS (v24) rather than whatever the OS ships. PostgreSQL role and database created to match exactly what the repo’s own docker-compose.yml already expected (pretzel_user / pretzel_shop), so the same credentials would work with or without Docker later. Redis installed and confirmed alive with redis-cli ping.

A real dependency conflict, not a hypothetical one

Section titled “A real dependency conflict, not a hypothetical one”

npm install on the frontend hit an actual ERESOLVE error: the project’s vite@8.1.5 was newer than what the installed @vitejs/plugin-react@4.7.0 officially supported. Rather than forcing past it with --legacy-peer-deps, I checked whether a newer plugin version actually supported Vite 8 — it did (@vitejs/plugin-react@6.0.4), so the fix was bumping the plugin, not downgrading Vite or masking the error.

Reaching a VM’s dev server from a desktop browser

Section titled “Reaching a VM’s dev server from a desktop browser”

Since Vite runs on the VM, not the desktop doing the browsing, localhost:5173 on the desktop doesn’t reach it. Fixed with a single SSH tunnel (ssh -L 5173:localhost:5173 -L 3001:localhost:3001 pretzel-vm) — no application config changes needed.

Clicking “add to cart” hits Express, which reads the existing cart out of Redis, merges the new item, and writes it back with a 24-hour expiry. The response carries a session header that keeps the browser’s local session id in sync with the Redis key across reloads. Products and orders take a different path entirely, straight to PostgreSQL — cart state is ephemeral and high-churn, so it belongs in Redis; order history has to survive, so it belongs in a real database.

CORS sits on top of all of this as a browser-only restriction: if the allowed origin doesn’t match exactly, the browser blocks the response before React ever sees it, even though a direct curl request would succeed.

The two failures worth knowing before Docker hides them entirely: a role/database mismatch between .env and what Postgres actually has (same failure class as a wrong credential in a Kubernetes secret), and a health check that lies — /health returning green while Redis is down, because startup isn’t gated on Redis connectivity, so cart actions fail silently while products still load fine.


Next: Lesson 2, VMs.