NEXEVES Mega Menu

Data Synchronization Between Multiple ERPNext Sites

 · 14 min read

Data Synchronization Between Multiple ERPNext Sites – Internal Architecture and Governance ERPNext Illustration

Data synchronization between multiple ERPNext sites is an architectural decision, not a configuration feature. It defines how independent ERP installations exchange information while preserving transactional integrity, auditability, and legal isolation.

This document explains how multi-site synchronization works internally, why naïve synchronization designs fail, and how ERPNext must be extended to support controlled data propagation without violating system guarantees.

The focus is on internal behavior, data ownership, transaction safety, and governance — not interface navigation or user instructions.

1. Concept of Multi-Site Architecture in ERPNext

An ERPNext site represents a fully isolated system boundary. Each site has its own database, file storage, background workers, scheduler, and authentication context.

Unlike multi-company setups, which share a database, multi-site architecture introduces physical data separation. No data is shared by default, and no implicit relationship exists between sites.

Synchronization therefore becomes an external orchestration problem, not a native ERP behavior.

Conceptual Architecture Flow

Independent ERPNext sites
→ Separate databases
→ Independent ledgers
→ Controlled integration layer

Site Boundary Characteristics

AspectBehavior
DatabaseFully isolated per site
Users and rolesLocal to each site
TransactionsNever cross site boundary
Audit trailSite-specific

Core Principle

  • A site is a hard system boundary
  • No implicit trust exists between sites
  • Synchronization must be explicit and traceable

2. Business and Legal Drivers for Multi-Site Synchronization

Multi-site synchronization is required when organizational, legal, or operational constraints prevent the use of a single ERP instance.

ERPNext is often deployed across multiple sites due to regulatory isolation, regional autonomy, data residency laws, or performance requirements.

Synchronization exists to enable visibility and coordination, not to merge systems.

Decision Evaluation Flow

Separate legal environments?
→ Separate ERP deployments?
→ Central visibility required?
→ Controlled synchronization needed

Common Multi-Site Scenarios

ScenarioDriver
Country-wise ERP deploymentsTax and compliance isolation
Franchise networksOperational independence
High-volume operationsPerformance separation

Governance Rule

  • Do not sync sites to compensate for bad design
  • Each site must remain operationally independent
  • Synchronization must never blur legal ownership

3. ERPNext Site Isolation vs Company Isolation

A common architectural mistake is treating multi-site synchronization as an extension of multi-company behavior.

In ERPNext, multi-company separation exists within a shared database, while multi-site separation exists at the infrastructure level. The guarantees and risks are fundamentally different.

Synchronization logic must therefore assume zero shared state.

Isolation Comparison Flow

Multi-company
→ Shared database
→ Logical isolation

Multi-site
→ Separate databases
→ Physical isolation

Isolation Comparison

DimensionMulti-CompanyMulti-Site
DatabaseSharedSeparate
Ledger isolationLogicalPhysical
SynchronizationNot requiredMandatory
Failure impactLocalCross-system

Design Implication

  • Company logic cannot be reused for site sync
  • Each site must validate data independently
  • Trust boundaries must be explicit

4. Classification of Data for Synchronization

Not all ERPNext data is suitable for synchronization. Data must be classified based on ownership, mutability, and audit sensitivity before any synchronization logic is implemented.

Blind synchronization of transactional data creates reconciliation risks, duplicate postings, and legal ambiguity.

Data Classification Flow

Data identified
→ Ownership evaluated
→ Mutability assessed
→ Sync eligibility determined

ERPNext Data Categories

Data TypeSync Suitability
Item masterHigh
Customer and supplierMedium
Stock ledgerNot recommended
GL entriesNever

Governance Principle

  • Masters may be synchronized
  • Transactions should be referenced, not copied
  • Ledgers must never be synchronized

5. Synchronization Boundary and Ownership Rules

Every synchronization design must define a clear source of truth. Without ownership rules, conflicts become inevitable and resolution becomes arbitrary.

ERPNext does not provide built-in conflict resolution across sites. Ownership must be defined at design time, not at runtime.

Ownership Resolution Flow

Record created
→ Owning site identified
→ Write access restricted
→ Other sites consume read-only

Ownership Models

ModelBehavior
Single source of truthOne site owns, others consume
Distributed ownershipHigh conflict risk
Federated ownershipDomain-specific control

Non-Negotiable Rule

  • No record should be writable from multiple sites
  • Conflict resolution must not rewrite history
  • Audit trail must identify originating site

6. Source-of-Truth Design Model in Multi-Site Synchronization

A source-of-truth model defines which ERPNext site owns the authoritative version of a specific data entity. Without this definition, synchronization degenerates into conflict resolution, which ERPNext is not designed to handle natively.

Ownership must be decided per data domain, not globally. Different sites may own different masters, but no single record should ever have multiple owners.

This model enforces deterministic behavior during synchronization and protects audit integrity.

Source-of-Truth Resolution Flow

Data domain identified
→ Owning site assigned
→ Write operations restricted
→ Read-only propagation enabled

Ownership Assignment Examples

Data EntityOwning Site
Item masterCentral master site
Customer masterRegional sales site
Supplier masterProcurement hub site

Governance Rule

  • Ownership is defined once and enforced forever
  • Ownership must be documented outside the system
  • No emergency overrides in production

7. One-Way vs Bi-Directional Synchronization Architecture

Synchronization architecture defines how data flows between sites. ERPNext multi-site implementations should strongly prefer one-way synchronization over bi-directional models.

Bi-directional synchronization introduces conflict resolution, ordering problems, and audit ambiguity. ERPNext provides no native tools to resolve these safely.

One-way flows preserve determinism and simplify failure recovery.

Synchronization Direction Flow

One-way sync
→ Source site publishes
→ Target site consumes

Bi-directional sync
→ Multiple publishers
→ Conflict potential

Architecture Comparison

ModelRisk LevelRecommended
One-wayLowYes
Bi-directionalHighNo
Hub-and-spokeMediumConditional

Design Principle

  • Prefer unidirectional data flow
  • Avoid mutual writes at all cost
  • Complex sync is harder to audit than manual correction

8. Incremental Synchronization vs Full Data Synchronization

ERPNext multi-site environments must choose between incremental and full synchronization strategies. The choice affects performance, data consistency, and operational risk.

Incremental sync tracks changes since the last successful run, while full sync reprocesses the entire dataset.

Incremental synchronization is the default choice for production systems.

Synchronization Strategy Flow

Change detected
→ Incremental sync triggered
→ Target updated

OR

Full dataset selected
→ Bulk transfer executed
→ Target reconciled

Strategy Comparison

AspectIncrementalFull
PerformanceHighLow
RiskLowHigh
Use caseDaily operationsInitial setup / recovery

Operational Guidance

  • Use full sync only during onboarding
  • Track last sync timestamp reliably
  • Never mix strategies mid-cycle

9. Master Data Synchronization – Internal Execution Logic

Master data synchronization is the safest and most common multi-site synchronization use case. ERPNext masters are relatively stable and have limited transactional side effects.

Even so, master synchronization must respect naming conventions, default values, and validation rules on the target site.

Master sync should never bypass validations.

Master Sync Execution Flow

Master updated on source
→ Change captured
→ Payload generated
→ Target validation executed
→ Record created or updated

Common Master Sync Targets

MasterSync Suitability
ItemHigh
CustomerHigh
SupplierHigh
Price ListMedium

Design Constraints

  • Respect naming series on target site
  • Do not override local defaults blindly
  • Log every master sync action

10. Transaction Synchronization Constraints and Risk Boundaries

Transactional data synchronization is inherently dangerous in ERPNext multi-site environments. Transactions carry financial, inventory, and audit implications that cannot be safely replayed.

ERPNext does not support cross-site transactional integrity. As a result, transactions should be referenced, not duplicated.

Most production systems avoid transaction synchronization entirely.

Transaction Handling Flow

Transaction created
→ Reference identifier generated
→ Metadata shared (optional)
→ No ledger or stock copied

Transaction Sync Risk Matrix

TransactionRecommended Action
Sales InvoiceDo not sync
Purchase InvoiceDo not sync
Stock EntryNever sync
Sales OrderReference only

Hard Rule

  • Never sync GL entries across sites
  • Never sync stock ledgers
  • Use reporting APIs instead of replication

11. Document Identity, Naming Conflicts, and Record Mapping

In multi-site synchronization, document identity is the most overlooked and most dangerous problem. ERPNext document names are not globally unique and are often generated using local naming series.

When the same document type exists on multiple sites, name collisions become inevitable unless an explicit identity strategy is enforced.

Document identity must therefore be decoupled from document naming.

Identity Resolution Flow

Document created
→ Local name assigned
→ Global identifier generated
→ Mapping stored externally

Identity Components

ComponentPurpose
Local nameERPNext internal reference
External IDCross-site identity
Source site codeOrigin identification

Design Rule

  • Never rely on document name across sites
  • Always store an external identifier
  • Identity mapping must be immutable

12. UUID, Hash, and External ID Strategies

A globally unique identifier is mandatory for safe synchronization. ERPNext does not generate such identifiers by default, so they must be introduced explicitly.

UUIDs provide randomness, while hashes provide content-based identity. Each approach has trade-offs in traceability and performance.

External IDs should be generated at creation time and never modified.

Identifier Generation Flow

Document created
→ UUID generated
→ External ID stored
→ Used for all sync operations

Identifier Strategy Comparison

StrategyProsCons
UUID v4Globally uniqueNot human-readable
Content hashChange detectionBreaks on updates
Composite keyReadableCollision risk

Governance Principle

  • Generate identifiers once
  • Never regenerate identifiers
  • Never expose ERPNext names externally

13. API-Based Synchronization – Internal Execution Flow

API-based synchronization is the most common and controllable approach for ERPNext multi-site data exchange. Each site exposes a controlled API endpoint for inbound synchronization.

The receiving site must treat all inbound API calls as untrusted input, even if they originate from internal systems.

Validation and permission checks must never be bypassed.

API Sync Execution Flow

Source site detects change
→ API payload generated
→ Secure API call executed
→ Target validation applied
→ Commit or reject

API Responsibilities

LayerResponsibility
SourcePayload accuracy
TransportAuthentication & encryption
TargetValidation & persistence

Security Rule

  • Never expose standard CRUD endpoints
  • Use custom sync-specific APIs
  • Log every inbound request

14. Webhook-Driven Synchronization and Event Architecture

Webhooks enable event-driven synchronization, where changes are propagated immediately after they occur. This reduces latency but increases coupling between sites.

ERPNext webhooks trigger on document events such as creation, update, or submission. These events must be filtered carefully.

Not all events are suitable for propagation.

Webhook Event Flow

Document event triggered
→ Webhook payload generated
→ Remote endpoint called
→ Event queued or processed

Webhook Suitability

Event TypeRecommended
Master updateYes
Transaction submitNo
Status changeConditional

Design Constraint

  • Webhooks must be idempotent
  • Failures must not block transactions
  • Queue processing is mandatory

15. Scheduler-Based Batch Synchronization

Scheduler-based synchronization is used for predictable, low-frequency data exchange. It trades immediacy for reliability and control.

Batch jobs reduce load spikes and allow synchronization to be paused, resumed, or rerun safely.

This approach is preferred for large master datasets.

Batch Sync Execution Flow

Scheduler triggered
→ Changes queried
→ Batch payload prepared
→ Target sync executed
→ Status recorded

Batch Sync Characteristics

AspectBehavior
FrequencyScheduled
Error handlingRetryable
AuditabilityHigh

Operational Rule

  • Never mix batch and real-time logic
  • Track sync state persistently
  • Design jobs to be restart-safe

16. Conflict Detection and Resolution Logic

Conflict detection is required whenever synchronized data can be modified independently on more than one site. Even with strict ownership rules, misconfiguration or manual intervention can introduce conflicts.

ERPNext does not provide native conflict resolution mechanisms across sites. Any resolution strategy must therefore be explicitly implemented outside core transaction flows.

Conflict resolution must never alter historical or audited data.

Conflict Detection Flow

Incoming sync payload
→ External ID matched
→ Last modified timestamp compared
→ Ownership validated
→ Conflict flagged or accepted

Common Conflict Types

Conflict TypeDescription
Concurrent updatesSame record modified on multiple sites
Ownership violationNon-owning site attempts write
Schema mismatchField structure inconsistency

Resolution Rule

  • Reject conflicting writes by default
  • Never auto-merge transactional data
  • Resolve conflicts manually with audit oversight

17. Validation Layers Before Data Persistence

All synchronized data must pass through the same validation layers as locally created documents. Synchronization is not a bypass mechanism.

ERPNext validation includes schema validation, business rule enforcement, and permission checks. Skipping any layer introduces data corruption risk.

Validation failures must be treated as sync failures, not system errors.

Validation Execution Flow

Payload received
→ Schema validation
→ Business rule validation
→ Permission validation
→ Persist or reject

Validation Categories

LayerPurpose
SchemaField and datatype integrity
Business rulesERPNext domain logic
PermissionsAccess control enforcement

Design Principle

  • Never disable validation for sync
  • Surface validation errors clearly
  • Fix data at source, not target

18. Failure Handling, Retries, and Recovery Strategy

Synchronization failures are expected in distributed systems. Network issues, validation errors, or remote downtime must not compromise data integrity.

ERPNext multi-site sync must therefore be designed with retry and recovery as first-class concerns.

Failures must be isolated, logged, and recoverable.

Failure Handling Flow

Sync attempt fails
→ Error captured
→ Retry scheduled
→ Max retries evaluated
→ Manual intervention triggered if needed

Failure Categories

Failure TypeAction
Network errorRetry automatically
Validation errorFix source data
Authorization errorStop and investigate

Operational Rule

  • Retries must be idempotent
  • Never retry indefinitely
  • Expose failures to operators

19. Idempotency and Duplicate Prevention

Idempotency ensures that repeated sync attempts do not create duplicate records or corrupt data. This is critical in retry-based architectures.

ERPNext does not enforce idempotency at the application level. It must be designed explicitly into synchronization logic.

Every sync operation must be safely repeatable.

Idempotency Control Flow

Payload received
→ External ID checked
→ Existing record matched
→ Update or ignore

Duplicate Prevention Mechanisms

MechanismPurpose
External IDUnique record mapping
Sync log tableExecution tracking
Hash comparisonChange detection

Hard Rule

  • Never create records blindly
  • All writes must be idempotent
  • Duplicates indicate design failure

20. Security, Authentication, and Authorization

Multi-site synchronization expands the attack surface of ERPNext deployments. Each sync endpoint must be secured as rigorously as public-facing APIs.

Authentication establishes who is calling, while authorization determines what the caller may do. Both are mandatory.

Security failures in sync logic have system-wide consequences.

Security Enforcement Flow

Request received
→ Token validated
→ Source site verified
→ Permission scope checked
→ Processing allowed or denied

Security Controls

ControlPurpose
API tokensCaller authentication
IP restrictionsNetwork-level trust
Scoped permissionsLeast privilege

Security Principle

  • Never reuse user credentials for sync
  • Rotate tokens periodically
  • Audit all sync access

21. Performance and Load Management in Multi-Site Synchronization

Synchronization introduces additional load on both source and target ERPNext sites. If not controlled, sync processes can interfere with normal transactional workloads.

Performance considerations must be part of synchronization architecture, not an afterthought. Poorly designed sync logic can degrade user experience and destabilize production systems.

Load must be predictable, throttled, and observable.

Performance Management Flow

Sync triggered
→ Load evaluated
→ Throttling applied
→ Execution scheduled
→ Metrics collected

Performance Control Techniques

TechniquePurpose
Rate limitingPrevent API overload
Batch sizingControl memory usage
Off-peak schedulingAvoid peak hours

Operational Rule

  • Never sync during peak transaction hours
  • Monitor sync latency continuously
  • Scale workers independently from users

22. Data Volume Management and Pagination Strategy

As ERPNext databases grow, synchronization must handle large volumes of data safely. Attempting to sync entire datasets in a single operation is neither reliable nor scalable.

Pagination and windowing are mandatory for large data sets. They allow progress tracking and controlled recovery.

Volume must always be bounded.

Pagination Execution Flow

Dataset identified
→ Page size defined
→ Windowed queries executed
→ Progress checkpoint recorded

Pagination Controls

ControlPurpose
Page sizeMemory and time control
Offset / cursorDeterministic ordering
CheckpointResume capability

Design Guidance

  • Prefer cursor-based pagination
  • Never rely on implicit ordering
  • Persist pagination state externally

23. Synchronization Logging and Audit Trail

Synchronization without logging is operationally blind. Every sync attempt, success or failure, must be recorded with sufficient detail for audit and troubleshooting.

Sync logs serve as the only reliable evidence of cross-site data movement. They must be immutable and queryable.

Logs are not optional.

Audit Logging Flow

Sync initiated
→ Metadata captured
→ Execution performed
→ Outcome recorded

Mandatory Log Attributes

AttributePurpose
External IDRecord traceability
Source and target siteOwnership tracking
TimestampChronological audit
StatusSuccess or failure

Audit Rule

  • Never delete sync logs
  • Protect logs from modification
  • Expose logs to audit teams

24. Rollback, Recovery, and Data Correction Design

Rollback in distributed systems is fundamentally limited. Once data is persisted on a target site, it cannot be undone automatically without introducing further risk.

Recovery strategies must therefore focus on correction, not reversal. This requires traceability and controlled compensating actions.

Rollback expectations must be realistic.

Recovery Design Flow

Error identified
→ Impact assessed
→ Corrective action designed
→ Manual or scripted correction applied

Recovery Mechanisms

MechanismUse Case
Compensating updateIncorrect master data
Manual correctionAudit-sensitive changes
Reference invalidationErroneous linkage

Design Principle

  • Never assume automatic rollback
  • Design for correction, not deletion
  • Always preserve audit trail

25. Version Compatibility and Schema Evolution

ERPNext sites participating in synchronization may not always run the same application version. Differences in schema, validation rules, or business logic can break synchronization silently.

Version compatibility must be explicitly managed. Assuming homogeneous versions is unsafe in long-running systems.

Schema evolution must be planned.

Compatibility Management Flow

Source version detected
→ Target version evaluated
→ Payload adapted if required
→ Sync executed or blocked

Compatibility Risks

RiskImpact
Missing fieldsData loss
Changed validationsSync failure
Deprecated logicInconsistent behavior

Governance Rule

  • Version-sync critical sites together
  • Block sync on incompatible schemas
  • Document schema changes explicitly

26. Custom App Strategy for Multi-Site Synchronization

Multi-site synchronization in ERPNext should never be implemented as ad-hoc scripts or isolated automation rules. It must be encapsulated within a dedicated custom application.

A custom app provides version control, deployment consistency, testability, and governance. Synchronization logic is core infrastructure, not a one-off integration.

Treat sync code as a long-lived system component.

Custom App Architecture Flow

Custom app created
→ Sync modules defined
→ APIs, schedulers, and logs centralized
→ Deployed consistently across sites

Recommended App Components

ComponentResponsibility
Sync APIInbound data handling
Scheduler jobsBatch execution
Mapping tablesIdentity resolution
Sync logsAudit and traceability

Design Principle

  • Never embed sync logic in core ERPNext
  • Version-control all sync behavior
  • Deploy and upgrade sync apps deliberately

27. Production Deployment and Go-Live Checklist

Synchronization failures in production are costly and disruptive. A formal deployment checklist is mandatory before enabling multi-site sync.

Go-live should be treated as a controlled release, not an experimental rollout.

Every assumption must be validated.

Go-Live Validation Flow

Pre-production tested
→ Security verified
→ Ownership rules validated
→ Sync enabled gradually

Production Readiness Checklist

AreaStatus Required
External ID generationVerified
Authentication tokensSecured
Retry and loggingEnabled
Rollback strategyDocumented

Operational Rule

  • Enable sync in stages
  • Monitor logs continuously during go-live
  • Freeze schema changes during rollout

28. Common Multi-Site Synchronization Failures

Most synchronization failures are architectural, not technical. They stem from unclear ownership, over-ambitious scope, or governance gaps.

These failures often surface late, during audits or reconciliation, when correction is expensive.

Prevention is cheaper than recovery.

Failure Pattern Flow

Poor design decisions
→ Uncontrolled sync
→ Data inconsistencies
→ Audit and trust issues

Frequent Failure Scenarios

FailureImpact
Bi-directional writesUnresolvable conflicts
Transaction replicationLedger corruption
Missing audit logsCompliance failure

Prevention Strategy

  • Enforce ownership rules strictly
  • Limit sync scope aggressively
  • Design for audit first, convenience second

29. Governance, Ownership, and Operational Responsibility

Synchronization is not a technical feature; it is a governance model. Clear ownership and accountability are required to operate it safely.

Every synchronized domain must have a business owner, a technical owner, and an operational escalation path.

Without governance, sync logic becomes unmanageable.

Governance Responsibility Flow

Data domain defined
→ Owner assigned
→ Rules documented
→ Enforcement audited

Ownership Model

RoleResponsibility
Business ownerData correctness
Technical ownerSync reliability
OperationsMonitoring and recovery

Governance Rule

  • No sync without a named owner
  • Changes require cross-team approval
  • Audit ownership periodically

30. Multi-Site Synchronization as a Long-Term Architecture

Multi-site synchronization in ERPNext is not a shortcut and not a convenience feature. It is a long-term architectural commitment that affects compliance, scalability, and trust.

When designed correctly, it enables distributed growth while preserving control. When designed poorly, it becomes a permanent operational risk.

Architecture choices made early are difficult to reverse later.

Architecture Lifecycle

Business structure defined
→ Ownership model established
→ Sync architecture implemented
→ Long-term stability maintained

Strategic Value

AspectOutcome
IsolationLegal and audit safety
ControlPredictable data flow
ScalabilityEnterprise readiness

Final Principle

  • Synchronize intentionally, not broadly
  • Protect boundaries rigorously
  • Treat synchronization as core architecture

No comments yet.

Add a comment
Ctrl+Enter to add comment

NEXEVES Footer