Blog

Optimistic UI Updates in Next.js with useOptimistic and Server Actions
Every mutation that goes through the server has a gap between the click and the result. On a fast connection that gap might be 100 milliseconds; on a
Continue Reading
Case-Insensitive Queries and Collation in MongoDB
A user signs up as [email protected]. A week later they try to log in with [email protected], and your query returns nothing. Worse, they hit "Si
Continue Reading
Server Actions in Next.js: Handling Form Submissions Without API Routes
For a long time, handling a form in a React app meant writing the same plumbing over and over. You built an API route, wrote a client component with
Continue Reading
Using MongoDB with Next.js App Router and Server Actions
For years, putting MongoDB behind a React app meant building two things: the UI, and a separate REST or GraphQL API for the UI to call. Every new fea
Continue Reading
Using the server-only Package to Keep Sensitive Code Off the Client
In the App Router, a module doesn't declare whether it's server code or client code. It becomes one or the other, or both, depending on who imports i
Continue Reading
Composition Patterns for Mixing Server and Client Components in Next.js
Knowing the rules of Server and Client Components is one thing. Structuring a real page with them is another. A modal that contains server-fetched da
Continue Reading