Design of a scalable Payroll Software
Domain-driven software architecture
Driven by bureaucratization, digitization and constant technological change, the design of modern software is a complex challenge. Based on practical experience, the scalability of business cases is particularly crucial for payroll software.
To reduce complexity, software systems are usually divided into different areas (layers or services). These are typically the front-end/client with the user interface (UI) and the back end/server, consisting of the application and the data persistence (database). From a business value perspective, the application is the core of the software as it implements the business processes. The user interface and persistence should ideally be generated from the business model.
If the application is monolithic, any customization must be done by highly skilled software engineers who may not always know the relevant business requirements.
When designing the Payroll Engine, we followed the concept of Domain-Specific Application Frameworks, which provides for the separation of the application into a framework (framework) and the domain/business application. The framework contains the basic functionality and is developed by software engineers who are only involved in fundamental changes. The domain/business application is developed by domain specialists who are provided with the appropriate tools. The specialists are expected to have some technical understanding.
This separation reduces the administrative, financial and communication overhead between business and framework developers. A central design aspect is the correct distribution of knowledge, which enables agile development of business applications and reduces the transfer of know-how between the parties, e.g. in the case of personnel changes, to what is necessary.
In the Payroll Engine, the REST API represents the framework and the regulations a part of the business application. The regulations include the business cases, the payroll calculation and the evaluations/reports.
Another challenge in designing a payroll software is that the business functionality comes from different sources, such as collective bargaining agreements, insurance policies, etc. The Payroll Engine integrates each business source as a separate regulation and merges them in a layered model into a business application. Similar to the image layer in an image processing program, all regulation layers result in the overall image of the business application. The payroll client customizations are integrated into the top regulation layer (image layer).
The Origin of the Layer Concept
The idea of regulation layers originates from CAD software development. In CAD systems, layers separate different concerns — lines, hatching, dimensions, third-party components — each independently manageable and combinable. Layers from external suppliers can be embedded without modifying the base design.
Transferred to payroll: country regulations, industry rules, company customizations and client-specific additions each form an independent layer. The combined view across all layers produces the complete payroll — a top-down evaluation that makes visible what applies, analogous to an object-oriented inheritance hierarchy made tangible.
Where Payroll Complexity Actually Lives
A common misconception is that payroll is mathematically complex. In practice, payroll calculations are built entirely from basic arithmetic operators. There is no need for a custom domain-specific language — and deliberately none was created. C# was chosen as the scripting language because it provides operator overloading and casting exactly where needed, while offering full IDE support, local debugging and a familiar syntax for technical payroll specialists.
The real complexity of payroll operates on two levels:
| Level | Description |
|---|---|
| Compliance | Statutory rules, collective agreements, social insurance — country-specific, time-dependent, versioned |
| Data heterogeneity | Every company has different wage types, employment models, organizational structures and data sources |
Regulation layers directly address data heterogeneity: each layer tailors the data structure and calculation logic for its specific context without affecting other layers. Compliance is handled through versioned, auditable regulations that are bound to each payrun result.
This analysis was the foundation for the core architectural decision: rather than building a monolithic payroll engine with hardcoded rules, separate the invariant processing framework from the variable business rules — and give domain specialists the tools to own the latter.