Fresh Reads
Source desk · Blog
Colin McDonnell
14 entries in the archiveNewest: Aug 23, 2025Official site
- TypeScript
Introducing Zod Codecs
Zod 4.1 introduced a new z.codec() API for defining bi-directional transformations in Zod. The problem with transforms Zod's .transform() method is great for one-way data conversion: const stringToNumber = z.string().transform(val => parseFloat(val)); stringToNumber.parse("42");…
Making AI resources auto-discoverable via package.json
I propose the following convention for JavaScript libraries to make their AI resources auto-discoverable via package.json. { // package.json "llms": "https://docs.cool-library.com/llms.txt", "llmsFull": "https://docs.cool-library.com/llms-full.txt", "mcpServer":…
Live types in a TypeScript monorepo
EDIT: A previous version of this post recommended publishConfig, operating under the mistaken belief that it could be used to override "exports" during npm publish. As it turns out, npm only uses "publishConfig" to override certain .npmrc fields like registry and tag, whereas…
An email regex for reasonable people
I maintain Zod, which is a schema library. Zod lets people declare an email schema like this: import {z} from 'zod'; z.string().email(); A lot of people think every technically valid email address should pass validation by that schema. I used to think that too. Over the years…
From README to documentation site in 10 minutes
Spoiler alert: GitHub Pages and GitHub actions are not involved. I recently set out to build a proper documentation site for Zod with a short and eminently reasonable list of goals: The site should be generated from the README. Zod's README.md is the "source of truth". The site…
Building an end-to-end typesafe API — without GraphQL
In the mid-2010s, the pendulum of web development swung massively in the direction of increased type safety. First, we all switched back to relational DBs after recovering from an embarrassingly long collective delusion that NoSQL was cool. Then TypeScript started its meteoric…
Why Zod 2 isn't leaving beta
Zod's v2 has been in beta since September 2020 (around 3 months as of this writing). The people are starting to talk. The background The reason Zod 2 has been in beta for so long (well, one of the reasons anyway!) is that I’ve been increasingly unsatisfied with Zod’s…
Next.js, nested routes, and the war on SPAs
Edit: 2022 The issues described here have been largely solved by layouts in Next.js 13. I recently set out to implement a single-page application (SPA) on top of Next.js. To clarify, I'm using the term "SPA" in a very specific way. I'm referring to the "classical" SPA model: an…
Building a single-page application with Next.js and React Router
Update 2023 — Updated for Next.js 13, React Router 6, and React 18. Update 2022 — Next.js 13 now supports nested routes via the /app directory. However, it requires a server to render React Server Components, and thus doesn't qualify as a "single-page application" as defined in…
Authenticated server-side rendering with Next.js and Firebase
Feb 24, 2021: a previous version of this post contained a bug where a new cookie would be created each time you signed out and back in again. These (identical) cookies would stack up cause problems. If you're having issues, pass the { path: '/' } option to nookies.set call —…
Sponsor pools: a new funding model for open source software
Check out the HN discussion here. This article has been translated into Japanese and Russian. The existing open-source funding models don't work well for small projects. Big projects — operating systems, frameworks, CMSs, or fully self-hostable applications — are in a privileged…
Why you shouldn't use @emotion/core
A maintainer of Emotion published a very thoughtful response to a version of this post! I encourage you to check that out here. The essay below has modified to address some of his points. Emotion is my favorite CSS-in-JS library. It's easy to define style classes — both inline…
Choosing a tech stack for my personal dev blog in 2020
Check out the HN roast discussion here! 🤗 This article has been translated into Russian. I recently set out to build my personal website — the one you're reading now, as it happens! Surprisingly, it was harder than expected assemble a "tech stack" that met my criteria. My…
Designing the perfect Typescript schema validation library
Update 2023 — Many of the problems with other libraries have been solved since this post was originally published. There are a handful of wildly popular validation libraries in the Javascript ecosystem with thousands of stars on GitHub. When I started my quest to find the ideal…






