Skip to content
ES

Architecture

Zentto Digital Print is implemented as the zentto-imprenta-seniat microservice (Node/Express + TypeScript + PostgreSQL), acting as a fiscal issuance gateway. The client system (ERP, POS or an integrator) builds a canonical document and sends it to the gateway; Zentto generates the NCF-D control number from its own series, chains the record with a SHA-256 hash and persists the result.

Zentto Digital Print architecture

ComponentDescription
Client system (ERP / POS / Integrator)Builds the canonical document and consumes the gateway. Persists the control number and lookup data.
Gateway /v1/fiscal/gatewayFiscal operations layer: ping, emit, status, download, annul, numbering/assign, numbering/query. Authenticated by X-API-Key (internal channel).
Domain /v1/imprentaWeb vertical API: dashboard, branches, billing points, numberings, assignments, documents, reports, users, audit, configuration. JWT from zentto-auth.
Backoffice /v1/imprenta/backofficeAdministers own series, metering (billable consumption), tariffs, integrators, distributors and commissions.
Integrator API /api/*Public API for third parties: tokenUsuario+secret → short JWT; issuance against own series.
In-house generation (provider propio)Assigns the NCF-D locally from imprenta."ControlSerie", chains with SHA-256 and records the billable event in imprenta."ConsumoControl".
SENIAT endpoints /seniat/*Read-only lookup (by NCF-D, listing, sales book) protected with X-Seniat-Key.
Transmission queuefiscal."SeniatDispatch" — exponential backoff retry (fn_backoff_next) to SENIAT.
  • In-house control-number generation. Zentto assigns the NCF-D from internal series, with an atomic counter (SELECT ... FOR UPDATE), gap-free and collision-free under concurrency.
  • Chained integrity. Each document stores the hash of the previous record of the same issuer RIF (SHA-256 hash-chain), forming an end-to-end verifiable chain.
  • Isolation. The microservice has its own database (schemas fiscal, imprenta, audit, ops) and own domain (imprenta.zentto.net). If it is down, the ERP keeps operating.
  • Multi-tenant. Series are assigned per client company (CompanyId); the backoffice manages series and consumption for all companies.
  • Non-blocking. Unavailability never blocks the sale: the document is queued and a worker retries with backoff.

Issuance implements the FiscalProvider interface with ping, emit, getStatus, download, annul, assignNumbering and queryNumbering. The client sends a canonical document (CanonicalDocument) and Zentto translates it to its internal model.

In in-house mode (provider propio):

  1. emit invokes imprenta.fn_assign_control_serie(companyId, documentType, serie), which takes the next number of the active series with a row lock (FOR UPDATE).
  2. The SHA-256 hash is computed, chained to the previous hash of the issuer RIF.
  3. A billable event is inserted into imprenta."ConsumoControl" (metering).
  4. controlNumber is returned and documentos.service persists the document.
SchemaMain tablesUse
fiscalNcfdSequence, DigitalInvoice, SeniatDispatchNCF-D sequence, document store with hash-chain, transmission queue.
imprentaControlSerie, ConsumoControl, TarifaPlan, Integrador, IntegradorCredential, Distribuidor, DistribuidorCartera, ComisionPlan, ComisionLiquidacion, Documento, Sucursal, PuntoFacturacionPrint business domain.
auditAuditLogOperations audit trail.
opsConfig, TenantRuntime config and company registry.