Patterns for Building Event-driven Web & Mobile App Backends • Josh Kahn • GOTO 2024

Learn key patterns for building event-driven backends including real-time updates, long processes & push notifications. Practical AWS implementation examples included.

Key takeaways
  • Event-driven architectures are essential for building modern web and mobile app backends, with three main interaction patterns: real-time events, long-running processes, and push notifications

  • AWS AppSync (managed GraphQL service) provides a robust solution for real-time updates, offering:

    • Built-in WebSocket support
    • Flexible authentication options
    • Subscription capabilities
    • Direct integration with EventBridge
  • Long-running processes (>30 seconds) require different handling approaches:

    • Using Step Functions for event sequencing
    • Implementing asynchronous processing
    • Storing results in S3 or DynamoDB
    • Notifying clients when processing completes
  • Push notifications can be implemented using:

    • Amazon Pinpoint or Firebase for mobile
    • Web Push API for browsers
    • Requires managing device tokens and user permissions
    • Best suited for important updates to avoid notification fatigue
  • Polling vs Real-time Considerations:

    • Polling can be expensive and create unnecessary network traffic
    • WebSockets provide more efficient real-time updates
    • Consider broadcast vs point-to-point communication needs
    • Filter events to reduce costs and complexity
  • Backend for Frontend (BFF) pattern helps:

    • Separate concerns between frontend and backend
    • Provide optimized APIs for specific frontends
    • Enable better team autonomy
    • Support different technology stacks
  • Architecture patterns should consider:

    • Authentication requirements
    • Scalability needs
    • Development team expertise
    • Client platform requirements (web vs mobile)
    • Operational complexity
  • EventBridge serves as an effective backbone for:

    • Event choreography
    • System integration
    • Decoupling services
    • Supporting multiple communication patterns
  • CloudWatch/Logging best practices:

    • Use dead letter queues for failed events
    • Implement proper error handling
    • Monitor connection management
    • Debug subscription issues
  • Performance optimization strategies:

    • Filter unnecessary updates
    • Implement efficient data mapping
    • Use proper batch processing
    • Consider partial batch failure handling