{"id":"6b08bd3180884893657cc924","slug":"cqrs","title":"CQRS: osobny model do zmieniania, osobny do czytania","summary":"Command Query Responsibility Segregation bez przesady: od CQS Bertranda Meyera, przez trzy poziomy CQRS, po projekcje i spójność ostateczną. Komendy, zapytania i projekcje w C#, TypeScript, Javie, Go i Pythonie.","servedLang":"pl","availableLangs":["pl","en"],"topics":["cqrs","event-sourcing","vertical-slice-architecture"],"techs":["dotnet","java","typescript","go","python"],"tags":["architecture","cqrs","cqs","projections","read-models","eventual-consistency"],"level":"intermediate","kind":"article","access":"members","status":"published","cover":null,"author":{"id":"6b08bd2e80884893657cc8cf","name":"Redakcja Art of Devs","avatar":null,"handle":"redakcja","community":false},"readingMinutes":11,"stats":{"views":2,"likes":0,"bookmarks":0,"comments":0},"publishedAt":"2026-11-26T23:13:53.695Z","updatedAt":"2026-11-27T10:04:46.421Z","requestedLang":"pl","theme":{"hero":"classic","heroMedia":null,"accent":"teal","background":"grid","weaveResources":true,"toc":"right"},"seoDescription":"CQRS (Command Query Responsibility Segregation): komendy i zapytania, model zapisu i odczytu, projekcje, spójność ostateczna, różnica względem CQS i event sourcingu, przykłady w C#, TypeScript, Java, Go i Python, MediatR, @nestjs/cqrs, Axon.","wordCount":2128,"doc":{"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"Tablica w kuchni Haliny pokazuje kolejkę bonów: co lepić, ile sztuk, ile minut czeka klient. Do jej wyświetlenia system robił zapytanie łączące pięć tabel i liczył wszystko w locie, a ten sam model "},{"type":"text","text":"Order","marks":[{"type":"code"}]},{"type":"text","text":" z ORM-a obsługiwał też składanie zamówień, rabaty i faktury. Każda optymalizacja odczytu psuła zapis i odwrotnie. "},{"type":"text","text":"CQRS","marks":[{"type":"bold"}]},{"type":"text","text":" (ang. "},{"type":"text","text":"Command Query Responsibility Segregation","marks":[{"type":"italic"}]},{"type":"text","text":") rozdziela te dwie odpowiedzialności: jeden model do zmieniania stanu, drugi – do czytania."}]},{"type":"callout","attrs":{"variant":"tip","title":"W skrócie"},"content":[{"type":"bulletList","content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Komenda","marks":[{"type":"bold"}]},{"type":"text","text":" zmienia stan i nie zwraca danych (poza np. identyfikatorem), "},{"type":"text","text":"zapytanie","marks":[{"type":"bold"}]},{"type":"text","text":" zwraca dane i niczego nie zmienia."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Strona zapisu używa modelu domeny pilnującego reguł, strona odczytu – "},{"type":"text","text":"modeli skrojonych pod ekrany","marks":[{"type":"bold"}]},{"type":"text","text":" (widoków, projekcji)."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"CQRS to nie event sourcing ani osobne bazy – to wzorzec, który można wdrażać "},{"type":"text","text":"stopniowo","marks":[{"type":"bold"}]},{"type":"text","text":" i tylko tam, gdzie się opłaca."}]}]}]}]},{"type":"stats","attrs":{"items":[{"value":"1988","label":"zasada CQS","hint":"Bertrand Meyer, „Object-Oriented Software Construction”"},{"value":"2009","label":"„Clarified CQRS”","hint":"Udi Dahan porządkuje pojęcia"},{"value":"3","label":"poziomy CQRS","hint":"od osobnych handlerów po osobne magazyny danych"}]}},{"type":"heading","attrs":{"level":2,"id":"kontekst-i-sily"},"content":[{"type":"text","text":"Kontekst i siły"}]},{"type":"bulletList","content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Asymetria obciążenia","marks":[{"type":"bold"}]},{"type":"text","text":" – tablicę kuchni, historię zamówień i menu czyta się setki razy częściej, niż składa się zamówienie."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Różne kształty danych","marks":[{"type":"bold"}]},{"type":"text","text":" – zapis potrzebuje agregatu z regułami, odczyt – płaskiej listy gotowej do wyświetlenia."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Złożone reguły zapisu","marks":[{"type":"bold"}]},{"type":"text","text":" – limit stu pierogów, statusy, płatności nie powinny konkurować z wydajnością raportów."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Wiele widoków tych samych danych","marks":[{"type":"bold"}]},{"type":"text","text":" – kuchnia, klient, Halina w panelu i księgowość patrzą na zamówienie inaczej."}]}]}]},{"type":"heading","attrs":{"level":2,"id":"od-cqs-do-cqrs"},"content":[{"type":"text","text":"Od CQS do CQRS"}]},{"type":"paragraph","content":[{"type":"text","text":"Bertrand Meyer w 1988 roku sformułował zasadę "},{"type":"text","text":"CQS","marks":[{"type":"bold"}]},{"type":"text","text":" ("},{"type":"text","text":"Command–Query Separation","marks":[{"type":"italic"}]},{"type":"text","text":") na poziomie metod: metoda albo zmienia stan obiektu, albo zwraca wartość – nigdy obie rzeczy naraz. Greg Young pod koniec pierwszej dekady XXI wieku przeniósł ją na poziom architektury: skoro metody można rozdzielić, to można też rozdzielić "},{"type":"text","text":"modele","marks":[{"type":"bold"}]},{"type":"text","text":". Udi Dahan w tekście "},{"type":"text","text":"Clarified CQRS","marks":[{"type":"italic"}]},{"type":"text","text":" (2009) i Martin Fowler w krótkim wpisie z 2011 roku dodali ważne zastrzeżenie: to wzorzec dla wybranych fragmentów systemu, a nie dla całości."}]},{"type":"heading","attrs":{"level":2,"id":"struktura"},"content":[{"type":"text","text":"Struktura"}]},{"type":"diagram","attrs":{"kind":"mermaid","code":"flowchart LR\n  ui[\"UI: kuchnia, aplikacja klienta, panel Haliny\"]\n  subgraph write[\"Strona zapisu\"]\n    direction TB\n    ch[\"Handlery komend<br/>PlaceOrder, MarkOrderReady\"]\n    agg[\"Agregat Order<br/>reguły i niezmienniki\"]\n    wdb[(\"Baza zapisu<br/>znormalizowana\")]\n    ch --> agg --> wdb\n  end\n  subgraph read[\"Strona odczytu\"]\n    direction TB\n    qh[\"Handlery zapytań<br/>GetKitchenBoard, GetOrderHistory\"]\n    rdb[(\"Modele odczytu<br/>widoki, tabele płaskie, cache\")]\n    qh --> rdb\n  end\n  proj[\"Projekcje<br/>(synchronicznie lub przez zdarzenia)\"]\n  ui -- \"komendy\" --> ch\n  ui -- \"zapytania\" --> qh\n  agg -- \"zdarzenia: OrderPlaced, OrderReady\" --> proj --> rdb","caption":"CQRS: komendy idą do modelu zapisu, zapytania do modelu odczytu"}},{"type":"table","content":[{"type":"tableRow","content":[{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Poziom"}]}]},{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Na czym polega"}]}]},{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Spójność"}]}]},{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Kiedy wystarcza"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"1. Osobne komendy i zapytania"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Osobne klasy żądań i handlerów, ta sama baza i model"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"natychmiastowa"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"prawie zawsze – dobry porządek w kodzie"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"2. Osobne modele odczytu"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Zapytania czytają widoki lub tabele zdenormalizowane w tej samej bazie"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"natychmiastowa lub ostateczna"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"gdy ekrany wymagają złączeń i agregacji"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"3. Osobne magazyny"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Modele odczytu w innej bazie (Elasticsearch, Redis, replika), aktualizowane zdarzeniami"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"ostateczna"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"duża skala odczytów, wyszukiwanie, raporty"}]}]}]}]},{"type":"heading","attrs":{"level":2,"id":"jak-to-wyglada-w-kodzie"},"content":[{"type":"text","text":"Jak to wygląda w kodzie"}]},{"type":"paragraph","content":[{"type":"text","text":"Strona zapisu przechodzi przez agregat, strona odczytu czyta tabelę skrojoną pod tablicę kuchni – bez ORM-a i bez złączeń:"}]},{"type":"codeGroup","attrs":{"title":"Komenda i zapytanie"},"content":[{"type":"codeBlock","attrs":{"language":"csharp","filename":"CommandAndQuery.cs"},"content":[{"type":"text","text":"// WRITE SIDE – a command changes state through the domain model and returns (almost) nothing\npublic sealed record MarkOrderReady(Guid OrderId) : IRequest;\n\ninternal sealed class MarkOrderReadyHandler(OrdersDb db, IPublisher events) : IRequestHandler<MarkOrderReady>\n{\n    public async Task Handle(MarkOrderReady cmd, CancellationToken ct)\n    {\n        var order = await db.Orders.Include(o => o.Lines).SingleAsync(o => o.Id == cmd.OrderId, ct);\n        order.MarkReady();                                    // invariants guarded by the aggregate\n        await db.SaveChangesAsync(ct);\n        await events.Publish(new OrderReady(order.Id, order.Phone), ct);\n    }\n}\n\n// READ SIDE – a query never changes state and reads a model shaped for the screen\npublic sealed record GetKitchenBoard(int Limit = 30) : IRequest<IReadOnlyList<KitchenTicketView>>;\npublic sealed record KitchenTicketView(Guid OrderId, string Summary, int Pieces, DateTime PlacedAt, int MinutesWaiting);\n\ninternal sealed class GetKitchenBoardHandler(IDbConnection sql)\n    : IRequestHandler<GetKitchenBoard, IReadOnlyList<KitchenTicketView>>\n{\n    public async Task<IReadOnlyList<KitchenTicketView>> Handle(GetKitchenBoard q, CancellationToken ct) =>\n        (await sql.QueryAsync<KitchenTicketView>(new CommandDefinition(\"\"\"\n            SELECT TOP (@Limit) OrderId, Summary, Pieces, PlacedAt,\n                   DATEDIFF(minute, PlacedAt, SYSUTCDATETIME()) AS MinutesWaiting\n            FROM read.KitchenBoard           -- a denormalised table, no joins\n            ORDER BY PlacedAt\n            \"\"\", new { q.Limit }, cancellationToken: ct))).AsList();   // Dapper, no ORM tracking\n}"}]},{"type":"codeBlock","attrs":{"language":"typescript","filename":"kitchen.cqrs.ts"},"content":[{"type":"text","text":"import { CommandHandler, ICommandHandler, IQueryHandler, QueryHandler, EventBus } from \"@nestjs/cqrs\";\n\n// WRITE SIDE\nexport class MarkOrderReadyCommand {\n  constructor(public readonly orderId: string) {}\n}\n\n@CommandHandler(MarkOrderReadyCommand)\nexport class MarkOrderReadyHandler implements ICommandHandler<MarkOrderReadyCommand> {\n  constructor(private readonly orders: OrdersRepository, private readonly events: EventBus) {}\n\n  async execute({ orderId }: MarkOrderReadyCommand): Promise<void> {\n    const order = await this.orders.get(orderId);\n    order.markReady(); // invariants guarded by the aggregate\n    await this.orders.save(order);\n    this.events.publish(new OrderReadyEvent(order.id, order.phone));\n  }\n}\n\n// READ SIDE\nexport class GetKitchenBoardQuery {\n  constructor(public readonly limit = 30) {}\n}\n\n@QueryHandler(GetKitchenBoardQuery)\nexport class GetKitchenBoardHandler implements IQueryHandler<GetKitchenBoardQuery> {\n  constructor(private readonly db: Kysely<ReadDb>) {}\n\n  execute({ limit }: GetKitchenBoardQuery): Promise<KitchenTicketView[]> {\n    return this.db\n      .selectFrom(\"kitchen_board\") // a denormalised table maintained by a projection\n      .selectAll()\n      .orderBy(\"placed_at\")\n      .limit(limit)\n      .execute();\n  }\n}"}]},{"type":"codeBlock","attrs":{"language":"java","filename":"KitchenCqrs.java"},"content":[{"type":"text","text":"// WRITE SIDE\npublic record MarkOrderReady(UUID orderId) {}\n\n@Service\nclass MarkOrderReadyHandler {\n    private final OrderRepository orders;\n    private final ApplicationEventPublisher events;\n\n    MarkOrderReadyHandler(OrderRepository orders, ApplicationEventPublisher events) {\n        this.orders = orders;\n        this.events = events;\n    }\n\n    @Transactional\n    public void handle(MarkOrderReady cmd) {\n        var order = orders.findById(cmd.orderId()).orElseThrow();\n        order.markReady();                                  // invariants guarded by the aggregate\n        events.publishEvent(new OrderReady(order.id(), order.phone()));\n    }\n}\n\n// READ SIDE\npublic record KitchenTicketView(UUID orderId, String summary, int pieces, Instant placedAt) {}\n\n@Service\nclass KitchenBoardQueries {\n    private final JdbcClient jdbc;\n\n    KitchenBoardQueries(JdbcClient jdbc) { this.jdbc = jdbc; }\n\n    @Transactional(readOnly = true)\n    public List<KitchenTicketView> board(int limit) {\n        return jdbc.sql(\"\"\"\n                SELECT order_id, summary, pieces, placed_at\n                FROM read_kitchen_board              -- denormalised, no joins\n                ORDER BY placed_at LIMIT :limit\n                \"\"\")\n            .param(\"limit\", limit)\n            .query(KitchenTicketView.class)\n            .list();\n    }\n}"}]},{"type":"codeBlock","attrs":{"language":"go","filename":"kitchen/cqrs.go"},"content":[{"type":"text","text":"package kitchen\n\n// WRITE SIDE\ntype MarkOrderReady struct{ OrderID string }\n\ntype MarkOrderReadyHandler struct {\n\tOrders OrderRepository\n\tEvents EventPublisher\n}\n\nfunc (h MarkOrderReadyHandler) Handle(ctx context.Context, cmd MarkOrderReady) error {\n\torder, err := h.Orders.Get(ctx, cmd.OrderID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := order.MarkReady(); err != nil { // invariants guarded by the aggregate\n\t\treturn err\n\t}\n\tif err := h.Orders.Save(ctx, order); err != nil {\n\t\treturn err\n\t}\n\treturn h.Events.Publish(ctx, OrderReady{OrderID: order.ID, Phone: order.Phone})\n}\n\n// READ SIDE – a separate, read-only path straight to a view table\ntype KitchenTicketView struct {\n\tOrderID  string    `json:\"orderId\"`\n\tSummary  string    `json:\"summary\"`\n\tPieces   int       `json:\"pieces\"`\n\tPlacedAt time.Time `json:\"placedAt\"`\n}\n\nfunc KitchenBoard(ctx context.Context, db *sql.DB, limit int) ([]KitchenTicketView, error) {\n\trows, err := db.QueryContext(ctx,\n\t\t`SELECT order_id, summary, pieces, placed_at FROM read_kitchen_board ORDER BY placed_at LIMIT $1`, limit)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\tvar out []KitchenTicketView\n\tfor rows.Next() {\n\t\tvar v KitchenTicketView\n\t\tif err := rows.Scan(&v.OrderID, &v.Summary, &v.Pieces, &v.PlacedAt); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tout = append(out, v)\n\t}\n\treturn out, rows.Err()\n}"}]},{"type":"codeBlock","attrs":{"language":"python","filename":"kitchen/cqrs.py"},"content":[{"type":"text","text":"from dataclasses import dataclass\n\nfrom sqlalchemy import text\n\n\n# WRITE SIDE\n@dataclass(frozen=True)\nclass MarkOrderReady:\n    order_id: str\n\n\nclass MarkOrderReadyHandler:\n    def __init__(self, orders: \"OrderRepository\", events: \"EventPublisher\"):\n        self.orders, self.events = orders, events\n\n    def __call__(self, cmd: MarkOrderReady) -> None:\n        order = self.orders.get(cmd.order_id)\n        order.mark_ready()  # invariants guarded by the aggregate\n        self.orders.save(order)\n        self.events.publish(OrderReady(order_id=order.id, phone=order.phone))\n\n\n# READ SIDE – plain SQL against a denormalised view, returns dicts ready for JSON\ndef kitchen_board(session, limit: int = 30) -> list[dict]:\n    rows = session.execute(\n        text(\"SELECT order_id, summary, pieces, placed_at FROM read_kitchen_board \"\n             \"ORDER BY placed_at LIMIT :limit\"),\n        {\"limit\": limit},\n    )\n    return [dict(r._mapping) for r in rows]"}]}]}]},"toc":[{"id":"kontekst-i-sily","text":"Kontekst i siły","level":2,"locked":false},{"id":"od-cqs-do-cqrs","text":"Od CQS do CQRS","level":2,"locked":false},{"id":"struktura","text":"Struktura","level":2,"locked":false},{"id":"jak-to-wyglada-w-kodzie","text":"Jak to wygląda w kodzie","level":2,"locked":false},{"id":"cqrs-a-event-sourcing","text":"CQRS a event sourcing","level":2,"locked":true},{"id":"kompromisy","text":"Kompromisy","level":2,"locked":true},{"id":"sciezka-wdrozenia","text":"Ścieżka wdrożenia","level":2,"locked":true},{"id":"w-praktyce","text":"W praktyce","level":2,"locked":true},{"id":"antywzorce","text":"Antywzorce","level":2,"locked":true},{"id":"powiazane-tematy","text":"Powiązane tematy","level":2,"locked":true},{"id":"sprawdz-sie","text":"Sprawdź się","level":2,"locked":true}],"locked":true,"paywall":null,"previewRatio":0.3,"totalBlocks":36,"visibleBlocks":13,"resources":[{"id":"6b0857be3c96f2d34d0b422d","type":"article","provider":"web","url":"https://udidahan.com/2009/12/09/clarified-cqrs","embedUrl":null,"title":"Clarified CQRS","description":"","author":"Udi Dahan","thumbnailUrl":null,"durationSec":null,"lang":"en","topics":["cqrs"],"techs":["general"],"tags":["software-architecture"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":null,"popularity":70,"verifiedAt":"2026-11-26T11:26:00.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:59.965Z","updatedAt":"2026-11-26T16:00:59.965Z"},{"id":"6b0857b53c96f2d34d0b3a3f","type":"article","provider":"web","url":"https://martinfowler.com/bliki/CQRS.html","embedUrl":null,"title":"CQRS: Command Query Responsibility Segregation (2011)","description":"CQRS (Command Query Responsibility Segregation) is the notion that you can use a different model to update information than the model you use to read information","author":"martinfowler.com","thumbnailUrl":"https://martinfowler.com/bliki/images/cqrs/cqrs.png","durationSec":null,"lang":"en","topics":["cqrs"],"techs":["general"],"tags":["software-architecture","hacker-news"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"hn","publishedAt":"2020-11-11T12:48:09.000Z","popularity":60,"verifiedAt":"2026-11-26T11:15:54.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:52.228Z","updatedAt":"2026-11-26T16:00:52.228Z"},{"id":"6b0857a53c96f2d34d0b3216","type":"video","provider":"youtube","url":"https://www.youtube.com/watch?v=JHGkaShoyNs","embedUrl":"https://www.youtube-nocookie.com/embed/JHGkaShoyNs","title":"Greg Young - CQRS and Event Sourcing - Code on the Beach 2014","description":"","author":"Code on the Beach","thumbnailUrl":"https://i.ytimg.com/vi/JHGkaShoyNs/hqdefault.jpg","durationSec":null,"lang":"en","topics":["cqrs","event-sourcing"],"techs":["general"],"tags":[],"price":"free","featured":true,"featuredOrder":12,"packageName":null,"source":"seed","publishedAt":null,"popularity":0,"verifiedAt":"2026-11-26T00:00:00.000Z","curated":true,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:37.067Z","updatedAt":"2026-11-26T16:00:37.067Z"},{"id":"6b0857bf3c96f2d34d0b42a0","type":"article","provider":"web","url":"https://learn.microsoft.com/en-us/azure/architecture/patterns/cqrs","embedUrl":null,"title":"CQRS Pattern","description":"Learn how to segregate operations that read data from operations that update data by using the Command Query Responsibility Segregation (CQRS) pattern.","author":"Microsoft Azure Architecture Center","thumbnailUrl":"https://learn.microsoft.com/en-us/media/open-graph-image.png","durationSec":null,"lang":"en","topics":["cqrs"],"techs":["general"],"tags":["azure","cloud","software-architecture"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":null,"popularity":63,"verifiedAt":"2026-11-26T11:07:47.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:01:02.417Z","updatedAt":"2026-11-26T16:01:02.417Z"},{"id":"6b0857b73c96f2d34d0b3bcd","type":"podcast","provider":"apple-podcasts","url":"https://podcasts.apple.com/us/podcast/57-o-faktach-i-mitach-wzorca-cqrs-z-oskarem-dudyczem/id1508298430?i=1000608274059","embedUrl":"https://embed.podcasts.apple.com/us/podcast/id1508298430?i=1000608274059","title":"57. O faktach i mitach wzorca CQRS z Oskarem Dudyczem","description":"CQRS, czyli Command Query Responsibility Segregation, jest wzorcem wyjątkowo popularnym i powszechnie stosowanym w wielu systemach. Mało kto jednak sięgnął po oryginalny dokument autorstwa Grega Younga, który opisuje założenia tego konceptu architektonicznego i z czasem obrósł on kilkoma mitami…","author":"Better Software Design","thumbnailUrl":"https://is1-ssl.mzstatic.com/image/thumb/Podcasts115/v4/a9/6d/bb/a96dbb46-a01a-9cf6-40ef-27a27cef3c73/mza_18038037312547630971.jpg/600x600bb.jpg","durationSec":3417,"lang":"pl","topics":["cqrs"],"techs":["general"],"tags":["podcast","software-architecture"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"itunes","publishedAt":"2023-04-10T23:00:00.000Z","popularity":69,"verifiedAt":"2026-11-26T10:58:49.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:53.924Z","updatedAt":"2026-11-26T16:00:53.924Z"},{"id":"6b0857be3c96f2d34d0b41ec","type":"article","provider":"web","url":"https://martinfowler.com/bliki/CommandQuerySeparation.html","embedUrl":null,"title":"bliki: Command Query Separation","description":"a bliki entry for Command Query Separation","author":"Martin Fowler","thumbnailUrl":"https://martinfowler.com/logo-sq.png","durationSec":null,"lang":"en","topics":["cqrs"],"techs":["general"],"tags":["martin-fowler","software-architecture"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":null,"popularity":75,"verifiedAt":"2026-11-26T11:07:17.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:59.965Z","updatedAt":"2026-11-26T16:00:59.965Z"}],"challenges":[{"id":"6b093dc091bd8fbaf2a0c8c0","slug":"event-sourced-account","title":"Konto bankowe w event sourcingu","summary":"Agregat konta, którego stan powstaje wyłącznie z odtwarzania zdarzeń, magazyn zdarzeń z optymistyczną współbieżnością i repozytorium zapisujące tylko nowe fakty. Zapytania o stan z przeszłości w gratisie.","servedLang":"pl","availableLangs":["pl","en"],"kind":"code","category":"architecture","status":"published","difficulty":"hard","topics":["event-sourcing","cqrs"],"techs":["typescript","javascript","python","dotnet","java","go"],"tags":["event-sourcing","aggregate","event-store","optimistic-concurrency","ddd"],"languages":["typescript","javascript","python","csharp","java","go"],"questionCount":null,"xp":40,"stats":{"attempts":0,"solves":0,"solutions":0,"comments":0},"solveRate":null,"publishedAt":"2026-11-27T08:22:24.935Z"},{"id":"6b093dc191bd8fbaf2a0c8d0","slug":"inventory-cqrs","title":"Magazyn z CQRS – osobny model zapisu i odczytu","summary":"Komendy magazynowe walidowane na własnym modelu zapisu, zdarzenia na szynie i projekcja budująca model odczytu z raportem niskich stanów. Model odczytu da się odtworzyć z samych zdarzeń.","servedLang":"pl","availableLangs":["pl","en"],"kind":"code","category":"architecture","status":"published","difficulty":"medium","topics":["cqrs","event-driven-architecture"],"techs":["typescript","javascript","python","dotnet","java","go"],"tags":["cqrs","read-model","projection","events","inventory"],"languages":["typescript","javascript","python","csharp","java","go"],"questionCount":null,"xp":20,"stats":{"attempts":0,"solves":0,"solutions":0,"comments":0},"solveRate":null,"publishedAt":"2026-11-27T08:22:25.519Z"}],"attachments":[],"hasCode":true,"repoUrl":null,"series":[{"slug":"architecture-path","title":"Od monolitu do mikroserwisów","items":[{"slug":"monolith","title":"Monolit: jedna aplikacja, jedno wdrożenie i dlaczego to często dobry start","current":false},{"slug":"modular-monolith","title":"Modularny monolit: twarde granice bez kosztów sieci","current":false},{"slug":"layered-architecture","title":"Architektura warstwowa: prezentacja, logika, dane – i gdzie to się psuje","current":false},{"slug":"hexagonal-architecture","title":"Pierogi w Heksagonie","current":false},{"slug":"clean-architecture","title":"Czysta architektura: reguła zależności i przypadki użycia w centrum","current":false},{"slug":"onion-architecture","title":"Architektura cebulowa: model domeny w środku, infrastruktura na zewnątrz","current":false},{"slug":"vertical-slice-architecture","title":"Architektura pionowych wycinków: kod według funkcji, nie według warstw","current":false},{"slug":"cqrs","title":"CQRS: osobny model do zmieniania, osobny do czytania","current":true},{"slug":"event-sourcing","title":"Event sourcing: zapisuj fakty, a nie tylko ostatni stan","current":false},{"slug":"event-driven-architecture","title":"Architektura sterowana zdarzeniami: kto publikuje, kto słucha i co może pójść nie tak","current":false},{"slug":"microservices","title":"Mikroserwisy: niezależne wdrożenia, prawdziwe koszty i kiedy to się opłaca","current":false},{"slug":"ddd-strategic-design","title":"DDD – projektowanie strategiczne: poddomeny, konteksty ograniczone i mapy kontekstów","current":false}]}],"prev":{"slug":"vertical-slice-architecture","title":"Architektura pionowych wycinków: kod według funkcji, nie według warstw"},"next":{"slug":"event-sourcing","title":"Event sourcing: zapisuj fakty, a nie tylko ostatni stan"},"featured":false,"authorCard":{"id":"6b08bd2e80884893657cc8cf","name":"Redakcja Art of Devs","avatar":null,"handle":"redakcja","headline":"Wzorce projektowe · Architektura · AI i LLM","community":false,"reputation":{"points":3900,"level":{"key":"mentor","label":"Mentor"}},"articles":68,"skills":[{"key":"typescript","title":"TypeScript","level":5,"levelLabel":"Autorytet","articles":63},{"key":"dotnet","title":".NET","level":5,"levelLabel":"Autorytet","articles":53},{"key":"python","title":"Python","level":5,"levelLabel":"Autorytet","articles":52},{"key":"java","title":"Java","level":5,"levelLabel":"Autorytet","articles":38}]}}