{"id":"6b08bd3b80884893657cc9d2","slug":"monolith","title":"The Monolith: one application, one deployment, and why it is often the right start","summary":"What a monolith really is, when it is the best choice, how it turns into a big ball of mud and how to get out of it without a revolution. Structure in .NET, Java, Node.js, Go and Python.","servedLang":"en","availableLangs":["pl","en"],"topics":["monolith","modular-monolith","microservices"],"techs":["dotnet","typescript","java","go","python"],"tags":["architecture","monolith","strangler-fig","transactions","migration"],"level":"beginner","kind":"article","access":"public","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:03.634Z","updatedAt":"2026-11-27T13:07:59.722Z","requestedLang":"en","theme":{"hero":"classic","heroMedia":null,"accent":"teal","background":"dots","weaveResources":true,"toc":"right"},"seoDescription":"Monolithic architecture: definition, kinds (single-process, modular, distributed), pros and cons, code in C#, TypeScript, Java, Go and Python, migration paths and the Shopify, Segment and Prime Video stories.","wordCount":2143,"doc":{"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"The first version of the ordering system for Halina's pierogi place was built in six weeks: one project, one database, one deployment on a Friday afternoon. It was a "},{"type":"text","text":"monolith","marks":[{"type":"bold"}]},{"type":"text","text":", and it was a good choice. This article opens the \"From monolith to microservices\" path and explains why a monolith is not an insult but a starting point you need to keep in shape."}]},{"type":"callout","attrs":{"variant":"tip","title":"In short"},"content":[{"type":"bulletList","content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"A monolith is "},{"type":"text","text":"a single deployment unit","marks":[{"type":"bold"}]},{"type":"text","text":": the whole system is built, tested and released together, usually with one database."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Its biggest strengths are "},{"type":"text","text":"operational simplicity","marks":[{"type":"bold"}]},{"type":"text","text":" and "},{"type":"text","text":"ACID transactions","marks":[{"type":"bold"}]},{"type":"text","text":" spanning the entire business process."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"The problem is not the monolith but the "},{"type":"text","text":"monolith without boundaries","marks":[{"type":"bold"}]},{"type":"text","text":" – after a few years, every change touches everything."}]}]}]}]},{"type":"stats","attrs":{"items":[{"value":"1","label":"deployment unit","hint":"one artifact, one pipeline, one log"},{"value":"2.8M","label":"lines of Ruby in Shopify's monolith","hint":"company figures from 2019"},{"value":"90%","label":"lower cost of a Prime Video service","hint":"after moving back from microservices to a monolith (2023)"}]}},{"type":"heading","attrs":{"level":2,"id":"context-and-forces"},"content":[{"type":"text","text":"Context and forces"}]},{"type":"paragraph","content":[{"type":"text","text":"Halina wants to take orders through a website. The team is three people, the budget is modest and little is known about the domain: it isn't clear whether deliveries, wedding catering or a loyalty programme will turn out to matter most. In such a situation, these forces are at play:"}]},{"type":"bulletList","content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Speed of delivery","marks":[{"type":"bold"}]},{"type":"text","text":" – the idea has to be tested on the market before the money runs out."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"An uncertain model","marks":[{"type":"bold"}]},{"type":"text","text":" – the boundaries between \"order\", \"menu\" and \"customer\" will keep shifting."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"A small team","marks":[{"type":"bold"}]},{"type":"text","text":" – there is nobody dedicated to Kubernetes, queues and distributed tracing."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Data consistency","marks":[{"type":"bold"}]},{"type":"text","text":" – the order, the stock level and the loyalty points must agree to the last penny."}]}]}]},{"type":"paragraph","content":[{"type":"text","text":"A monolith answers all four: one codebase where refactoring is a \"Rename\" in the IDE, one deployment and one database transaction."}]},{"type":"heading","attrs":{"level":2,"id":"structure-what-exactly-is-one"},"content":[{"type":"text","text":"Structure: what exactly is \"one\""}]},{"type":"paragraph","content":[{"type":"text","text":"In "},{"type":"text","text":"Monolith to Microservices","marks":[{"type":"italic"}]},{"type":"text","text":" (2019), Sam Newman distinguishes three kinds of monolith: the "},{"type":"text","text":"single-process","marks":[{"type":"bold"}]},{"type":"text","text":" monolith (the classic one), the "},{"type":"text","text":"modular","marks":[{"type":"bold"}]},{"type":"text","text":" monolith (one process, but clear modules) and the "},{"type":"text","text":"distributed","marks":[{"type":"bold"}]},{"type":"text","text":" monolith (many services that still have to be deployed together). The common denominator: the system is deployed as a whole."}]},{"type":"diagram","attrs":{"kind":"mermaid","code":"flowchart TB\n  customer[\"Customer<br/>(browser, app)\"]\n  staff[\"Halina and staff<br/>(admin panel)\"]\n  subgraph app[\"Pierogarnia.Web – a single deployment unit\"]\n    direction LR\n    ui[\"UI and API\"]\n    orders[\"Orders\"]\n    menu[\"Menu and stock\"]\n    loyalty[\"Loyalty programme\"]\n    ui --> orders & menu & loyalty\n    orders --> menu\n    orders --> loyalty\n  end\n  db[(\"One database<br/>SQL\")]\n  pay[\"Payment gateway\"]\n  sms[\"SMS gateway\"]\n  customer --> ui\n  staff --> ui\n  orders & menu & loyalty --> db\n  orders --> pay\n  orders --> sms","caption":"Container view (C4 style): the pierogi place monolith"}},{"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":"tableHeader","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Typical form"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Deployment unit"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Everything that goes to production at once"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"one "},{"type":"text","text":".jar","marks":[{"type":"code"}]},{"type":"text","text":" file, a Docker image, a "},{"type":"text","text":"publish/","marks":[{"type":"code"}]},{"type":"text","text":" folder"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Logical modules"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Orders, menu, loyalty – often just folders"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"packages, namespaces, Django apps"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Shared database"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"One source of truth, transactions across modules"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"PostgreSQL, SQL Server, MySQL"}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Integrations"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"Payments, SMS, email"}]}]},{"type":"tableCell","attrs":{"colspan":1,"rowspan":1},"content":[{"type":"paragraph","content":[{"type":"text","text":"HTTP clients called from the code"}]}]}]}]},{"type":"heading","attrs":{"level":2,"id":"what-it-looks-like-in-code"},"content":[{"type":"text","text":"What it looks like in code"}]},{"type":"paragraph","content":[{"type":"text","text":"Whatever the tech stack, a monolith has a similar shape: one entry point, one database configuration and modules that call each other directly."}]},{"type":"codeGroup","attrs":{"title":"One app, one deployment"},"content":[{"type":"codeBlock","attrs":{"language":"plaintext","filename":"dotnet/Pierogarnia.sln.txt"},"content":[{"type":"text","text":"Pierogarnia/\n├── Pierogarnia.Web/              ← ONE deployable: ASP.NET Core\n│   ├── Controllers/              ← Orders, Menu, Loyalty, Admin\n│   ├── Services/                 ← OrderService, LoyaltyService, StockService\n│   ├── Data/PierogarniaDb.cs     ← ONE DbContext, ONE database\n│   ├── Views/ + wwwroot/         ← server-rendered UI\n│   └── Program.cs\n└── Pierogarnia.Tests/"}]},{"type":"codeBlock","attrs":{"language":"plaintext","filename":"java/pierogarnia-tree.txt"},"content":[{"type":"text","text":"pierogarnia/                      ← ONE Spring Boot jar\n└── src/main/java/pl/pierogarnia/\n    ├── PierogarniaApplication.java\n    ├── web/                      ← @RestController classes\n    ├── service/                  ← OrderService, LoyaltyService, StockService\n    ├── repository/               ← Spring Data JPA, ONE DataSource\n    └── model/                    ← @Entity classes shared by everything"}]},{"type":"codeBlock","attrs":{"language":"plaintext","filename":"node/pierogarnia-tree.txt"},"content":[{"type":"text","text":"pierogarnia/                      ← ONE Node.js process (Express or NestJS)\n├── src/\n│   ├── routes/                   ← orders.ts, menu.ts, loyalty.ts\n│   ├── services/                 ← orderService.ts, stockService.ts\n│   ├── db/                       ← ONE Prisma/Knex client, ONE schema\n│   └── server.ts\n└── package.json"}]},{"type":"codeBlock","attrs":{"language":"plaintext","filename":"go/pierogarnia-tree.txt"},"content":[{"type":"text","text":"pierogarnia/                      ← ONE binary\n├── cmd/server/main.go\n├── internal/\n│   ├── http/                     ← handlers for orders, menu, loyalty\n│   ├── service/                  ← business logic\n│   └── store/                    ← ONE *sql.DB\n└── go.mod"}]},{"type":"codeBlock","attrs":{"language":"plaintext","filename":"python/pierogarnia-tree.txt"},"content":[{"type":"text","text":"pierogarnia/                      ← ONE Django project\n├── manage.py\n├── pierogarnia/settings.py       ← ONE DATABASES[\"default\"]\n├── orders/                       ← Django app: models, views\n├── menu/\n└── loyalty/                      ← apps import each other's models freely"}]}]},{"type":"paragraph","content":[{"type":"text","text":"The monolith's biggest advantage shows in a use case that touches several areas at once. Placing an order saves the order, takes the pierogi off the stock and adds loyalty points – in "},{"type":"text","text":"one transaction","marks":[{"type":"bold"}]},{"type":"text","text":". If the dough runs out, everything is rolled back:"}]},{"type":"codeGroup","attrs":{"title":"Order, stock and points in one transaction"},"content":[{"type":"codeBlock","attrs":{"language":"csharp","filename":"OrderService.cs"},"content":[{"type":"text","text":"public sealed class OrderService(PierogarniaDb db)\n{\n    public async Task<Guid> PlaceOrder(PlaceOrderRequest req, CancellationToken ct)\n    {\n        // One process, one database, one ACID transaction: the monolith's superpower.\n        await using var tx = await db.Database.BeginTransactionAsync(ct);\n\n        var order = new Order(req.CustomerId, req.Lines);\n        db.Orders.Add(order);\n\n        foreach (var line in req.Lines)\n        {\n            var stock = await db.Stock.SingleAsync(s => s.Dumpling == line.Dumpling, ct);\n            stock.Take(line.Quantity);              // throws when Halina runs out of dough\n        }\n\n        var customer = await db.Customers.FindAsync([req.CustomerId], ct);\n        customer!.AddLoyaltyPoints(order.Total);    // a plain method call, no network\n\n        await db.SaveChangesAsync(ct);\n        await tx.CommitAsync(ct);                   // all three changes or none\n        return order.Id;\n    }\n}"}]},{"type":"codeBlock","attrs":{"language":"typescript","filename":"orderService.ts"},"content":[{"type":"text","text":"import { PrismaClient } from \"@prisma/client\";\n\nconst prisma = new PrismaClient();\n\nexport async function placeOrder(req: PlaceOrderRequest): Promise<string> {\n  // One process, one database, one ACID transaction: the monolith's superpower.\n  return prisma.$transaction(async (tx) => {\n    const total = req.lines.reduce((sum, l) => sum + l.quantity * l.unitPrice, 0);\n    const order = await tx.order.create({\n      data: { customerId: req.customerId, total, lines: { create: req.lines } },\n    });\n\n    for (const line of req.lines) {\n      const stock = await tx.stock.update({\n        where: { dumpling: line.dumpling },\n        data: { pieces: { decrement: line.quantity } },\n      });\n      if (stock.pieces < 0) throw new Error(\"Halina ran out of dough\"); // rolls everything back\n    }\n\n    // A plain function call, no network, no eventual consistency.\n    await tx.customer.update({\n      where: { id: req.customerId },\n      data: { loyaltyPoints: { increment: Math.floor(total) } },\n    });\n    return order.id;\n  });\n}"}]},{"type":"codeBlock","attrs":{"language":"java","filename":"OrderService.java"},"content":[{"type":"text","text":"@Service\npublic class OrderService {\n    private final OrderRepository orders;\n    private final StockRepository stock;\n    private final CustomerRepository customers;\n\n    public OrderService(OrderRepository orders, StockRepository stock, CustomerRepository customers) {\n        this.orders = orders;\n        this.stock = stock;\n        this.customers = customers;\n    }\n\n    // One process, one database, one ACID transaction: the monolith's superpower.\n    @Transactional\n    public UUID placeOrder(PlaceOrderRequest req) {\n        var order = orders.save(new Order(req.customerId(), req.lines()));\n\n        for (var line : req.lines()) {\n            stock.findByDumpling(line.dumpling())\n                 .orElseThrow()\n                 .take(line.quantity());          // throws -> the whole transaction rolls back\n        }\n\n        customers.findById(req.customerId())\n                 .orElseThrow()\n                 .addLoyaltyPoints(order.total()); // a plain method call, no network\n        return order.id();\n    }\n}"}]},{"type":"codeBlock","attrs":{"language":"go","filename":"order_service.go"},"content":[{"type":"text","text":"package service\n\nimport (\n\t\"context\"\n\t\"database/sql\"\n\t\"errors\"\n)\n\ntype OrderService struct{ DB *sql.DB }\n\n// PlaceOrder: one process, one database, one ACID transaction.\nfunc (s OrderService) PlaceOrder(ctx context.Context, req PlaceOrderRequest) (string, error) {\n\ttx, err := s.DB.BeginTx(ctx, nil)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer tx.Rollback() // no-op after Commit\n\n\tvar orderID string\n\terr = tx.QueryRowContext(ctx,\n\t\t`INSERT INTO orders (customer_id, total) VALUES ($1, $2) RETURNING id`,\n\t\treq.CustomerID, req.Total()).Scan(&orderID)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tfor _, l := range req.Lines {\n\t\tres, err := tx.ExecContext(ctx,\n\t\t\t`UPDATE stock SET pieces = pieces - $1 WHERE dumpling = $2 AND pieces >= $1`,\n\t\t\tl.Quantity, l.Dumpling)\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tif n, _ := res.RowsAffected(); n == 0 {\n\t\t\treturn \"\", errors.New(\"halina ran out of dough\") // deferred Rollback undoes the order\n\t\t}\n\t}\n\n\tif _, err = tx.ExecContext(ctx,\n\t\t`UPDATE customers SET loyalty_points = loyalty_points + $1 WHERE id = $2`,\n\t\tint(req.Total()), req.CustomerID); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn orderID, tx.Commit()\n}"}]},{"type":"codeBlock","attrs":{"language":"python","filename":"orders/services.py"},"content":[{"type":"text","text":"from django.db import transaction\nfrom django.db.models import F\n\nfrom loyalty.models import Customer\nfrom menu.models import Stock\nfrom orders.models import Order\n\n\nclass OutOfDough(Exception):\n    pass\n\n\n@transaction.atomic  # one process, one database, one ACID transaction\ndef place_order(customer_id: int, lines: list[dict]) -> int:\n    order = Order.objects.create(customer_id=customer_id)\n    for line in lines:\n        order.lines.create(dumpling=line[\"dumpling\"], quantity=line[\"quantity\"])\n        updated = Stock.objects.filter(\n            dumpling=line[\"dumpling\"], pieces__gte=line[\"quantity\"]\n        ).update(pieces=F(\"pieces\") - line[\"quantity\"])\n        if updated == 0:\n            raise OutOfDough(line[\"dumpling\"])  # rolls back the order as well\n\n    # A plain function call into another \"module\": no network, no retries.\n    Customer.objects.filter(pk=customer_id).update(\n        loyalty_points=F(\"loyalty_points\") + int(order.total())\n    )\n    return order.pk"}]}]},{"type":"paragraph","content":[{"type":"text","text":"In microservices, the same scenario requires a saga, compensations and idempotent consumers. Here it's a dozen lines and a "},{"type":"text","text":"COMMIT","marks":[{"type":"code"}]},{"type":"text","text":"."}]},{"type":"diagram","attrs":{"kind":"mermaid","code":"sequenceDiagram\n  autonumber\n  participant K as Customer\n  participant C as OrdersController\n  participant O as OrderService\n  participant S as StockService\n  participant L as LoyaltyService\n  participant DB as Database\n  K->>C: POST /orders\n  C->>O: PlaceOrder(...)\n  O->>DB: BEGIN\n  O->>DB: INSERT order\n  O->>S: Take(ruskie, 20)\n  S->>DB: UPDATE stock\n  O->>L: AddPoints(85)\n  L->>DB: UPDATE customer\n  O->>DB: COMMIT\n  C-->>K: 201 Created","caption":"One request, one process, one transaction"}},{"type":"heading","attrs":{"level":2,"id":"trade-offs"},"content":[{"type":"text","text":"Trade-offs"}]},{"type":"prosCons","attrs":{"pros":["one deployment, one log, one debugger – a low barrier to entry","ACID transactions spanning the entire business process","refactoring in the IDE instead of negotiating contracts between teams","in-memory calls instead of the network: no latency and no partial failures","simple local start: dotnet run, mvn spring-boot:run, npm start"],"cons":["you scale the whole thing, even when only one area is under load","a single failure (e.g. a memory leak) takes down the entire system","long builds and test runs once the code grows without boundaries","everyone deploys together: teams wait for each other","one tech stack for all modules"],"prosTitle":"Pros","consTitle":"Cons"}},{"type":"paragraph","content":[{"type":"text","text":"In 1997, Brian Foote and Joseph Yoder described the \"Big Ball of Mud\": a system in which nobody knows any more what depends on what. That is not a property of the monolith but of missing boundaries – a distributed ball of mud is even worse, because the network is added to the tangle."}]},{"type":"callout","attrs":{"variant":"warning","title":"A common mistake"},"content":[{"type":"paragraph","content":[{"type":"text","text":"Using the shared database as an integration point for "},{"type":"text","text":"other","marks":[{"type":"bold"}]},{"type":"text","text":" applications. When reports, the CRM and the data warehouse read the monolith's tables directly, every schema change needs the approval of five teams. Expose data through an API or events, and keep the schema as an implementation detail."}]}]},{"type":"chart","attrs":{"type":"line","title":"The design stamina hypothesis: cost of a new feature over time","caption":"An illustration of Martin Fowler's Design Stamina Hypothesis, made-up values – not a measurement from a project.","unit":"days","data":{"labels":["month 1","month 6","year 1","year 2","year 3","year 4"],"series":[{"name":"Monolith without boundaries","values":[2,3,5,9,14,21]},{"name":"Monolith with modules","values":[3,3,4,4,5,5]}]}}},{"type":"heading","attrs":{"level":2,"id":"when-to-choose-a-monolith-and-when-not-to"},"content":[{"type":"text","text":"When to choose a monolith, and when not to"}]},{"type":"paragraph","content":[{"type":"text","text":"A monolith is a sensible default when the team is small (up to a dozen or so people), the domain is still taking shape and the scaling requirements are moderate. In "},{"type":"text","text":"Monolith First","marks":[{"type":"italic"}]},{"type":"text","text":" (2015), Martin Fowler observes that most successful microservice systems started as a monolith that was split over time, while projects that started with microservices more often ran into trouble."}]},{"type":"paragraph","content":[{"type":"text","text":"A monolith stops being enough when "},{"type":"text","text":"concrete","marks":[{"type":"bold"}]},{"type":"text","text":" signals appear, not fashion:"}]},{"type":"orderedList","attrs":{"start":1},"content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Several teams block each other at deployment time despite good modularity."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"One area has radically different requirements (e.g. GPU image processing or 100× more traffic)."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Part of the system needs a different release cycle or different compliance requirements (e.g. payments)."}]}]}]},{"type":"heading","attrs":{"level":2,"id":"migration-paths"},"content":[{"type":"text","text":"Migration paths"}]},{"type":"paragraph","content":[{"type":"text","text":"Leaving a monolith is a process, not a rewrite from scratch. The typical route looks like this:"}]},{"type":"timeline","attrs":{"items":[{"date":"Step 1","title":"Dependency map","text":"Draw who calls whom and who reads which tables. Tools: NDepend, ArchUnit, dependency-cruiser, go list -deps, import-linter."},{"date":"Step 2","title":"Modular monolith","text":"Extract modules with a public API and their own tables. Guard the boundaries with architecture tests."},{"date":"Step 3","title":"In-process events","text":"Replace direct calls between modules with events wherever eventual consistency is enough."},{"date":"Step 4","title":"Strangler Fig","text":"Put a new service alongside, route part of the traffic through a gateway and gradually retire the old code."},{"date":"Step 5","title":"Separate databases","text":"Split the data only at the very end – it's the hardest and most expensive step."}]}},{"type":"paragraph","content":[{"type":"text","text":"Martin Fowler described the strangler pattern in 2004, inspired by fig trees that wrap around a host tree until they eventually replace it. It works because the system is deployable at every moment."}]},{"type":"heading","attrs":{"level":2,"id":"in-practice"},"content":[{"type":"text","text":"In practice"}]},{"type":"bulletList","content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Shopify","marks":[{"type":"bold"}]},{"type":"text","text":" runs one of the largest Ruby on Rails monoliths and, instead of splitting it, organises it into a modular monolith; it built the Packwerk tool to enforce boundaries between components."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Basecamp and HEY","marks":[{"type":"bold"}]},{"type":"text","text":" – in "},{"type":"text","text":"The Majestic Monolith","marks":[{"type":"italic"}]},{"type":"text","text":" (2016), David Heinemeier Hansson defends the monolith as a deliberate choice for small teams."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Segment","marks":[{"type":"bold"}]},{"type":"text","text":" described in 2018 how it went back from more than a hundred microservices handling integrations to a single service, because the maintenance cost outweighed the benefits."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Amazon Prime Video","marks":[{"type":"bold"}]},{"type":"text","text":" in 2023 moved its stream-quality monitoring service from a distributed serverless architecture to a single process and cut its infrastructure cost by 90%."}]}]}]},{"type":"paragraph","content":[{"type":"text","text":"In every ecosystem the monolith is simply the default template: "},{"type":"text","text":"dotnet new webapi","marks":[{"type":"code"}]},{"type":"text","text":", Spring Initializr, "},{"type":"text","text":"nest new","marks":[{"type":"code"}]},{"type":"text","text":", "},{"type":"text","text":"django-admin startproject","marks":[{"type":"code"}]},{"type":"text","text":" or a single "},{"type":"text","text":"main.go","marks":[{"type":"code"}]},{"type":"text","text":" with "},{"type":"text","text":"net/http","marks":[{"type":"code"}]},{"type":"text","text":"."}]},{"type":"heading","attrs":{"level":2,"id":"anti-patterns"},"content":[{"type":"text","text":"Anti-patterns"}]},{"type":"bulletList","content":[{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"A 3,000-line ","marks":[{"type":"bold"}]},{"type":"text","text":"Utils","marks":[{"type":"code"}]},{"type":"text","text":" / ","marks":[{"type":"bold"}]},{"type":"text","text":"Common","marks":[{"type":"code"}]},{"type":"text","text":" class","marks":[{"type":"bold"}]},{"type":"text","text":" used by every module – invisible glue that makes any split impossible."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"Entities shared by everybody","marks":[{"type":"bold"}]},{"type":"text","text":" – a single "},{"type":"text","text":"Customer","marks":[{"type":"code"}]},{"type":"text","text":" class with 80 fields used by sales, delivery and accounting."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"The distributed monolith","marks":[{"type":"bold"}]},{"type":"text","text":" – a split into services that need a joint deployment and synchronous call chains; you pay for the network and don't get independence."}]}]},{"type":"listItem","content":[{"type":"paragraph","content":[{"type":"text","text":"A big-bang rewrite","marks":[{"type":"bold"}]},{"type":"text","text":" instead of a gradual migration – the new system chases the old one, which keeps changing."}]}]}]},{"type":"heading","attrs":{"level":2,"id":"related-topics"},"content":[{"type":"text","text":"Related topics"}]},{"type":"linkCard","attrs":{"url":"/en/topics/modular-monolith","title":"Modular monolith","description":"The next step on the path: one process, but hard module boundaries","kind":"topic","ref":"modular-monolith"}},{"type":"linkCard","attrs":{"url":"/en/topics/layered-architecture","title":"Layered architecture","description":"How to organise code inside a module","kind":"topic","ref":"layered-architecture"}},{"type":"linkCard","attrs":{"url":"/en/articles/hexagonal-architecture","title":"Pierogi in the Hexagon","description":"A hexagonal architecture course in .NET built around a pierogi place","kind":"article","ref":"hexagonal-architecture"}},{"type":"linkCard","attrs":{"url":"/en/topics/microservices","title":"Microservices","description":"When splitting into services really pays off","kind":"topic","ref":"microservices"}},{"type":"heading","attrs":{"level":2,"id":"test-yourself"},"content":[{"type":"text","text":"Test yourself"}]},{"type":"quiz","attrs":{"question":"What is the defining property of a monolith?","multiple":false,"options":[{"text":"No split of the code into modules","correct":false,"explanation":"A monolith can be very well split into modules – that's a modular monolith."},{"text":"The whole system is deployed as one unit","correct":true,"explanation":"Yes, there is one deployment unit, no matter how well the code inside is organised."},{"text":"Using a single programming language","correct":false,"explanation":"Microservices often use a single language too; that's not the criterion."},{"text":"No automated tests","correct":false,"explanation":"That's a property of bad design, not of the architecture."}]}},{"type":"details","content":[{"type":"detailsSummary","content":[{"type":"text","text":"Interview question: when would you NOT split a monolith into microservices?"}]},{"type":"detailsContent","content":[{"type":"paragraph","content":[{"type":"text","text":"When the problem is missing boundaries in the code rather than scale or team independence. Splitting a tangled monolith gives you a distributed monolith: the same dependencies, only over the network, with partial failures and without transactions. Modularise first and add architecture tests; then – if concrete needs appear (independent deployments for several teams, different scaling profiles) – extract services using the strangler pattern."}]}]}]}]},"toc":[{"id":"context-and-forces","text":"Context and forces","level":2,"locked":false},{"id":"structure-what-exactly-is-one","text":"Structure: what exactly is \"one\"","level":2,"locked":false},{"id":"what-it-looks-like-in-code","text":"What it looks like in code","level":2,"locked":false},{"id":"trade-offs","text":"Trade-offs","level":2,"locked":false},{"id":"when-to-choose-a-monolith-and-when-not-to","text":"When to choose a monolith, and when not to","level":2,"locked":false},{"id":"migration-paths","text":"Migration paths","level":2,"locked":false},{"id":"in-practice","text":"In practice","level":2,"locked":false},{"id":"anti-patterns","text":"Anti-patterns","level":2,"locked":false},{"id":"related-topics","text":"Related topics","level":2,"locked":false},{"id":"test-yourself","text":"Test yourself","level":2,"locked":false}],"locked":false,"paywall":null,"previewRatio":0.3,"totalBlocks":44,"visibleBlocks":44,"resources":[{"id":"6b0857b33c96f2d34d0b37c7","type":"article","provider":"web","url":"https://martinfowler.com/bliki/MonolithFirst.html","embedUrl":null,"title":"Monolith First (2015)","description":"Going directly to a microservices architecture is risky, so consider building a monolithic system first. Split to microservices when, and if, you need it.","author":"martinfowler.com","thumbnailUrl":"https://martinfowler.com/bliki/images/microservice-verdict/path.png","durationSec":null,"lang":"en","topics":["monolith","microservices"],"techs":["general"],"tags":["software-architecture","hacker-news"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"hn","publishedAt":"2021-02-19T07:27:51.000Z","popularity":84,"verifiedAt":"2026-11-26T11:08:01.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:51.221Z","updatedAt":"2026-11-26T16:00:51.221Z"},{"id":"6b0857b53c96f2d34d0b38d6","type":"article","provider":"web","url":"https://m.signalvnoise.com/the-majestic-monolith-29166d022228","embedUrl":null,"title":"The Majestic Monolith","description":"Monolith by Rene Aigner Some patterns are just about the code. If your code looks like this, and you need it to do that, here’s what to do. You’d do well to study such patterns, as they give you a …","author":"Signal v. Noise","thumbnailUrl":null,"durationSec":null,"lang":"en","topics":["monolith"],"techs":["general"],"tags":["software-architecture","hacker-news"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"hn","publishedAt":"2016-02-29T15:02:07.000Z","popularity":71,"verifiedAt":"2026-11-26T11:08:01.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:52.228Z","updatedAt":"2026-11-26T16:00:52.228Z"},{"id":"6b0857b53c96f2d34d0b38b7","type":"article","provider":"web","url":"https://engineering.shopify.com/blogs/engineering/shopify-monolith","embedUrl":null,"title":"Under Deconstruction: The State of Shopify’s Monolith","description":"It’s been 18 months since we talked about our Rails modular monolith. We lay out the current state of the work, and things we’d do differently if we started again.","author":"Shopify","thumbnailUrl":"https://cdn.shopify.com/b/shopify-brochure2-assets/e14325e0c730d96c0c04c090b1cb0524.jpg","durationSec":null,"lang":"en","topics":["monolith","modular-monolith"],"techs":["general"],"tags":["software-architecture","hacker-news"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"hn","publishedAt":"2020-09-17T15:03:12.000Z","popularity":72,"verifiedAt":"2026-11-26T11:08:01.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:52.228Z","updatedAt":"2026-11-26T16:00:52.228Z"},{"id":"6b0857b33c96f2d34d0b3798","type":"article","provider":"web","url":"https://segment.com/blog/goodbye-microservices","embedUrl":null,"title":"Goodbye Microservices: From 100s of problem children to 1 superstar","description":"Discover Twilio’s shift to a single powerful service! Learn cloud communication trends, customer success stories, and how to build scalable apps. Join now!","author":"Twilio","thumbnailUrl":"https://www.twilio.com/content/dam/twilio-com/core-assets/social/twilio-blog-default-ogimage.png","durationSec":null,"lang":"en","topics":["microservices"],"techs":["general"],"tags":["system-design","cloud","software-architecture","hacker-news"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"hn","publishedAt":"2018-07-10T15:49:10.000Z","popularity":89,"verifiedAt":"2026-11-26T11:07:49.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:51.221Z","updatedAt":"2026-11-26T16:00:51.221Z"},{"id":"6b0857be3c96f2d34d0b41fb","type":"article","provider":"web","url":"https://martinfowler.com/bliki/StranglerFigApplication.html","embedUrl":null,"title":"bliki: Strangler Fig","description":"Inspired by the strangler figs in Australia, a strangler fig application gradually draws behavior out of its host legacy application","author":"Martin Fowler","thumbnailUrl":"https://martinfowler.com/bliki/images/stranglerApplication/11090068.jpg","durationSec":null,"lang":"en","topics":[],"techs":["general"],"tags":["martin-fowler","legacy-code"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":null,"popularity":75,"verifiedAt":"2026-11-26T11:07:11.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:00:59.965Z","updatedAt":"2026-11-26T16:00:59.965Z"},{"id":"6b0857bf3c96f2d34d0b4280","type":"article","provider":"web","url":"https://microservices.io/patterns/monolithic.html","embedUrl":null,"title":"Microservices Pattern: Pattern: Monolithic Architecture","description":"The monolithic architecture structures an application as a single deployable/executable component","author":"Chris Richardson (microservices.io)","thumbnailUrl":null,"durationSec":null,"lang":"en","topics":["monolith","microservices"],"techs":["general"],"tags":["software-architecture"],"price":"free","featured":false,"featuredOrder":0,"packageName":null,"source":"manual","publishedAt":null,"popularity":65,"verifiedAt":"2026-11-26T11:25:53.000Z","curated":false,"addedBy":"6b0857a15a2625e44ecaabe6","createdAt":"2026-11-26T16:01:02.417Z","updatedAt":"2026-11-26T16:01:02.417Z"}],"challenges":[{"id":"6b093dc291bd8fbaf2a0c8d8","slug":"payment-circuit-breaker","title":"Circuit breaker for a payment gateway","summary":"A circuit breaker with closed, open and half-open states, an injected clock, a trial-success threshold and a business-error filter – so a payment gateway outage does not take the whole shop down.","servedLang":"en","availableLangs":["pl","en"],"kind":"code","category":"architecture","status":"published","difficulty":"hard","topics":["circuit-breaker","microservices"],"techs":["typescript","javascript","python","dotnet","java","go"],"tags":["circuit-breaker","resilience","fault-tolerance","state-machine","payments"],"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:26.251Z"}],"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":true},{"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":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":null,"next":{"slug":"modular-monolith","title":"The Modular Monolith: hard boundaries without the cost of the network"},"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}]}}