When designing and implementing web interfaces to ensure they are usable by everyone.
The English summary is being prepared. Showing the original description.
When designing loosely coupled systems that react to state changes asynchronously.
The English summary is being prepared. Showing the original description.
See how to installReview the instructions the agent will receive before you install.
Tightly coupled systems break and scale poorly. Event-driven architectures decouple producers from consumers by using immutable, timestamped facts as the communication mechanism. This enables systems to evolve independently, scale horizontally, and handle distributed failures gracefully.
OrderPlaced, UserRegistered, PaymentProcessed)OrderPlaced not PlaceOrder)SendEmailEvent) rather than facts (UserCreated)❌ Anti-pattern (Commands as events, synchronous coupling, no idempotency):
// WRONG: Command not event
publishEvent('SendEmail', { userId, subject });
// WRONG: Synchronous dependency
async function handleOrderPlaced(event) {
const order = await orderService.fetch(event.orderId); // Blocks on external service
await emailService.send(order.email); // Fails if service is down
}
// WRONG: No idempotency tracking - processes duplicate
async function handleUserCreated(event) {
await database.createUser(event); // Processes same event twice = duplicate user
}
✅ Correct pattern (Events, async, idempotent):
// CORRECT: Past-tense event with minimal payload
publishEvent({
type: 'UserCreated',
id: uuid(),
timestamp: new Date(),
payload: {
userId: event.userId,
email: event.email
}
});
// CORRECT: Asynchronous, idempotent consumer
async function handleUserCreated(event) {
// 1. Track processed events (idempotency)
const alreadyProcessed = await cache.get(`processed:${event.id}`);
if (alreadyProcessed) return; // Skip duplicate
// 2. Process without waiting for external services
await emailQueue.enqueue({
email: event.payload.email,
template: 'welcome'
});
// 3. Mark as processed
await cache.set(`processed:${event.id}`, true, { ttl: 86400 });
}
// 4. Dead Letter Queue for failed events
async function handleFailedEvent(event, error) {
await dlq.store({
originalEvent: event,
error: error.message,
timestamp: new Date(),
retryCount: 0
});
}
No reviews yet. Tell others what you thought.
No login needed. Share how it worked for you, ask a question, or note where it did not run.
No comments yet. Be the first to write one.
When designing and implementing web interfaces to ensure they are usable by everyone.
The English summary is being prepared. Showing the original description.
When creating or extending an HTTP API for client consumption.
The English summary is being prepared. Showing the original description.
When improving read performance and reducing database load.
The English summary is being prepared. Showing the original description.
When configuring automated build, test, and deployment workflows for a repository.
The English summary is being prepared. Showing the original description.
When asynchronously reviewing peer code before merging into the main branch.
The English summary is being prepared. Showing the original description.
When addressing slow application endpoints, high database CPU usage, or standardizing data access patterns.
The English summary is being prepared. Showing the original description.