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.
Components
Section titled “Components”| Component | Description |
|---|---|
| Client system (ERP / POS / Integrator) | Builds the canonical document and consumes the gateway. Persists the control number and lookup data. |
Gateway /v1/fiscal/gateway | Fiscal operations layer: ping, emit, status, download, annul, numbering/assign, numbering/query. Authenticated by X-API-Key (internal channel). |
Domain /v1/imprenta | Web vertical API: dashboard, branches, billing points, numberings, assignments, documents, reports, users, audit, configuration. JWT from zentto-auth. |
Backoffice /v1/imprenta/backoffice | Administers 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 queue | fiscal."SeniatDispatch" — exponential backoff retry (fn_backoff_next) to SENIAT. |
Design principles
Section titled “Design principles”- 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 layer
Section titled “Issuance layer”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):
emitinvokesimprenta.fn_assign_control_serie(companyId, documentType, serie), which takes the next number of the active series with a row lock (FOR UPDATE).- The SHA-256 hash is computed, chained to the previous hash of the issuer RIF.
- A billable event is inserted into
imprenta."ConsumoControl"(metering). controlNumberis returned anddocumentos.servicepersists the document.
Database schemas
Section titled “Database schemas”| Schema | Main tables | Use |
|---|---|---|
fiscal | NcfdSequence, DigitalInvoice, SeniatDispatch | NCF-D sequence, document store with hash-chain, transmission queue. |
imprenta | ControlSerie, ConsumoControl, TarifaPlan, Integrador, IntegradorCredential, Distribuidor, DistribuidorCartera, ComisionPlan, ComisionLiquidacion, Documento, Sucursal, PuntoFacturacion | Print business domain. |
audit | AuditLog | Operations audit trail. |
ops | Config, Tenant | Runtime config and company registry. |