14 parts
Build a real REST API with Node and Express 5: routing, middleware, databases, validation, authentication, and pagination, all with async/await.
Why a browser can't talk to a database directly, what a backend is responsible for, and the API contract you'll build across this whole series.
5 min read
Build an HTTP server with nothing but Node's built-in http module, then see exactly which parts of that work Express will do for you.
6 min read
Install Express 5.2, write your first routes with async/await, and see why Express 5 forwards rejected promises to error handling automatically.
The three places a request carries data in Express: :id route params, ?limit= query strings, and JSON bodies, with real Linkstash routes for each.
What middleware actually is in Express, how the (req, res, next) signature works, and the exact bug you get when a middleware forgets to call next.
REST conventions that actually matter: resource-shaped URLs, HTTP verbs over action names, and status codes that tell the truth, with Linkstash's real routes.
How Express 5's four-argument error middleware works, why route order matters for the 404 catch-all, and the async trap Express 4 developers had to work around.
Wire better-sqlite3 into Express, understand prepared statements as the fix for SQL injection, and why WAL mode is meaningless on an in-memory database.
8 min read
Use Zod's safeParse to reject bad input at the boundary before it reaches your database, with the exact credentials and newLink schemas from Linkstash.
How Linkstash's opaque session tokens actually work end to end, and the real tradeoff against JWTs: revocability versus a database lookup on every request.
Why registerUser inserts first and catches the UNIQUE violation instead of checking first, and why verifyUser hashes a dummy password on every failed login.
7 min read
The intParam helper that stops a negative limit from becoming SQLite's 'no limit at all', plus how Linkstash filters with LIKE and sorts newest first.
Why request/response can't push updates to a client, how the WebSocket handshake upgrades an HTTP connection, and where realtime would sit next to Linkstash.
The complete Linkstash architecture in one diagram: every route and decision from this series, tied together and ready for you to build your own version.