Advanced Topics¶
Advanced patterns for building modern web applications.
Section Overview¶
| Topic | Description |
|---|---|
| Real-Time Features | WebSockets, SSE, polling |
| Server Actions | Next.js Server Actions |
| Streaming & Suspense | React Suspense patterns |
| Event-Driven Architecture | Event sourcing, message queues |
| Feature Flags | Controlled feature rollout |
When to Use Advanced Patterns¶
Real-Time¶
Use when: - Users need instant updates (chat, notifications) - Collaborative features (shared documents) - Live data (dashboards, monitoring)
Server Actions¶
Use when: - Form submissions with server-side logic - Mutations that need server validation - Progressive enhancement is important
Streaming & Suspense¶
Use when: - Pages have slow data dependencies - Different parts load at different speeds - You want to show content progressively
Event-Driven¶
Use when: - Decoupling services is important - Handling high-volume async operations - Building audit trails or replay capabilities
Feature Flags¶
Use when: - Rolling out features gradually - A/B testing - Quick rollback capability needed
Quick Decision Guide¶
Need instant updates?
├─ Yes → Real-Time (WebSocket/SSE)
└─ No
├─ Form submission?
│ └─ Yes → Server Actions
└─ Slow data loading?
└─ Yes → Streaming/Suspense
Related Documentation¶
- Concurrency — Async patterns
- Performance — Optimization
- API Design — API patterns
- Frontend Standards — TypeScript/React/Next.js standards for server actions and streaming
- Cookbook Recipes — Step-by-step recipes for common tasks
- Backend Standards — Python/FastAPI architecture and patterns