Marco Patzelt
Back to Overview
January 2, 2026

Why your Enterprise Architect thinks Next.js is "Unsafe"

Modern architecture often fails due to outdated mental models. If you see Next.js only as a frontend, you don't understand the security of middleware.

The Daily Paradox: AI Agents vs. Wire Insulation

I live in two worlds. On X (Twitter), I watch engineers worldwide push the boundaries of what is possible. I see Agentic Workflows managing entire codebases autonomously. I see the orchestration of AI agents enabling software development at light speed. This is Software 3.0. I feel deeply connected to this progress.

Then I open my daily work life. I hit a wall of skepticism.

(Hot Take): Many security concerns in corporate environments are not rooted in technical analysis, but rather in a hesitation toward new paradigms.

I sit in meetings and get asked: "Is the secret really not being passed to the frontend?" or "Is it safe?" It highlights a fundamental disconnect. It feels akin to asking an electrician if they are using insulated wires. It questions the absolute basics of the profession.

The problem is not the question itself; it is the underlying doubt. Why is there such a gap in understanding? I build systems that rely on scaling and security by design. But often, the person across from me sees only a "website." This cultural gap is a significant brake on innovation. We discuss basics while the rest of the world automates the future.

The Misunderstanding: Middleware is not just "Pretty Frontend"

The core problem is an outdated mental model. Many decision-makers, especially those used to legacy enterprise environments, hold a static image of web applications. To them, a web app is simply HTML and JavaScript running in the user's browser.

In that mindset, everything occurring in the web app is publicly visible, and therefore a security risk by definition.

(Hot Take): Viewing Next.js as a purely frontend framework overlooks nearly a decade of architectural evolution.

What is often missed is the middleware. Tools like Vercel and frameworks like Next.js are based on an architecture that seamlessly orchestrates server logic and client interaction. When I build a route in Next.js, I decide what is executed on the server (Edge Runtime or Node.js) and what is sent to the browser.

The middleware functions as a full-fledged server. Secrets like API keys for agentic workflows or database access never leave this environment. They are stored in environment variables protected at the infrastructure level. The fact that this logic is written "close" to the frontend does not make it insecure; it makes it efficient. The mistrust stems from the fact that the boundary between "server" and "client" is seamless in the code, even though it remains distinct in the infrastructure.

Security by Design vs. Security by Tradition

Security is often confused with complexity. In traditional models, security meant firewalls, VPNs, and physical servers in air-conditioned rooms. This creates a sense of control. But control is not synonymous with security.

(Hot Take): A manually maintained on-premise server is often more prone to human error than a fully managed serverless infrastructure.

My answer to security questions is architecture, not apprehension. I use "Security by Design." In a modern lean stack, security is woven into the platform.

  1. Server-Side Validation: Every request is validated before it touches the database.
  2. Environment Variables: Secrets are never compiled into the client code.
  3. Edge Functions: Logic is executed in isolated environments that exist for only milliseconds.

I often spend hours on persuasion work, explaining that a modern stack is as secure as legacy systems—and often more so, as it eliminates many configuration errors at the OS level. This is time taken away from building real business value. If we define security through rigid tradition rather than intelligent design, we fall behind technically.

The Trust Gap: Why Justification Kills Velocity

This "Trust Gap" is not a minor annoyance; it is a strategic bottleneck. It slows projects down more than bugs or technical hurdles. While I want to be building the next level of innovation—such as the orchestration of agents that solve problems independently—I am often stuck in justification loops.

(Hot Take): Requiring architects to constantly re-litigate the basics of web security consumes the company's most valuable resource: engineering focus.

It is exhausting. Productivity suffers when you constantly have to prove that you have mastered the fundamentals. We lose time discussing "what-if" scenarios that are already mitigated in modern frameworks by their fundamental structure.

In the time spent discussing the security of middleware, we could have shipped three automated workflows. Trust in modern standards is a prerequisite for speed. Without this trust, we remain stuck in maintenance mode while competitors accelerate with AI-supported systems. Misunderstanding the middleware blocks not only the code but the entire company's progress.

The Verdict: Mindset over Hardware

We must stop treating modern web architecture as merely experimental. It is the new standard. Believing that security requires physical separation of servers overlooks the capabilities of modern infrastructure.

My Approach:

  • Logic belongs in the middleware: That's where it is safe, fast, and scalable.
  • Infrastructure as Code: Reduces manual interventions and human errors.
  • Shipping over Documentation: A functioning, secure system proves more than 100 pages of security concepts.

The shift is not just technological; it is cultural. To remain competitive, we need to catch up not just in hardware, but primarily in mindset. Asking outdated questions often leads to answers that preserve the status quo rather than drive progress.

The Verdict: The middleware is safe. Modern platforms are safe. The real risk is hesitation caused by misunderstanding. Let's move past asking if the cable is insulated and start building the house.

I build these systems every day. To build effectively, we must let go of outdated models.

GitHub | Agentic Orchestration Layer

Let's
connect.

I am always open to exciting discussions about frontend architecture, performance, and modern web stacks.

Email me
Email me