Observable: A data source that emits values over time — like an async iterator. You subscribe to it and receive values as they arrive: HTTP responses, mouse moves, WebSocket messages. An Observable represents a stream of values that arrive over time, such as mouse movements, WebSocket messages or repeated API results. You subscribe to it, and your code runs every time a new value arrives.
Libraries like RxJS make Observables powerful by offering operators to transform streams: filter them, combine them, wait until typing pauses before searching, or cancel an old request when a new one starts. Angular uses them heavily.
What should you keep in mind with Observable?
They shine for complex event-driven interfaces, such as live search, real-time dashboards or collaborative editing. For a single request that returns once, a Promise with async and await is simpler. Always unsubscribe when a component is destroyed, or the subscription keeps running in the background and causes memory leaks and duplicate updates.
Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use this skill when designing clean architecture for a new microservice, when refactoring a monolith to use bounded contexts, when implementing hexagonal or onion architecture patterns, or when debugging dependency cycles between application layers.
Implement Command Query Responsibility Segregation for scalable architectures. Use when separating read and write models, optimizing query performance, or building event-sourced systems.