# Reading matters...

**Reading matters**, now more than ever before. As I have expressed this exact opinion with a couple of mates lately, **we don't live in the era of information, we live in the era of noise**. We lie to ourselves that the needed information is in front of our eyes daily, because there **IS** a lot of information, *more than any king before had in his entire life*, but fundamentaly, most of that information is not at all important, it is in fact misleading you in the wrong direction or in the worst case lying and shaping your mindset wrongfully.

Now, yes, you can find the needed information and knowledge on the internet, but more in form of **books, articles, documentation, forums, comment sections, and direct messages** with knowledgeable people, all having one thing in common-**reading**. *(Podcasts and videos can also be helpful, but for sustained long-term knowledge, I think that reading and spending time on the topic is king)* Still, you have to be very selective and filter on what you read, but that comes with experience, which is essentially just **patience**, one of the things our generation is missing the most.

**I am going to share a story on how reading saved me precious time.**

Currently, I am building a web app for personal finance management-**FEiN(**[**https://fein.finance/**](https://fein.finance/)**)**, tailored to my needs. Doing the management in Google Sheets, I saw that it comes with challenges, one of them being that the whole system is dependent on strings, and if the format of the strings is missed, there will be errors and data missing, so I decided to make a UX-friendly app that will minimize my mistakes and please my love for unique design.

Consequently, I started **upskilling myself** by renewing my knowledge of NextJS.

I have previously used older versions of it to build apps ([https://python.mk/](https://python.mk/), [https://summer23.best.org.mk/](https://summer23.best.org.mk/)), which used the Pages Router. I wanted to learn the "new" App Router, so I completed the NextJS' Foundations course on App Router, ending up with a [certificate](https://nextjs.org/learn/certificate?course=dashboard-app&user=127057&certId=dashboard-app-127057-1768949362573) and a scaffolding for a financial app. Upon starting the course, I needed to generate the template using the **CLI command**:

```bash
npx create-next-app@latest nextjs-dashboard --example "https://github.com/vercel/next-learn/tree/main/dashboard/starter-example" --use-pnpm
```

and this is an **important step**, will get to it later on why. (hint: `@latest`)

I did this before the **infamous CVEs** that React and Next had, so when they got vocal I did what everyone else did, **changed the version of the Next** to an **explicit one** that **had the CVEs fixed** and continued developing it.

I had already made a Figma design prototype for the app and started implementing it in my app after the course ended. The first things served on my menu were accounts, authentication, and security, and I implemented them with great care, paying attention to every minutia.

I am **keen on** writing **organic code**, but am not opposed to getting your code from AI if you go over it thoroughly, rigorously, and exhaustively, and **understand it deeply**, so you **can modify it and maintain it in the future**, as an essential rule of software engineering. So, less vibe in vibe coding, and more **scrupulousness**(*doing things right because it is right*) and **punctiliousness**(*implying an extreme/rigid focus on the smallest details*).

Turned to AI for one of the things I didn't know how to do, **authentication middleware** or **authorization logic** that runs checks on user sessions or tokens before allowing access to certain routes. This ensures a seamless user experience by not requiring a user to log in again or view the login form when they already have an active, valid session.

It did its job, giving me an extension to my middleware file(`proxy.ts`)-matching what to redirect to `/dashboard` route if the user is logged in and requests `/login` or `/register` route, also hardening other non-authenticating routes the same way.

But, it didn't work...

I rechecked it twice: to see if something was wrong in the code or if I had other files overwriting this one, as such a bug can materialize, but it wasn't that. And the AI of my choice kept repeating the same code when asked to fix it because it wasn't working...

Thereupon, I **fell back** to what I do when something is not working-digging deep for every single detail about it by either **reading documentation, forums, or articles** about it, **not skipping a single word**.

I opened the documentation for NextJS and was met with the UI on left that had two drop-down menus: one for usage of App Router/Pages Router and the other one for the version of NextJS, put it in my brain's RAM and proceeded to search the documentation for "middleware", pressed enter and was redirected to the documentation's page for "Proxy", exactly what I had, right?

I read it whole, I saw that the AI gave me the correct file and content, but came back to the very top that said:

> **Good to know**: Starting with Next.js 16, Middleware is now called Proxy to better reflect its purpose. The functionality remains the same.

I immediately thought back to the explicitly changed version of the scaffolding because of the CVEs and remembered that I don't use the `@latest` one(*v16.1.6*) anymore, but rather a slightly older one, *v15.5.9*.

Then I switched the version of the documentation to *v15* and again wrote "middleware" in the search, pressed enter, and there it was, the file name called `middleware.ts` instead of `proxy.ts`. Then I went to the *v16* documentation and searched for `proxy.ts`, and on my screen popped this note:

> **Note**: The `middleware` file convention is deprecated and has been renamed to `proxy`. See Migration to Proxy for more details.

Rushed to my IDE, renamed `proxy.ts` to `middleware.ts` without changing the content and...

It worked!

I thought to myself that this is a big win for me, having solved this thing so fast instead of falling into debugging hell, and credited my reading skills, instead of using AI or trying a hundred things in practice, for the quickness of the fix.

I was unsure whether to write such a blog post since I am an embedded software engineer; this is not my expertise, and the audience would be waaay more experienced in these technologies.

Doubted if this would seem like a small thing to you, but then I asked colleagues who work on the web daily, and they said it's totally a scenario of their daily work. That gave me enthusiasm to do it, so thanks to Teo, you are **reading** this, and that **matters**...
