{"id":"6b08bd3980884893657cc9a0","slug":"layered-architecture","title":"Layered architecture: presentation, logic, data – and where it breaks","summary":"The oldest and most popular way of structuring business applications: closed and open layers, layers versus tiers, code in C#, TypeScript, Java, Go and Python, ArchUnit and NetArchTest tests, and the road to the hexagon.","servedLang":"en","availableLangs":["pl","en"],"topics":["layered-architecture","hexagonal-architecture","clean-architecture"],"techs":["dotnet","java","typescript","go","python"],"tags":["architecture","layers","n-tier","archunit","netarchtest","import-linter"],"level":"beginner","kind":"article","access":"members","status":"published","cover":null,"author":{"id":"6b08bd2e80884893657cc8cf","name":"Redakcja Art of Devs","avatar":null,"handle":"redakcja","community":false},"readingMinutes":12,"stats":{"views":2,"likes":0,"bookmarks":0,"comments":0},"publishedAt":"2026-11-26T23:14:01.857Z","updatedAt":"2026-11-27T13:13:33.195Z","requestedLang":"en","theme":{"hero":"classic","heroMedia":null,"accent":"teal","background":"plain","weaveResources":true,"toc":"right"},"seoDescription":"Layered (n-tier) architecture: presentation, business logic and data access layers, closed and open layers, the sinkhole anti-pattern, layer tests with ArchUnit, NetArchTest and import-linter, examples in 5 languages.","wordCount":2242,"doc":{"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"The catering module at Halina's pierogi place – quotes for weddings and first communions – was built the way most courses teach: a controller takes the request, a service calculates the price, a repository reads the menu from the database. This is "},{"type":"text","text":"layered architecture","marks":[{"type":"bold"}]},{"type":"text","text":", the default layout of almost every project template. It is simple and readable, but it has one property that comes back like a boomerang after a few years: the business logic depends on the database."}]},{"type":"callout","attrs":{"variant":"tip","title":"In short"},"content":[{"type":"bulletList","content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"The code is divided into "},{"type":"text","text":"layers with different responsibilities","marks":[{"type":"bold"}]},{"type":"text","text":": presentation, business logic, data access; each knows only the layer below it."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"It's a great start for CRUD applications and for teams that need a simple, shared language of structure."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"The weakness: dependencies flow "},{"type":"text","text":"downwards, to the database","marks":[{"type":"bold"}]},{"type":"text","text":", so business rules are coupled to the storage technology."}]}]}]}]},{"type":"stats","attrs":{"items":[{"value":"1968","label":"layers in the THE system","hint":"Edsger Dijkstra describes a system built of levels"},{"value":"3","label":"classic layers","hint":"presentation, domain, data source (Fowler, 2002)"},{"value":"80/20","label":"the sinkhole rule","hint":"about 20% of requests may simply pass through the layers (Mark Richards)"}]}},{"type":"heading","attrs":{"level":2,"id":"context-and-forces"},"content":[{"type":"text","text":"Context and forces"}]},{"type":"paragraph","content":[{"type":"text","text":"Catering has a few rules (at least a week's notice, a discount from a hundred guests), but most of the work is ordinary forms: menu, dates, customer details. The team is mixed – juniors and two seniors – and needs a structure everyone understands from day one."}]},{"type":"bulletList","content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Separation of concerns","marks":[{"type":"bold"}]},{"type":"text","text":" – HTML and JSON shouldn't mix with SQL and pricing rules."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Predictability","marks":[{"type":"bold"}]},{"type":"text","text":" – everyone knows where to look for validation, where for rules and where for queries."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Replaceable layers","marks":[{"type":"bold"}]},{"type":"text","text":" – a new interface (a mobile app) shouldn't require changes in the logic."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Cost","marks":[{"type":"bold"}]},{"type":"text","text":" – the structure must not cost more than the problem it solves."}]}]}]},{"type":"heading","attrs":{"level":2,"id":"structure"},"content":[{"type":"text","text":"Structure"}]},{"type":"paragraph","content":[{"type":"text","text":"The layers pattern was described, among others, by Buschmann and co-authors in "},{"type":"text","text":"Pattern-Oriented Software Architecture","marks":[{"type":"italic"}]},{"type":"text","text":" (1996), and Martin Fowler's "},{"type":"text","text":"Patterns of Enterprise Application Architecture","marks":[{"type":"italic"}]},{"type":"text","text":" (2002) popularised three layers: presentation, domain and data source."}]},{"type":"diagram","attrs":{"kind":"mermaid","code":"flowchart TB\n  user[\"Client: browser, mobile app\"]\n  subgraph p[\"Presentation layer\"]\n    ctl[\"CateringController<br/>input validation, DTO mapping\"]\n  end\n  subgraph b[\"Business logic layer\"]\n    svc[\"CateringService<br/>rules: notice period, discount\"]\n  end\n  subgraph d[\"Data access layer\"]\n    repo[\"CateringRepository<br/>queries, ORM entities\"]\n  end\n  db[(\"Database\")]\n  user --> ctl --> svc --> repo --> db","caption":"Three layers: each depends only on the layer below"}},{"type":"table","content":[{"type":"tableRow","content":[{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Layer"}]}]},{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Responsibility"}]}]},{"type":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Should not"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Presentation"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Accepting the request, format validation, mapping to DTOs, HTTP status codes"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"calculate prices or write SQL"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Business logic"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Rules, use cases, transactions"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"know "},{"type":"text","text":"HttpContext","marks":[{"type":"code"}]},{"type":"text","text":", "},{"type":"text","text":"req","marks":[{"type":"code"}]},{"type":"text","text":", "},{"type":"text","text":"res","marks":[{"type":"code"}]}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Data access"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Queries, object-relational mapping, caching"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"make business decisions"}]}]}]}]},{"type":"paragraph","content":[{"type":"text","text":"Layers versus tiers.","marks":[{"type":"bold"}]},{"type":"text","text":" A layer is a logical division in the code, a tier is a physical one: a separate process or machine. Three layers can run in a single process, while a three-tier application from the 1990s is a browser, an application server and a database server."}]},{"type":"paragraph","content":[{"type":"text","text":"Closed and open layers.","marks":[{"type":"bold"}]},{"type":"text","text":" In a closed layout, a request passes through every layer in turn. In an open one, selected layers can be skipped – for example, a simple read goes from the controller straight to the repository. Openness speeds up writing but blurs the boundaries, so it's worth limiting it to specific, named cases."}]},{"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":"Layer layout in five stacks"},"content":[{"type":"codeBlock","attrs":{"language":"plaintext","filename":"dotnet/solution-tree.txt"},"content":[{"type":"text","text":"Pierogarnia.Catering.sln\n├── Catering.Web/            ← PRESENTATION: controllers, view models, validation of input\n├── Catering.Business/       ← BUSINESS: CateringService, pricing rules, DTOs\n├── Catering.Data/           ← DATA ACCESS: EF Core DbContext, repositories, entities\n└── references: Web → Business → Data   (each layer knows only the one below)"}]},{"type":"codeBlock","attrs":{"language":"plaintext","filename":"java/package-tree.txt"},"content":[{"type":"text","text":"pl.pierogarnia.catering\n├── web/            ← @RestController, request/response records\n├── service/        ← @Service, @Transactional, business rules\n├── repository/     ← Spring Data JPA interfaces\n└── entity/         ← @Entity classes (often shared by service and repository)"}]},{"type":"codeBlock","attrs":{"language":"plaintext","filename":"node/src-tree.txt"},"content":[{"type":"text","text":"src/\n├── controllers/    ← Express routers or NestJS @Controller\n├── services/       ← business rules, no req/res objects here\n├── repositories/   ← Prisma / TypeORM / Knex queries\n└── app.ts"}]},{"type":"codeBlock","attrs":{"language":"plaintext","filename":"go/module-tree.txt"},"content":[{"type":"text","text":"catering/\n├── cmd/catering/main.go\n└── internal/\n    ├── handler/    ← net/http handlers: decode JSON, call service, encode JSON\n    ├── service/    ← business rules\n    └── repository/ ← database/sql or sqlc queries"}]},{"type":"codeBlock","attrs":{"language":"plaintext","filename":"python/package-tree.txt"},"content":[{"type":"text","text":"catering/\n├── api/            ← FastAPI routers (presentation)\n├── services/       ← business rules\n├── repositories/   ← SQLAlchemy queries\n└── models.py       ← ORM models"}]}]},{"type":"paragraph","content":[{"type":"text","text":"The same use case – a wedding quote – passes through three layers. Notice where the discount rule lives and what the service depends on:"}]},{"type":"codeGroup","attrs":{"title":"A wedding quote through three layers"},"content":[{"type":"codeBlock","attrs":{"language":"csharp","filename":"Catering.cs"},"content":[{"type":"text","text":"// PRESENTATION – Catering.Web\n[ApiController, Route(\"api/catering\")]\npublic sealed class CateringController(CateringService service) : ControllerBase\n{\n    [HttpPost(\"quotes\")]\n    public async Task<ActionResult<QuoteDto>> Quote(QuoteRequest req, CancellationToken ct) =>\n        Ok(await service.Quote(req.Guests, req.EventDate, ct));\n}\n\n// BUSINESS – Catering.Business\npublic sealed class CateringService(ICateringRepository repo, TimeProvider clock)\n{\n    public async Task<QuoteDto> Quote(int guests, DateOnly date, CancellationToken ct)\n    {\n        if (date < DateOnly.FromDateTime(clock.GetLocalNow().DateTime.AddDays(7)))\n            throw new BusinessRuleException(\"Weddings need a week's notice.\");\n\n        var menu = await repo.GetWeddingMenu(ct);\n        var perGuest = menu.Sum(i => i.PiecesPerGuest * i.UnitPrice);\n        var discount = guests >= 100 ? 0.10m : 0m;                 // the business rule lives here\n        return new QuoteDto(guests, Math.Round(guests * perGuest * (1 - discount), 2));\n    }\n}\n\n// DATA ACCESS – Catering.Data (the interface is here too: Business references Data)\npublic interface ICateringRepository { Task<IReadOnlyList<MenuItem>> GetWeddingMenu(CancellationToken ct); }\n\npublic sealed class CateringRepository(CateringDb db) : ICateringRepository\n{\n    public async Task<IReadOnlyList<MenuItem>> GetWeddingMenu(CancellationToken ct) =>\n        await db.MenuItems.Where(m => m.Wedding).ToListAsync(ct);\n}"}]},{"type":"codeBlock","attrs":{"language":"typescript","filename":"catering.ts"},"content":[{"type":"text","text":"// PRESENTATION – controllers/catering.controller.ts\nrouter.post(\"/api/catering/quotes\", async (req, res, next) => {\n  try {\n    const { guests, eventDate } = req.body as { guests: number; eventDate: string };\n    res.json(await cateringService.quote(guests, new Date(eventDate)));\n  } catch (err) {\n    next(err); // error middleware turns BusinessRuleError into 422\n  }\n});\n\n// BUSINESS – services/catering.service.ts\nexport const cateringService = {\n  async quote(guests: number, eventDate: Date): Promise<Quote> {\n    const weekAhead = Date.now() + 7 * 24 * 3600 * 1000;\n    if (eventDate.getTime() < weekAhead) throw new BusinessRuleError(\"Weddings need a week's notice.\");\n\n    const menu = await cateringRepository.weddingMenu();\n    const perGuest = menu.reduce((sum, i) => sum + i.piecesPerGuest * i.unitPrice, 0);\n    const discount = guests >= 100 ? 0.1 : 0; // the business rule lives here\n    return { guests, total: Math.round(guests * perGuest * (1 - discount) * 100) / 100 };\n  },\n};\n\n// DATA ACCESS – repositories/catering.repository.ts\nexport const cateringRepository = {\n  weddingMenu: () => prisma.menuItem.findMany({ where: { wedding: true } }),\n};"}]},{"type":"codeBlock","attrs":{"language":"java","filename":"Catering.java"},"content":[{"type":"text","text":"// PRESENTATION – web/CateringController.java\n@RestController\n@RequestMapping(\"/api/catering\")\nclass CateringController {\n    private final CateringService service;\n    CateringController(CateringService service) { this.service = service; }\n\n    @PostMapping(\"/quotes\")\n    QuoteDto quote(@RequestBody QuoteRequest req) { return service.quote(req.guests(), req.eventDate()); }\n}\n\n// BUSINESS – service/CateringService.java\n@Service\nclass CateringService {\n    private final MenuItemRepository repo;\n    private final Clock clock;\n    CateringService(MenuItemRepository repo, Clock clock) { this.repo = repo; this.clock = clock; }\n\n    QuoteDto quote(int guests, LocalDate date) {\n        if (date.isBefore(LocalDate.now(clock).plusDays(7)))\n            throw new BusinessRuleException(\"Weddings need a week's notice.\");\n\n        var perGuest = repo.findByWeddingTrue().stream()\n            .map(i -> i.getUnitPrice().multiply(BigDecimal.valueOf(i.getPiecesPerGuest())))\n            .reduce(BigDecimal.ZERO, BigDecimal::add);\n        var discount = guests >= 100 ? new BigDecimal(\"0.90\") : BigDecimal.ONE; // the business rule\n        return new QuoteDto(guests, perGuest.multiply(BigDecimal.valueOf(guests)).multiply(discount));\n    }\n}\n\n// DATA ACCESS – repository/MenuItemRepository.java\ninterface MenuItemRepository extends JpaRepository<MenuItem, Long> {\n    List<MenuItem> findByWeddingTrue();\n}"}]},{"type":"codeBlock","attrs":{"language":"go","filename":"catering.go"},"content":[{"type":"text","text":"// PRESENTATION – internal/handler/catering.go\nfunc (h CateringHandler) Quote(w http.ResponseWriter, r *http.Request) {\n\tvar req struct {\n\t\tGuests    int       `json:\"guests\"`\n\t\tEventDate time.Time `json:\"eventDate\"`\n\t}\n\tif err := json.NewDecoder(r.Body).Decode(&req); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadRequest)\n\t\treturn\n\t}\n\tq, err := h.Service.Quote(r.Context(), req.Guests, req.EventDate)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusUnprocessableEntity)\n\t\treturn\n\t}\n\tjson.NewEncoder(w).Encode(q)\n}\n\n// BUSINESS – internal/service/catering.go\nfunc (s CateringService) Quote(ctx context.Context, guests int, date time.Time) (Quote, error) {\n\tif date.Before(s.Now().AddDate(0, 0, 7)) {\n\t\treturn Quote{}, errors.New(\"weddings need a week's notice\")\n\t}\n\tmenu, err := s.Repo.WeddingMenu(ctx) // *repository.CateringRepository: business imports data access\n\tif err != nil {\n\t\treturn Quote{}, err\n\t}\n\tperGuest := 0.0\n\tfor _, i := range menu {\n\t\tperGuest += float64(i.PiecesPerGuest) * i.UnitPrice\n\t}\n\tdiscount := 0.0\n\tif guests >= 100 {\n\t\tdiscount = 0.10 // the business rule lives here\n\t}\n\treturn Quote{Guests: guests, Total: float64(guests) * perGuest * (1 - discount)}, nil\n}"}]},{"type":"codeBlock","attrs":{"language":"python","filename":"catering.py"},"content":[{"type":"text","text":"# PRESENTATION – catering/api/quotes.py\n@router.post(\"/api/catering/quotes\")\ndef quote(req: QuoteRequest, service: CateringService = Depends(get_catering_service)) -> QuoteDto:\n    try:\n        return service.quote(req.guests, req.event_date)\n    except BusinessRuleError as e:\n        raise HTTPException(status_code=422, detail=str(e))\n\n\n# BUSINESS – catering/services/catering.py\nclass CateringService:\n    def __init__(self, repo: CateringRepository, today=date.today):\n        self.repo, self.today = repo, today\n\n    def quote(self, guests: int, event_date: date) -> QuoteDto:\n        if event_date < self.today() + timedelta(days=7):\n            raise BusinessRuleError(\"Weddings need a week's notice.\")\n        per_guest = sum(i.pieces_per_guest * i.unit_price for i in self.repo.wedding_menu())\n        discount = Decimal(\"0.10\") if guests >= 100 else Decimal(\"0\")  # the business rule\n        return QuoteDto(guests=guests, total=round(guests * per_guest * (1 - discount), 2))\n\n\n# DATA ACCESS – catering/repositories/catering.py\nclass CateringRepository:\n    def __init__(self, session: Session):\n        self.session = session\n\n    def wedding_menu(self) -> list[MenuItem]:\n        return list(self.session.scalars(select(MenuItem).where(MenuItem.wedding.is_(True))))"}]}]}]},"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":"where-it-breaks","text":"Where it breaks","level":2,"locked":true},{"id":"trade-offs","text":"Trade-offs","level":2,"locked":true},{"id":"evolution-paths","text":"Evolution paths","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":40,"visibleBlocks":16,"resources":[{"id":"6b0857be3c96f2d34d0b4230","type":"article","provider":"web","url":"https://learn.microsoft.com/en-us/dotnet/architecture/modern-web-apps-azure/common-web-application-architectures","embedUrl":null,"title":"Common web application architectures - .NET","description":"Architect Modern Web Applications with ASP.NET Core and Azure | Explore the common web application architectures","author":"Microsoft Learn","thumbnailUrl":"https://learn.microsoft.com/dotnet/media/dotnet-bot_microservices.png","durationSec":null,"lang":"en","topics":["monolith","layered-architecture","clean-architecture"],"techs":["dotnet"],"tags":["cloud","software-architecture"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":null,"popularity":70,"verifiedAt":"2026-11-26T11:25:50.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:59.965Z","updatedAt":"2026-11-26T16:00:59.965Z"},{"id":"6b0857bf3c96f2d34d0b425a","type":"article","provider":"web","url":"https://learn.microsoft.com/en-us/azure/architecture/guide/architecture-styles/n-tier","embedUrl":null,"title":"N-tier Architecture Style","description":"Learn about the benefits, challenges, and best practices for N-tier architectures on Azure, which separates an app into logical layers and physical tiers.","author":"Microsoft Azure Architecture Center","thumbnailUrl":"https://learn.microsoft.com/en-us/media/open-graph-image.png","durationSec":null,"lang":"en","topics":["layered-architecture"],"techs":["general"],"tags":["azure","cloud","software-architecture"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":null,"popularity":66,"verifiedAt":"2026-11-26T11:07:38.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:01:02.417Z","updatedAt":"2026-11-26T16:01:02.417Z"},{"id":"6b0857b73c96f2d34d0b3c05","type":"podcast","provider":"apple-podcasts","url":"https://podcasts.apple.com/us/podcast/software-architecture-fundamentals-2nd-edition-chapter/id1752902467?i=1000756075694","embedUrl":"https://embed.podcasts.apple.com/us/podcast/id1752902467?i=1000756075694","title":"Software Architecture Fundamentals 2nd Edition, Chapter 10: Layered Architectures","description":"This is the first of many chapters that each do a deep-dive on a particular architecture style; in this chapter, we start with the layered monolithic architecture, also known by many as the default architecture. We describe the topology, communication, data strategies, and philosophy underlying…","author":"Software Architecture Book Club","thumbnailUrl":"https://is1-ssl.mzstatic.com/image/thumb/Podcasts211/v4/05/4c/68/054c68d1-a78e-511c-81f2-225567e7e32f/mza_4756898323908452544.jpg/600x600bb.jpg","durationSec":3551,"lang":"en","topics":["layered-architecture"],"techs":["general"],"tags":["podcast","software-architecture"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"itunes","publishedAt":"2026-03-19T04:00:00.000Z","popularity":68,"verifiedAt":"2026-11-26T10:58:17.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:53.924Z","updatedAt":"2026-11-26T16:00:53.924Z"},{"id":"6b0857ab3c96f2d34d0b3275","type":"package","provider":"maven","url":"https://central.sonatype.com/artifact/com.tngtech.archunit/archunit","embedUrl":null,"title":"com.tngtech.archunit:archunit","description":"Java architecture test library: assert layers, cycles and dependencies in plain Java.","author":"","thumbnailUrl":null,"durationSec":null,"lang":"en","topics":["clean-architecture","hexagonal-architecture","layered-architecture","modular-monolith"],"techs":["java"],"tags":["architecture-tests"],"price":"free","featured":false,"featuredOrder":36,"packageName":"com.tngtech.archunit:archunit","source":"seed","publishedAt":null,"popularity":0,"verifiedAt":"2026-11-26T00:00:00.000Z","curated":true,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:43.468Z","updatedAt":"2026-11-26T16:00:43.468Z"},{"id":"6b0857ab3c96f2d34d0b3273","type":"package","provider":"pypi","url":"https://pypi.org/project/import-linter/","embedUrl":null,"title":"import-linter","description":"Lint your Python architecture: contracts for layers and independent modules.","author":"","thumbnailUrl":null,"durationSec":null,"lang":"en","topics":["layered-architecture","modular-monolith","clean-architecture"],"techs":["python"],"tags":["architecture-tests"],"price":"free","featured":false,"featuredOrder":34,"packageName":"import-linter","source":"seed","publishedAt":null,"popularity":0,"verifiedAt":"2026-11-26T00:00:00.000Z","curated":true,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:43.387Z","updatedAt":"2026-11-26T16:00:43.387Z"},{"id":"6b0857c03c96f2d34d0b43f1","type":"article","provider":"web","url":"https://threedots.tech/post/database-transactions-in-go","embedUrl":null,"title":"Database Transactions in Go with Layered Architecture","description":"As I join a new company, I often feel like an impostor. After all the interviews, they really seem to know what they’re doing. I’m humbled and ready to learn from the best. On one such occasion, a few days in, I dealt with a production outage and asked the most senior engineer for help. They came…","author":"Three Dots Labs","thumbnailUrl":"https://threedots.tech/images/covers/database-transactions-in-go-social.png","durationSec":null,"lang":"en","topics":["layered-architecture"],"techs":["go"],"tags":["software-architecture","databases"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":"2024-09-04T22:00:00.000Z","popularity":50,"verifiedAt":"2026-11-26T11:28:48.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:01:02.417Z","updatedAt":"2026-11-26T16:01:02.417Z"}],"challenges":[],"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":true},{"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":false},{"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":"modular-monolith","title":"The Modular Monolith: hard boundaries without the cost of the network"},"next":{"slug":"hexagonal-architecture","title":"Pierogi in the Hexagon"},"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}]}}