Aller au contenu principal
alexis_amzFR / EN
// NAVIGATION
Home01Web02Video03Photos04Music05About06Contact07
FR / EN
contact@alexisamz.fr
← Back to blog

Next.js 16 Web App Architecture: Case Study

How to architect a complex web calculator with Next.js 16, Supabase and TypeScript. SSR data caching, deterministic calculations and zero CLS.

Published// nextjs-web-calculator-architecture
Next.js 16 Web App Architecture: Case Study

When building a business web application, developers often stack heavy client-side libraries until the UI responds. But when the application handles complex regulatory calculations : such as an automotive tax engine or a real-time quote simulator :, this fragile approach quickly breaks down: sluggish loading times, inconsistent math, unexpected layout shifts (CLS), and poor SEO visibility.

Here is the exact architecture I run in production (notably on dczimports.fr) to achieve deterministic calculations, instant response times, and top-tier search rankings.

1. Decoupling Core Business Logic from Frameworks

The most common architectural mistake is mixing calculation formulas directly inside React components (useEffect, button handlers, local component state).

For a tax, financial, or engineering simulator, the calculation core must reside in a pure TypeScript module, completely free of any React, DOM, or Next.js dependencies:

  • Zero Side Effects: A pure function accepts strongly typed parameters (purchasePrice, co2Rating, curbWeightKg, registrationYear) and outputs an immutable, detailed report (VAT, environmental penalty, weight tax, annual depreciation, total landed cost).
  • Comprehensive Unit Testing: The tax engine for DCZ Imports is protected by over 1,000 automated unit tests with Vitest. Every official regulatory formula is validated down to the exact euro cent before any deployment.
  • Universal Portability: The exact same pure logic computes initial estimates on the server (SSR for search engine crawlers), drives instant client-side updates as the user types, and powers serverless PDF accounting generators.

2. Server-Side Rendering (SSR) and Zero Cumulative Layout Shift (CLS)

A business simulator must be indexable and rank on high-intent search queries like "Tesla Model Y import tax calculator".

Using Next.js 16 and the App Router:

  • Static Pre-Rendering (SSG / ISR): Brand and model landing pages are pre-calculated with active market data. Visitors and bots receive fully hydrated HTML in under 200 milliseconds.
  • Eliminating Cumulative Layout Shift (CLS): If a navigation bar or dynamic badge takes 300 milliseconds to hydrate and expands by just 6 pixels, the entire viewport jumps downward. Google heavily penalizes this behavior on mobile. By enforcing explicit CSS dimensions (min-height) on dynamic slots, our layout shift remains locked at a perfect 0.000.

3. Database Architecture and Edge Sync with Supabase

When tracking real-time market data across European car listings:

  • Managed PostgreSQL via Supabase: Reliable storage for vehicle catalogs, pricing trends, and visitor telemetry.
  • Edge Caching and Hourly Revalidation: Next.js 16 enables background revalidation (revalidate = 3600) without blocking incoming traffic. Even during viral traffic spikes, the database stays protected behind CDN edge caching.

4. Why This Architecture Delivers Concrete Business ROI

Many business owners in Lyon, Geneva, or Dubai assume that building a custom calculator requires months of agency development and five-figure budgets.

With a modern stack (Next.js 16, strict TypeScript, AI-assisted development workflows):

  1. A fully functional production MVP is ready within days.
  2. You own 100% of your source code with zero vendor lock-in.
  3. Your mobile Core Web Vitals score hits 95 to 100, directly improving your lead conversion rate.

Planning a custom web application, quote calculator, or high-performance platform? Feel free to reach out via my contact page for a detailed quote within 24 hours, or explore my past projects on the web development page.

> Got a project in mind?

Website, photo shoot or video.
Let's talk.

Contact me →
WhatsApp me