Skip to main content

Next.js System Design & Trade-Off Drills

A Next.js system-design interview is not a test of how many framework features you can draw.

It is a test of whether you can map product constraints onto the right boundaries.

1. Start with requirements​

Clarify:

users / tenants
public vs authenticated content
read/write ratio
latency target
freshness target
availability target
external consumers
regional/compliance needs

Then identify critical journeys.

2. Draw the capability map​

Example SaaS:

identity
workspace
projects
billing
reports
integrations

Routes compose these capabilities; folders do not define business ownership automatically.

3. Draw the request path​

browser
β†’ CDN/proxy
β†’ Next.js Proxy if matched
β†’ route tree / Route Handler
β†’ DAL/command
β†’ DB/cache/provider
β†’ RSC/HTTP response

Add queue/worker for durable async work.

4. Choose server/client ownership​

Ask for each UI region:

Does it need browser state/API?
Does it contain secrets or canonical reads?
Can it render as a Server Component?
How much JS would a client boundary pull in?

Default server-first, then add narrow interactive islands.

5. Design reads​

Options:

Server Component β†’ DAL
Route Handler β†’ public HTTP API
client data library β†’ browser-owned live/refetching behavior

Avoid own HTTP hops for ordinary server-owned reads.

6. Design writes​

UI mutation β†’ Server Action β†’ command
external/public/mobile mutation β†’ Route Handler β†’ command
background consequence β†’ queue/worker

Commands own business invariants.

7. Model authorization​

For each resource:

actor
session
role/capability
tenant
resource owner/relationship

Authorization should be enforced server-side where data is accessed or mutated.

8. Model cache identity​

Ask:

What makes this result unique?
What makes sharing safe?
How fresh must it be?
Who invalidates it?

Never say β€œcache by URL” without checking auth, headers, locale, tenant and query dimensions.

9. Cache hierarchy​

Discuss separately:

browser/HTTP cache
CDN
Next server cache
Cache Components storage
shared app cache
Router Cache

Different layers have different invalidation and security rules.

10. Streaming design​

Use Suspense around independently slow regions.

Example dashboard:

cached navigation shell
β”œβ”€ account summary
β”œβ”€ project list
└─ streamed analytics panel

Do not stream a critical invariant that must be known before showing the action UI unless product UX supports it safely.

11. Public catalog design drill​

Requirements:

SEO
search/filter
large read volume
content updates every few minutes

Likely choices:

RSC public routes
URL search params
cached category/detail reads
tag invalidation
metadata/sitemap
search provider or indexed DB queries
small client interaction layer

Discuss search cardinality before caching every query.

12. Checkout/booking drill​

Requirements:

scarce inventory
payment provider
retries/webhooks

Core design:

Server Action/Handler
β†’ command
β†’ DB transaction/constraint
β†’ idempotency
β†’ provider adapter
β†’ webhook reconciliation
β†’ outbox/job for secondary work

Freshness optimization never replaces the final transactional invariant check.

13. Multi-tenant dashboard drill​

Core boundary:

host/URL/session tenant hint
β†’ membership verification
β†’ tenant-scoped DAL
β†’ tenant-aware cache key
β†’ DTO

Jobs, search and object storage also carry tenant scope.

14. File-upload drill​

Prefer direct object-storage upload with signed capability when appropriate.

Model:

request upload permission
β†’ validate tenant/user/type/size policy
β†’ issue short-lived signed upload
β†’ client uploads
β†’ finalize/scan/process

Do not buffer large files through the app server without a reason.

15. Real-time feature drill​

Clarify what β€œreal-time” means:

sub-second collaboration?
seconds-level notifications?
periodic refresh acceptable?

Next.js may own the UI and HTTP boundaries while a separate realtime service/provider owns persistent sockets.

Do not force every system through Route Handlers if the connection model needs dedicated infrastructure.

16. Search architecture drill​

Small dataset:

DB indexed query may be enough

Large relevance/search feature:

search index/provider
β†’ async indexing pipeline
β†’ tenant/security filters
β†’ eventual consistency contract

Explain reindex/reconciliation.

17. Analytics/reporting drill​

Interactive dashboard reads should not run unbounded OLTP queries.

Possible progression:

optimized indexed queries
β†’ precomputed summaries
β†’ background report jobs
β†’ analytical store

Choose based on data size and freshness.

18. External API boundary drill​

If a mobile app consumes the system:

Route Handlers / dedicated backend API

become a real contract.

Versioning, auth, rate limits and backward compatibility matter.

Do not expose Server Action transport as the public mobile API.

19. Failure-domain analysis​

For each dependency ask:

If it is down, what fails?
Can we degrade?
Can we queue?
Can we serve stale safely?
What user message appears?

Example:

recommendation provider down
β†’ hide recommendations
β†’ checkout still works

20. Capacity analysis​

Discuss:

request rate
concurrency
DB pool
cache throughput
worker concurrency
external API quota
memory
payload size

Avoid β€œautoscaling solves it” when the database pool is the bottleneck.

21. Deployment design​

Describe:

next build artifact
runtime target
CDN/reverse proxy
secret injection
DB migrations
cache/queue/storage
health/readiness
rolling/canary release
rollback

22. Version-skew design​

During rolling deploy:

old browser assets/actions
old app instances
new app instances
shared DB/cache

must coexist safely.

Mention deployment/build IDs, asset retention, compatible Server Action setup, expand/contract schemas and versioned cache formats where relevant.

23. Observability design​

For critical journeys trace:

browser request
β†’ Next route/use case
β†’ DB/cache/provider
β†’ job/event

Use route/release/dependency dimensions and avoid unbounded sensitive cardinality.

24. Cost is a design constraint​

Discuss:

CDN/cache hit rate
image optimization volume
server CPU/memory
DB load
search provider usage
AI/provider spend
queue retention
telemetry volume

Performance architecture often affects cost architecture.

25. When to split services​

Keep a modular monolith until a real constraint appears:

independent scaling
failure isolation
technology/runtime mismatch
regulatory boundary
team release autonomy

A folder boundary can exist long before a deployment boundary.

26. Multi-Zones​

Use when independent Next.js applications need path ownership and deployment autonomy.

Trade-offs include:

hard navigation across zones
asset prefix coordination
session/auth compatibility
mixed-version behavior
shared design-system/package governance

Not the default answer to β€œlarge app.”

27. Whiteboard close​

Finish with:

biggest risk
first bottleneck at 10Γ—
security invariant
rollback strategy
what you intentionally did not build

This shows prioritization.

System-design scoring rubric​

A strong answer covers:

requirements
boundaries
data model
correctness
security
freshness
failure
scale
operations
trade-offs

Framework features should appear only when they solve one of those concerns.