Skip to content
Home · Sonraki hedefe 100 XP
Son hareketler
Henüz bir öğrenme hareketi yok. İlk derse başlayın.

Software Engineering

Next.js: Separating server and client responsibilities

Next.js offers server and client-side production options in the React-based application. Where a file runs affects data access and code sent to the client.

Bu derste neler var?

SIBERSALDIRI.COM · FOCUSED LESSON

What you will learn

  • Explain the relationship between server data and Narrow data limit.
  • “Why does the code running on the server still require authorization checks?” To give a reasoned answer to the question.
  • Changing the example and comparing expected and observed behavior.

How it works and where the trust boundary lies

Do not move private keys to the client package. Server data operations also require authorization; Running a function only on the server does not make it safe for all callers. Evaluate cache behavior with user-specific data. Since router and version features may change, take the version document in the project as basis; It is an example architectural contract.

Next.js: Flow for separating server and client responsibilities: Server data → Narrow data boundary → Client interaction
Server data → Narrow data limit → Client interaction. The diagram shows the relationship; It does not replace the entire application.

Worked example

The following passage makes the concept visible. Evaluate samples containing commands or code in your own separate testing environment, not in the production system. Architectural diagrams and policy examples are not executable programs.

Sunucu: kimlik + veri yetkisi + gizli erişim
İstemci: etkileşim + yerel durum
Ortak sınır: yalnızca gerekli, serileştirilebilir veri
Önbellek: kullanıcı kapsamı açık

Expected result and interpretation

The architecture limits data flow without making the server function a free access port.

Compare the scenarios

StatusRecommended approachWhy?
Data on serverCheck authorizationExternal request can trigger
Private key output to clientPause and rotate broadcastPacket readable
User data is in cacheSplit scopeMight be served to the wrong user

Practice task

Explain the consequence of keeping private profile data in the global cache.

  1. Write down the expected outcome and acceptance condition before the action.
  2. Change a single variable; Record the observation and the medium you used.
  3. Evaluate the result with the comparison table above. Explain which assumption might be wrong if it does not fit.

Common mistake and how to correct it

Do not publish the environment variable to the client with a clear name and assume that it remains private.

Test your understanding

Why does code running on the server still require authorization checks?

Answer explained: If triggered by an external request, the caller's identity and access to the relevant object must be verified.

Continue with related lessons

Technical reference

The explanation and examples of this course have been re-prepared for the academy. The link below is a technical reference to verify details of the technology or security approach used.

Bir adım daha ilerlediniz.

Dersi bitirdiyseniz tamamlandı olarak işaretleyin. İlerlemeniz bu cihazda saklanır.

Academy menu

Akademide ara

En az 2 karakter yazın.