Technical Deep Dives

Inside ERMLib's Microservices Architecture

View as Markdown
Inside ERMLib's Microservices Architecture
On this page

When we started planning ERMLib v3, one of the earliest and most consequential decisions was whether to continue evolving the existing monolithic codebase or break it apart into independent services. We chose the latter, and the journey from monolith to microservices taught us lessons that are worth sharing.

Why We Made the Switch

The ERMLib v2 codebase was a well-structured monolith. It worked. But as our customer base grew and feature requests diversified, we hit limitations that no amount of refactoring within the monolith could solve.

Deploying a change to the cataloging module required deploying the entire application. A spike in search traffic affected circulation performance because they shared resources. Adding a new API endpoint meant navigating a codebase that had grown to several hundred thousand lines.

We needed independent deployability, independent scalability, and clearer ownership boundaries for our growing engineering team.

How We Decomposed

We did not attempt a big-bang rewrite. Instead, we identified natural service boundaries based on domain concepts: catalog, circulation, patron management, acquisitions, search, analytics, and notifications. Each maps to a distinct area of library operations with well-defined interfaces between them.

The catalog service owns bibliographic and authority records. The circulation service manages checkouts, returns, holds, and fines. The patron service handles user accounts, authentication, and permissions. Each service owns its own data store and communicates with others through asynchronous event streams and synchronous API calls where low latency is required.

The Event Bus

An event-driven architecture ties the services together. When a patron checks out an item, the circulation service publishes a checkout event. The analytics service consumes it to update dashboards. The notification service consumes it to send a confirmation to the patron. The catalog service consumes it to update availability status.

This decoupling means that adding a new consumer for checkout events does not require any changes to the circulation service. It also means that if the analytics service goes down temporarily, checkout events queue up and are processed when it recovers.

Trade-Offs We Accept

Microservices are not free. Distributed systems introduce complexity in areas that monoliths handle implicitly. Data consistency across services requires careful design. We use eventual consistency for most cross-service data and reserve strong consistency for operations where it truly matters, such as checking whether an item is available for checkout.

Debugging across service boundaries is harder. We invested heavily in distributed tracing, structured logging, and centralized monitoring to maintain visibility into request flows that span multiple services.

Operational overhead increased as well. More services mean more deployments, more monitoring targets, and more potential failure points. Automation is essential, and we treat our deployment pipeline and infrastructure-as-code with the same rigor as our application code.

What We Gained

The benefits have justified the investment. Individual services deploy independently multiple times per day. Search infrastructure scales separately from circulation during peak periods. Teams own their services end to end, from development through production operations.

Most importantly, the architecture gives us the flexibility to evolve each part of the system at its own pace, which is exactly what a platform serving hundreds of diverse institutions needs.

ERMLib Team

Product, engineering and library specialists

Related Posts