<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/using-event-metadata-in-event-driven-projections-quoiswh1k" -->

---
title: Using event metadata in event-driven projections | daily.dev
description: When building event-driven projections, you sometimes need data (like a client ID) that isn&#x27;t repeated across all events in a stream. Rather than adding...
canonical: https://daily.dev/posts/using-event-metadata-in-event-driven-projections-quoiswh1k
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Using event metadata in event-driven projections | daily.dev
og:description: When building event-driven projections, you sometimes need data (like a client ID) that isn&#x27;t repeated across all events in a stream. Rather than adding...
og:url: https://daily.dev/posts/using-event-metadata-in-event-driven-projections-quoiswh1k
og:image: https://api.daily.dev/og/posts/QuOiSWH1k.png
og:image:alt: Using event metadata in event-driven projections
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Using event metadata in event-driven projections

**[Event-Driven by Oskar Dudycz](https://daily.dev/sources/event-driven-io)** · 9 min read · 0 upvotes · 0 comments

## Summary

When building event-driven projections, you sometimes need data (like a client ID) that isn't repeated across all events in a stream. Rather than adding redundant fields to every event or coupling read models together, you can store contextual data in event metadata. Using a shopping cart example in TypeScript with Emmett and Pongo, the post demonstrates how to attach a clientId to event metadata at the command level, then use it in multi-stream projections to correlate events with the correct read model document. The approach is presented as a valid tradeoff, not a universal solution, with guidance on when metadata use is appropriate versus when it becomes a 'bag for random data'.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://event-driven.io/en/projections_and_event_metadata>

---

Tags: [#architecture](https://daily.dev/tags/architecture), [#typescript](https://daily.dev/tags/typescript)

[View this post on daily.dev](https://daily.dev/posts/using-event-metadata-in-event-driven-projections-quoiswh1k)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Using event metadata in event-driven projections","url":"https://daily.dev/posts/using-event-metadata-in-event-driven-projections-quoiswh1k","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/using-event-metadata-in-event-driven-projections-quoiswh1k"},"datePublished":"2026-06-17T11:26:16.337Z","dateModified":"2026-06-17T11:32:42.607Z","description":"When building event-driven projections, you sometimes need data (like a client ID) that isn't repeated across all events in a stream. Rather than adding...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/66d902d545d943af7a797c6724e779e9?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/66d902d545d943af7a797c6724e779e9?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Event-Driven by Oskar Dudycz","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Event-Driven by Oskar Dudycz","logo":"https://media.daily.dev/image/upload/s--unDKCFQ0--/f_auto,q_auto/v1781695550/logos/event-driven-io?_a=BAMAMiWQ0","url":"https://daily.dev/sources/event-driven-io"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/using-event-metadata-in-event-driven-projections-quoiswh1k","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"architecture,typescript","timeRequired":"PT9M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Event-Driven by Oskar Dudycz","item":"https://daily.dev/sources/event-driven-io"},{"@type":"ListItem","position":3,"name":"Using event metadata in event-driven projections"}]}
```

