{"id":"6b08bd3e80884893657cca2e","slug":"vertical-slice-architecture","title":"Vertical slice architecture: code by feature, not by layer","summary":"Jimmy Bogard's Vertical Slice Architecture: every feature of the system is a separate slice from the endpoint to the database. Structure and a complete slice in C#, TypeScript, Java, Go and Python, how it combines with CQRS and the hexagon, and the risks of duplication.","servedLang":"en","availableLangs":["pl","en"],"topics":["vertical-slice-architecture","cqrs","layered-architecture"],"techs":["dotnet","java","typescript","go","python"],"tags":["architecture","vertical-slices","feature-folders","mediatr","refactoring"],"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":4,"likes":0,"bookmarks":0,"comments":0},"publishedAt":"2026-11-26T23:14:06.861Z","updatedAt":"2026-11-27T13:19:03.461Z","requestedLang":"en","theme":{"hero":"classic","heroMedia":null,"accent":"teal","background":"dots","weaveResources":true,"toc":"right"},"seoDescription":"Vertical Slice Architecture: grouping code by feature, minimal coupling between slices, MediatR, FastEndpoints, examples in C#, TypeScript, Java, Go and Python, comparison with layers and Clean Architecture.","wordCount":2036,"doc":{"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"At Halina's pierogi place, the request \"add order cancellation\" meant changes in five places: the controller, the service, the service interface, the repository and a DTO – in four different folders. A reviewer had to jump all over the repository to understand one feature. "},{"type":"text","text":"Vertical Slice Architecture","marks":[{"type":"bold"}]},{"type":"text","text":" flips this layout: code is grouped by "},{"type":"text","text":"feature","marks":[{"type":"bold"}]},{"type":"text","text":", not by technical layer."}]},{"type":"callout","attrs":{"variant":"tip","title":"In short"},"content":[{"type":"bulletList","content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Every feature (e.g. \"cancel an order\") is a "},{"type":"text","text":"slice","marks":[{"type":"bold"}]},{"type":"text","text":": endpoint, request, validation, logic and data access in one place."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"The principle: "},{"type":"text","text":"minimise coupling between slices, maximise coupling within a slice","marks":[{"type":"bold"}]},{"type":"text","text":"."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Each slice chooses its own implementation – a simple read with SQL, a complex write through the domain model."}]}]}]}]},{"type":"stats","attrs":{"items":[{"value":"2018","label":"Jimmy Bogard's post","hint":"\"Vertical Slice Architecture\""},{"value":"1","label":"folder per feature","hint":"instead of 4–5 layers for every change"},{"value":"0","label":"shared services \"just in case\"","hint":"share only once duplication appears"}]}},{"type":"heading","attrs":{"level":2,"id":"context-and-forces"},"content":[{"type":"text","text":"Context and forces"}]},{"type":"bulletList","content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Changes arrive as features","marks":[{"type":"bold"}]},{"type":"text","text":" – the business asks for \"cancellation\", \"order history\", \"catering quote\", not for \"a change in the service layer\"."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Different features have different complexity","marks":[{"type":"bold"}]},{"type":"text","text":" – the menu list is one query, while placing an order involves rules, stock and payment."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Layers force ceremony","marks":[{"type":"bold"}]},{"type":"text","text":" – every feature has to pass through all the layers, even when nothing happens in them."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Team conflicts","marks":[{"type":"bold"}]},{"type":"text","text":" – everyone changes the shared "},{"type":"text","text":"OrderService","marks":[{"type":"code"}]},{"type":"text","text":" and "},{"type":"text","text":"OrderRepository","marks":[{"type":"code"}]},{"type":"text","text":" classes, so everyone fights over them."}]}]}]},{"type":"paragraph","content":[{"type":"text","text":"Jimmy Bogard, the author of MediatR and AutoMapper, described this approach in 2018 as a generalisation of what he had been doing for years in CQRS projects: every request is a separate object with a separate handler, so code naturally gathers around requests."}]},{"type":"heading","attrs":{"level":2,"id":"structure"},"content":[{"type":"text","text":"Structure"}]},{"type":"diagram","attrs":{"kind":"mermaid","code":"flowchart TB\n  subgraph s1[\"Slice: PlaceOrder\"]\n    direction TB\n    e1[\"POST /orders\"] --> h1[\"Handler + domain model\"] --> d1[(\"EF Core\")]\n  end\n  subgraph s2[\"Slice: CancelOrder\"]\n    direction TB\n    e2[\"POST /orders/{id}/cancel\"] --> h2[\"Handler + Order.Cancel()\"] --> d2[(\"EF Core\")]\n  end\n  subgraph s3[\"Slice: GetOrderHistory\"]\n    direction TB\n    e3[\"GET /orders/history\"] --> h3[\"SQL query\"] --> d3[(\"Dapper\")]\n  end\n  subgraph s4[\"Slice: GetMenu\"]\n    direction TB\n    e4[\"GET /menu\"] --> h4[\"Read from cache\"] --> d4[(\"Redis\")]\n  end\n  pipe[\"Shared pipeline: logging, validation, authorisation, transactions\"]\n  pipe -.-> s1 & s2 & s3 & s4","caption":"Layers horizontally, slices vertically"}},{"type":"table","content":[{"type":"tableRow","content":[{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Element"}]}]},{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Role"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Slice (feature)"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Everything one feature needs: input, logic, data, output"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Request and handler"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"A command or query and the class that handles it (often MediatR, Wolverine or a plain method)"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Pipeline"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Cross-cutting behaviours: logging, validation, transactions – once, for all slices"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Shared domain"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Only what slices genuinely share: aggregates, rules, value objects"}]}]}]}]},{"type":"heading","attrs":{"level":2,"id":"what-it-looks-like-in-code"},"content":[{"type":"text","text":"What it looks like in code"}]},{"type":"codeGroup","attrs":{"title":"Feature-based layout in five stacks"},"content":[{"type":"codeBlock","attrs":{"language":"plaintext","filename":"dotnet/project-tree.txt"},"content":[{"type":"text","text":"Pierogarnia.Api/\n├── Features/\n│   ├── Orders/\n│   │   ├── PlaceOrder.cs          ← endpoint + command + validator + handler in ONE file\n│   │   ├── CancelOrder.cs\n│   │   └── GetOrderHistory.cs     ← a read slice: Dapper + SQL, no domain model needed\n│   ├── Menu/\n│   │   └── GetMenu.cs\n│   └── Catering/\n│       └── RequestQuote.cs\n├── Domain/                        ← only what slices genuinely share: Order, rules, value objects\n├── Infrastructure/                ← DbContext, pipeline behaviours (logging, validation, transactions)\n└── Program.cs                     ← app.MapFeatureEndpoints()"}]},{"type":"codeBlock","attrs":{"language":"plaintext","filename":"java/package-tree.txt"},"content":[{"type":"text","text":"pl.pierogarnia\n├── orders/\n│   ├── placeorder/                ← PlaceOrderController, PlaceOrderCommand, PlaceOrderHandler\n│   ├── cancelorder/\n│   └── orderhistory/              ← JdbcClient query + response record\n├── menu/getmenu/\n└── shared/                        ← Order aggregate, common value objects"}]},{"type":"codeBlock","attrs":{"language":"plaintext","filename":"node/src-tree.txt"},"content":[{"type":"text","text":"src/\n├── features/\n│   ├── orders/\n│   │   ├── place-order.ts         ← route + zod schema + handler\n│   │   ├── cancel-order.ts\n│   │   └── order-history.ts\n│   └── menu/get-menu.ts\n├── domain/                        ← shared Order logic (only when duplication appears)\n└── app.ts                         ← registers every feature router"}]},{"type":"codeBlock","attrs":{"language":"plaintext","filename":"go/module-tree.txt"},"content":[{"type":"text","text":"pierogarnia/\n├── internal/\n│   ├── orders/\n│   │   ├── placeorder/            ← package placeorder: Handler, request, response, SQL\n│   │   ├── cancelorder/\n│   │   └── history/\n│   ├── menu/getmenu/\n│   └── platform/                  ← db, middleware (logging, auth)\n└── cmd/api/main.go                ← mux.Handle per feature"}]},{"type":"codeBlock","attrs":{"language":"plaintext","filename":"python/package-tree.txt"},"content":[{"type":"text","text":"pierogarnia/\n├── features/\n│   ├── orders/\n│   │   ├── place_order.py         ← APIRouter + pydantic models + handler\n│   │   ├── cancel_order.py\n│   │   └── order_history.py\n│   └── menu/get_menu.py\n├── domain/                        ← shared rules\n└── main.py                        ← app.include_router(...) for each feature"}]}]},{"type":"paragraph","content":[{"type":"text","text":"A complete \"cancel an order\" slice. Notice that the variants deliberately take different approaches: in C# and Java the rule lives in the "},{"type":"text","text":"Order","marks":[{"type":"code"}]},{"type":"text","text":" aggregate because other slices use it too, while in Go, TypeScript and Python a conditional "},{"type":"text","text":"UPDATE","marks":[{"type":"code"}]},{"type":"text","text":" is enough. In vertical slice architecture that's allowed – each slice picks the tool for its problem."}]},{"type":"codeGroup","attrs":{"title":"The CancelOrder slice"},"content":[{"type":"codeBlock","attrs":{"language":"csharp","filename":"Features/Orders/CancelOrder.cs"},"content":[{"type":"text","text":"namespace Pierogarnia.Api.Features.Orders;\n\n// Everything about \"cancel an order\" lives here: endpoint, request, rules, data access.\npublic static class CancelOrder\n{\n    public sealed record Command(Guid OrderId, string Reason) : IRequest<Result>;\n\n    public sealed class Validator : AbstractValidator<Command>       // FluentValidation\n    {\n        public Validator() => RuleFor(c => c.Reason).NotEmpty().MaximumLength(200);\n    }\n\n    internal sealed class Handler(PierogarniaDb db, TimeProvider clock) : IRequestHandler<Command, Result>\n    {\n        public async Task<Result> Handle(Command cmd, CancellationToken ct)\n        {\n            var order = await db.Orders.FindAsync([cmd.OrderId], ct);\n            if (order is null) return Result.NotFound();\n\n            // The rule lives in the domain because PlaceOrder and the kitchen use it too.\n            var cancelled = order.Cancel(cmd.Reason, clock.GetUtcNow());\n            if (!cancelled) return Result.Conflict(\"The kitchen has already started cooking.\");\n\n            await db.SaveChangesAsync(ct);\n            return Result.Ok();\n        }\n    }\n\n    public static void Map(IEndpointRouteBuilder app) =>\n        app.MapPost(\"/orders/{id:guid}/cancel\", async (Guid id, CancelBody body, ISender sender) =>\n            (await sender.Send(new Command(id, body.Reason))).ToHttp());\n\n    public sealed record CancelBody(string Reason);\n}"}]},{"type":"codeBlock","attrs":{"language":"typescript","filename":"features/orders/cancel-order.ts"},"content":[{"type":"text","text":"import { Router } from \"express\";\nimport { z } from \"zod\";\nimport { db } from \"../../platform/db\";\n\n// Everything about \"cancel an order\" lives here: route, input schema, rules, data access.\nconst Body = z.object({ reason: z.string().min(1).max(200) });\n\nexport async function cancelOrder(orderId: string, reason: string): Promise<\"ok\" | \"not-found\" | \"too-late\"> {\n  return db.$transaction(async (tx) => {\n    const order = await tx.order.findUnique({ where: { id: orderId } });\n    if (!order) return \"not-found\";\n    if (order.status !== \"PLACED\") return \"too-late\"; // the kitchen has already started cooking\n\n    await tx.order.update({\n      where: { id: orderId },\n      data: { status: \"CANCELLED\", cancelReason: reason, cancelledAt: new Date() },\n    });\n    return \"ok\";\n  });\n}\n\nexport const cancelOrderRouter = Router().post(\"/orders/:id/cancel\", async (req, res) => {\n  const body = Body.safeParse(req.body);\n  if (!body.success) return res.status(400).json(body.error.flatten());\n\n  const result = await cancelOrder(req.params.id, body.data.reason);\n  const status = { ok: 204, \"not-found\": 404, \"too-late\": 409 }[result];\n  res.status(status).end();\n});"}]},{"type":"codeBlock","attrs":{"language":"java","filename":"orders/cancelorder/CancelOrder.java"},"content":[{"type":"text","text":"package pl.pierogarnia.orders.cancelorder;\n\n// Everything about \"cancel an order\" lives in this package; nothing else imports it.\n@RestController\nclass CancelOrderController {\n    private final CancelOrderHandler handler;\n    CancelOrderController(CancelOrderHandler handler) { this.handler = handler; }\n\n    record CancelBody(@NotBlank @Size(max = 200) String reason) {}\n\n    @PostMapping(\"/orders/{id}/cancel\")\n    ResponseEntity<Void> cancel(@PathVariable UUID id, @Valid @RequestBody CancelBody body) {\n        return switch (handler.handle(id, body.reason())) {\n            case OK -> ResponseEntity.noContent().build();\n            case NOT_FOUND -> ResponseEntity.notFound().build();\n            case TOO_LATE -> ResponseEntity.status(HttpStatus.CONFLICT).build();\n        };\n    }\n}\n\n@Service\nclass CancelOrderHandler {\n    enum Outcome { OK, NOT_FOUND, TOO_LATE }\n\n    private final OrderRepository orders; // shared aggregate repository from pl.pierogarnia.shared\n    private final Clock clock;\n    CancelOrderHandler(OrderRepository orders, Clock clock) { this.orders = orders; this.clock = clock; }\n\n    @Transactional\n    Outcome handle(UUID id, String reason) {\n        return orders.findById(id)\n            .map(order -> order.cancel(reason, Instant.now(clock)) ? Outcome.OK : Outcome.TOO_LATE)\n            .orElse(Outcome.NOT_FOUND);\n    }\n}"}]},{"type":"codeBlock","attrs":{"language":"go","filename":"internal/orders/cancelorder/cancelorder.go"},"content":[{"type":"text","text":"// Package cancelorder contains the whole \"cancel an order\" feature.\npackage cancelorder\n\nimport (\n\t\"database/sql\"\n\t\"encoding/json\"\n\t\"net/http\"\n\t\"time\"\n)\n\ntype Handler struct{ DB *sql.DB }\n\ntype request struct {\n\tReason string `json:\"reason\"`\n}\n\nfunc (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n\tvar req request\n\tif err := json.NewDecoder(r.Body).Decode(&req); err != nil || req.Reason == \"\" || len(req.Reason) > 200 {\n\t\thttp.Error(w, \"reason is required (max 200 chars)\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tres, err := h.DB.ExecContext(r.Context(),\n\t\t`UPDATE orders SET status = 'CANCELLED', cancel_reason = $1, cancelled_at = $2\n\t\t WHERE id = $3 AND status = 'PLACED'`, // only before the kitchen starts cooking\n\t\treq.Reason, time.Now().UTC(), r.PathValue(\"id\"))\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tif n, _ := res.RowsAffected(); n == 0 {\n\t\thttp.Error(w, \"order not found or already in the kitchen\", http.StatusConflict)\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusNoContent)\n}\n\n// main.go: mux.Handle(\"POST /orders/{id}/cancel\", cancelorder.Handler{DB: db})"}]},{"type":"codeBlock","attrs":{"language":"python","filename":"pierogarnia/features/orders/cancel_order.py"},"content":[{"type":"text","text":"from datetime import datetime, timezone\n\nfrom fastapi import APIRouter, Depends, HTTPException\nfrom pydantic import BaseModel, Field\nfrom sqlalchemy import update\nfrom sqlalchemy.orm import Session\n\nfrom pierogarnia.platform.db import get_session\nfrom pierogarnia.domain.orders import Order, OrderStatus\n\n# Everything about \"cancel an order\" lives in this module.\nrouter = APIRouter()\n\n\nclass CancelBody(BaseModel):\n    reason: str = Field(min_length=1, max_length=200)\n\n\n@router.post(\"/orders/{order_id}/cancel\", status_code=204)\ndef cancel_order(order_id: str, body: CancelBody, session: Session = Depends(get_session)) -> None:\n    result = session.execute(\n        update(Order)\n        .where(Order.id == order_id, Order.status == OrderStatus.PLACED)  # only before cooking starts\n        .values(status=OrderStatus.CANCELLED, cancel_reason=body.reason,\n                cancelled_at=datetime.now(timezone.utc))\n    )\n    if result.rowcount == 0:\n        raise HTTPException(409, \"Order not found or the kitchen has already started cooking.\")\n    session.commit()"}]}]}]},"toc":[{"id":"context-and-forces","text":"Context and forces","level":2,"locked":false},{"id":"structure","text":"Structure","level":2,"locked":false},{"id":"what-it-looks-like-in-code","text":"What it looks like in code","level":2,"locked":false},{"id":"how-to-deal-with-duplication","text":"How to deal with duplication","level":2,"locked":true},{"id":"slices-cqrs-and-the-hexagon","text":"Slices, CQRS and the hexagon","level":2,"locked":true},{"id":"trade-offs","text":"Trade-offs","level":2,"locked":true},{"id":"migration-path-from-layers","text":"Migration path from layers","level":2,"locked":true},{"id":"in-practice","text":"In practice","level":2,"locked":true},{"id":"anti-patterns","text":"Anti-patterns","level":2,"locked":true},{"id":"related-topics","text":"Related topics","level":2,"locked":true},{"id":"test-yourself","text":"Test yourself","level":2,"locked":true}],"locked":true,"paywall":null,"previewRatio":0.3,"totalBlocks":37,"visibleBlocks":13,"resources":[{"id":"6b0857be3c96f2d34d0b41e0","type":"article","provider":"web","url":"https://www.jimmybogard.com/vertical-slice-architecture","embedUrl":null,"title":"Vertical Slice Architecture","description":"Many years back, we started on a new, long term project, and to start off with, we built the architecture around an onion architecture. Within a couple of months, the cracks started to show around this style and we moved away from that architecture and towards CQRS (before it had","author":"Jimmy Bogard","thumbnailUrl":null,"durationSec":null,"lang":"en","topics":["onion-architecture","vertical-slice-architecture","cqrs"],"techs":["dotnet"],"tags":["software-architecture"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":"2018-04-19T13:48:58.000Z","popularity":80,"verifiedAt":"2026-11-26T11:25:57.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:59.965Z","updatedAt":"2026-11-26T16:00:59.965Z"},{"id":"6b0857b63c96f2d34d0b3acb","type":"podcast","provider":"apple-podcasts","url":"https://podcasts.apple.com/us/podcast/vertical-slice-architecture-with-jeremy-miller/id130068596?i=1000757562115","embedUrl":"https://embed.podcasts.apple.com/us/podcast/id130068596?i=1000757562115","title":"Vertical Slice Architecture with Jeremy Miller","description":"How can vertical architecture help you? Carl and Richard talk to Jeremy Miller about using vertical architecture to help build applications quickly and reliably. Jeremy talks about resisting the over-thinking of architecture leaving room for developers to build the app and get to results rapidly…","author":".NET Rocks!","thumbnailUrl":"https://is1-ssl.mzstatic.com/image/thumb/Podcasts221/v4/99/ed/a9/99eda9e1-baa7-e71e-1267-093c7c6c5866/mza_11860025663734950417.jpg/600x600bb.jpg","durationSec":3249,"lang":"en","topics":["vertical-slice-architecture"],"techs":["dotnet"],"tags":["podcast","software-architecture"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"itunes","publishedAt":"2025-02-27T05:11:39.000Z","popularity":80,"verifiedAt":"2026-11-26T10:58:46.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:53.924Z","updatedAt":"2026-11-26T16:00:53.924Z"},{"id":"6b0857bf3c96f2d34d0b42dd","type":"article","provider":"web","url":"https://www.milanjovanovic.tech/blog/vertical-slice-architecture","embedUrl":null,"title":"Vertical Slice Architecture","description":"Layered architectures are the foundation of many software systems, but they organize the system around technical layers, and the cohesion between layers is low.","author":"Milan Jovanović","thumbnailUrl":"https://milanjovanovic.tech/blog-covers/mnw_062.png","durationSec":null,"lang":"en","topics":["vertical-slice-architecture"],"techs":["dotnet"],"tags":["software-architecture"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":"2023-11-04T00:00:00.000Z","popularity":60,"verifiedAt":"2026-11-26T11:26:40.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:01:02.417Z","updatedAt":"2026-11-26T16:01:02.417Z"},{"id":"6b0857b23c96f2d34d0b35cd","type":"repo","provider":"github","url":"https://github.com/jbogard/ContosoUniversityDotNetCore-Pages","embedUrl":null,"title":"jbogard/ContosoUniversityDotNetCore-Pages","description":"With Razor Pages","author":"jbogard","thumbnailUrl":"https://opengraph.githubassets.com/1/jbogard/ContosoUniversityDotNetCore-Pages","durationSec":null,"lang":"en","topics":["vertical-slice-architecture"],"techs":["dotnet"],"tags":["software-architecture"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"github","publishedAt":"2018-02-20T15:10:34.000Z","popularity":63,"verifiedAt":"2026-11-26T10:55:56.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:50.215Z","updatedAt":"2026-11-26T16:00:50.215Z"},{"id":"6b0857c23c96f2d34d0b44be","type":"article","provider":"web","url":"https://event-driven.io/en/my-thoughts-on-vertical-slices-cqrs","embedUrl":null,"title":"My thoughts on Vertical Slices, CQRS, Semantic Diffusion and other fancy words - Event-Driven.io","description":"Welcome to the new week! Vertical Slices in software architecture are pictured right now as the best thing since sliced bread. I won’t try to hide that, like it. I’ve…","author":"Oskar Dudycz (event-driven.io)","thumbnailUrl":"https://event-driven.io/_astro/2025-08-25-cover.BagJyB0P_2u0gCE.png","durationSec":null,"lang":"en","topics":["vertical-slice-architecture","cqrs","event-driven-architecture"],"techs":["general"],"tags":["event-sourcing","software-architecture"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":"2025-08-25T00:00:00.000Z","popularity":50,"verifiedAt":"2026-11-26T11:28:16.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:01:04.995Z","updatedAt":"2026-11-26T16:01:04.995Z"}],"challenges":[{"id":"6b093dc191bd8fbaf2a0c8d0","slug":"inventory-cqrs","title":"Inventory with CQRS – separate write and read models","summary":"Warehouse commands validated on their own write model, events on a bus and a projection building a read model with a low-stock report. The read model can be rebuilt from events alone.","servedLang":"en","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"},{"id":"6b093dc091bd8fbaf2a0c8c0","slug":"event-sourced-account","title":"Event-sourced bank account","summary":"An account aggregate whose state comes only from replaying events, an event store with optimistic concurrency and a repository that saves only new facts. Queries about past state come for free.","servedLang":"en","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"}],"attachments":[],"hasCode":true,"repoUrl":null,"series":[{"slug":"architecture-path","title":"From monolith to microservices","items":[{"slug":"monolith","title":"The Monolith: one application, one deployment, and why it is often the right start","current":false},{"slug":"modular-monolith","title":"The Modular Monolith: hard boundaries without the cost of the network","current":false},{"slug":"layered-architecture","title":"Layered architecture: presentation, logic, data – and where it breaks","current":false},{"slug":"hexagonal-architecture","title":"Pierogi in the Hexagon","current":false},{"slug":"clean-architecture","title":"Clean Architecture: the dependency rule and use cases at the centre","current":false},{"slug":"onion-architecture","title":"Onion architecture: the domain model in the middle, infrastructure outside","current":false},{"slug":"vertical-slice-architecture","title":"Vertical slice architecture: code by feature, not by layer","current":true},{"slug":"cqrs","title":"CQRS: one model for changing, another for reading","current":false},{"slug":"event-sourcing","title":"Event sourcing: store the facts, not just the latest state","current":false},{"slug":"event-driven-architecture","title":"Event-driven architecture: who publishes, who listens and what can go wrong","current":false},{"slug":"microservices","title":"Microservices: independent deployments, real costs and when it pays off","current":false},{"slug":"ddd-strategic-design","title":"DDD strategic design: subdomains, bounded contexts and context maps","current":false}]}],"prev":{"slug":"onion-architecture","title":"Onion architecture: the domain model in the middle, infrastructure outside"},"next":{"slug":"cqrs","title":"CQRS: one model for changing, another for reading"},"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":"Authority","articles":63},{"key":"dotnet","title":".NET","level":5,"levelLabel":"Authority","articles":53},{"key":"python","title":"Python","level":5,"levelLabel":"Authority","articles":52},{"key":"java","title":"Java","level":5,"levelLabel":"Authority","articles":38}]}}