personal thoughts related to next.js

———————

  • You should know this before choosing Next.js for your project

    Choosing the right tech stack is a huge decision that shapes the future of your project. Especially in the enterprise world, you’re often locking yourself in for years. That choice casts out to everything: how fast you can build, the quality of what you ship, what your roadmap looks like, and even how easy it is to keep a happy team.

    Fact 1: no official support for serverless

    READ MORE
  • Type-safe base-64 encoded search params: integrating Nuqs with Zod

    In a recent project, we needed to create a wizard component whose state is shared via the URL for seamless navigation and sharing between users. In this post, I’ll walk through how to store that state in the URL in a type-safe, encoded way, using much simpler example of a shopping cart.

    Why does is matter?

    It allows users to share specific application states simply by sharing a link, ensuring others can view the same information or settings. It also enables users to return to the same state after a page reload or navigating away. Without proper state management in the URL, this process becomes error-prone, especially for dynamic and complex application states, leading to inconsistent behavior and difficulties in maintaining state across different sessions or components.

    READ MORE
  • Next.js 14.2, Turbo, and Sentry causing HMR problems

    Recently, I ran into a frustrating issue while experimenting with Turbo in a Next.js 14.2 project. We were eager to try Turbo to improve developer experience (DX), but our excitement quickly faded when we noticed that HMR wasn’t working reliably. About half the time, making a change would cause the app to crash

    The Problem

    When we made code edits, updated environment variables, or triggered HMR, our app would crash with an error like this:

    Error: Module [project]/node_modules/next/dist/esm/client/components/error-boundary.js was instantiated because it was required from module
    READ MORE
  • Storing state in search params vs path params in Next.js

    One of the key decisions developers face when building modern web applications is whether how to store state in the URL. Once you’ve decided to store state in the URL, the next step is choosing the right format for your parameters: search params (query params) or path params. Both options offer different advantages depending on the context of your application. Understanding when to use each can make your URL structure more intuitive, flexible, and user-friendly.

    When to use search params?

    READ MORE