Engineering GuidesCookbook & Recipes
Production Patterns
Cookbook & Recipes
Copy-pasteable architecture recipes for real-world full-stack Dart and Flutter applications.
1. DRF-Style CRUD ViewSet with Throttling & Pagination
Mount a full RESTful CRUD interface over any bloom_db model with automatic request serialization, rate limits, and pagination:
bin/server.dart
dart
2. JWT Auth & Declarative Permission Algebra
Implement object-level role-based access control combining .and() and .or() operators:
lib/apps/auth/permissions.dart
dart
3. Realtime WebSockets & Live Query Invalidation
Set up a real-time pub/sub hub on the server and broadcast cache invalidation events to connected Flutter clients:
lib/realtime/hub.dart
dart
4. Resilient Background Worker Queues
Dispatch asynchronous background tasks (emails, reports, webhooks) with configurable exponential retries:
lib/jobs/email_worker.dart
dart
5. Offline-First SWR Cache & Optimistic UI
Persist queries to local device storage, bridge real-time updates, and optimistically apply mutations offline:
lib/features/todos/controllers/todo_controller.dart
dart
6. Dynamic Multi-Theme & Design Token Switcher
Switch design presets (Nova, Vega, Maia) and dark/light modes at runtime:
lib/features/settings/theme_controller.dart
dart