> ## Documentation Index
> Fetch the complete documentation index at: https://docs.drpn.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Service layer

> How Darpan exposes and organizes backend services.

Understanding the service layers clarifies where to add validation, change behavior, or trace a bug.

Darpan backend calls use Moqui JSON-RPC through `/rpc/json`. The method name is a Moqui service name, for example:

```text theme={null}
facade.ReconciliationFacadeServices.list#SavedRuns
```

## Layering

| Layer           | Role                                                                                                                       |
| --------------- | -------------------------------------------------------------------------------------------------------------------------- |
| Facade services | Public JSON-RPC contracts used by the UI. They validate inputs, enforce access, normalize parameters, and shape responses. |
| Core services   | Internal services that perform reconciliation, schema, rule, and file-processing work.                                     |
| Entity services | Moqui entity operations and XML actions that persist product records.                                                      |
| Helper code     | Groovy or Java methods for dense logic such as Spark processing, JSON parsing, and rule execution.                         |

## Facade services

Facade services are the app integration point. The active facade files include:

* `service/facade/AuthFacadeServices.xml`
* `service/facade/SettingsFacadeServices.xml`
* `service/facade/JsonSchemaFacadeServices.xml`
* `service/facade/ReconciliationFacadeServices.xml`
* `service/facade/SearchFacadeServices.xml`

The full verified facade method inventory is in the [service catalog](/api-reference/service-catalog).

## Core reconciliation services

Core reconciliation services live under `service/reconciliation/**`.

| Service file                             | Purpose                                                                                                                                                 |
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `ReconciliationCoreServices.xml`         | Spark-backed core compare services, RuleSet compare-scope preparation, base diff generation, and legacy mapping execution.                              |
| `ReconciliationGenericServices.xml`      | Generic reconciliation entrypoints that accept uploaded or text payloads and route to RuleSet or mapping execution, plus generated-output file cleanup. |
| `ReconciliationRuleEngineServices.xml`   | RuleSet, Rule, Drools compile, execution, and cache operations.                                                                                         |
| `ReconciliationAutomationServices.xml`   | Scheduled automation scanning and execution, SFTP polling, and the stuck-run reaper (`sweep#StuckReconciliationRuns`).                                  |
| `ReconciliationNotificationServices.xml` | Run-completion notification payload building (`build#RunCompletedPayload`) for tenant Google Chat alerts.                                               |
| `ReconciliationJsonServices.xml`         | JSON file reconciliation entrypoints.                                                                                                                   |
| `ReconciliationMixedServices.xml`        | Mixed-format file reconciliation support.                                                                                                               |

## XML-first rule

XML services own validation, authorization, entity mutation, service calls, and response shaping. Groovy and Java helpers handle processing-heavy code such as Spark preparation, rule execution, JSON normalization, and schema inference.

## API shape

Darpan APIs are exposed through verified facade service names and the Moqui JSON-RPC envelope. Service references document required parameters, auth expectations, side effects, and response fields for those facade contracts.
