Skip to main content
Reporter assists Midaz Ledger users in creating dynamic, data-driven reports without SQL knowledge. You define domains, tables, and fields using simple placeholders rather than constructing complex queries.

Typical usage


Step 1 — Create the .tpl file

Write a template matching your desired output format (HTML, XML, CSV, or TXT). The template should incorporate Reporter blocks and follow the appropriate syntax for your output format. See Template examples for guidance.
The file must be saved with a .tpl extension. This is required for proper processing.

Step 2 — Upload the template

Once ready, upload the .tpl file using the Upload a Template endpoint. Set the outputFormat field to specify the report format. The system assigns a UUID filename (for example, 0196159b-4f26-7300-b3d9-f4f68a7c85f3.tpl). Template management endpoints:

Step 3 — Generate the report

Use the Create a Report endpoint to initiate generation. Pass a templateId and optional filters in the request body:
{
  "templateId": "0196159b-4f26-7300-b3d9-f4f68a7c85f3",
  "filters": {
    "midaz_transaction": {
      "transaction": {
        "id": { "eq": ["0196d983-a2c2-7d5a-a5b7-029fe0dcb710"] }
      }
    }
  }
}
The API returns a reportId for tracking and retrieving the output.

Step 4 — Check the report status

The Check Report Status endpoint monitors progress, displaying whether the report is processing or finished.

Step 5 — Download the report

Once finished, download the report using the Download a Report endpoint. The file appears in the response body with proper Content-Disposition headers.

Mapping data sources for dynamic filters


Two supporting endpoints enable dynamic filtering:
These endpoints are optional and designed for advanced use cases, like building custom UIs or automating report workflows based on schema data.

Configuring storage


Reporter stores templates and generated reports in S3-compatible object storage. It supports AWS S3, MinIO, and SeaweedFS out of the box. All files are stored in a single bucket with internal prefixes:
  • templates/ — for uploaded template files
  • reports/ — for generated report files

Storage environment variables

VariableDescriptionDefault
OBJECT_STORAGE_ENDPOINTS3-compatible endpoint URL. Leave empty for AWS S3.
OBJECT_STORAGE_REGIONAWS regionus-east-1
OBJECT_STORAGE_ACCESS_KEY_IDAccess key for authentication
OBJECT_STORAGE_SECRET_KEYSecret key for authentication
OBJECT_STORAGE_USE_PATH_STYLEUse path-style URLs. Required for MinIO and SeaweedFS.false
OBJECT_STORAGE_DISABLE_SSLDisable SSL verification. Use for local development only.false
OBJECT_STORAGE_BUCKETBucket namereporter-storage

Configuration examples by provider

OBJECT_STORAGE_ENDPOINT=
OBJECT_STORAGE_REGION=us-west-2
OBJECT_STORAGE_ACCESS_KEY_ID=AKIA...
OBJECT_STORAGE_SECRET_KEY=your-secret-key
OBJECT_STORAGE_USE_PATH_STYLE=false
OBJECT_STORAGE_DISABLE_SSL=false
OBJECT_STORAGE_BUCKET=reporter-prod-bucket
OBJECT_STORAGE_ENDPOINT=http://minio:9000
OBJECT_STORAGE_REGION=us-east-1
OBJECT_STORAGE_ACCESS_KEY_ID=minioadmin
OBJECT_STORAGE_SECRET_KEY=minioadmin
OBJECT_STORAGE_USE_PATH_STYLE=true
OBJECT_STORAGE_DISABLE_SSL=true
OBJECT_STORAGE_BUCKET=reporter-storage
OBJECT_STORAGE_ENDPOINT=http://reporter-seaweedfs:8333
OBJECT_STORAGE_REGION=us-east-1
OBJECT_STORAGE_ACCESS_KEY_ID=any
OBJECT_STORAGE_SECRET_KEY=any
OBJECT_STORAGE_USE_PATH_STYLE=true
OBJECT_STORAGE_DISABLE_SSL=true
OBJECT_STORAGE_BUCKET=reporter-storage
S3 does not support per-object TTL. To automatically expire generated reports, configure S3 bucket lifecycle policies on your bucket.

Configuring external data sources


Reporter connects to external databases (PostgreSQL and MongoDB) as data sources for your templates. Each data source is configured through environment variables following the pattern DATASOURCE_<NAME>_*.

Data source environment variables

VariableDescriptionRequired
DATASOURCE_<NAME>_CONFIG_NAMEUnique identifier used in templates (for example, midaz_onboarding)Yes
DATASOURCE_<NAME>_HOSTDatabase hostYes
DATASOURCE_<NAME>_PORTDatabase portYes
DATASOURCE_<NAME>_USERDatabase userYes
DATASOURCE_<NAME>_PASSWORDDatabase passwordYes
DATASOURCE_<NAME>_DATABASEDatabase nameYes
DATASOURCE_<NAME>_TYPEDatabase type: postgresql or mongodbYes
DATASOURCE_<NAME>_SSLMODESSL mode for PostgreSQL (disable, require)PostgreSQL only
DATASOURCE_<NAME>_SSLROOTCERTSSL root certificate path for PostgreSQLPostgreSQL only
DATASOURCE_<NAME>_SSLEnable SSL for MongoDB (true or false)MongoDB only
DATASOURCE_<NAME>_SSLCACA certificate file path for MongoDBMongoDB only
DATASOURCE_<NAME>_OPTIONSAdditional URI options for MongoDBMongoDB only
DATASOURCE_<NAME>_SCHEMASComma-separated list of schemas to exposePostgreSQL only

Single data source example

DATASOURCE_ONBOARDING_CONFIG_NAME=midaz_onboarding
DATASOURCE_ONBOARDING_HOST=midaz-postgres-replica
DATASOURCE_ONBOARDING_PORT=5702
DATASOURCE_ONBOARDING_USER=midaz
DATASOURCE_ONBOARDING_PASSWORD=lerian
DATASOURCE_ONBOARDING_DATABASE=onboarding
DATASOURCE_ONBOARDING_TYPE=postgresql
DATASOURCE_ONBOARDING_SSLMODE=disable
In templates, you reference this data source as midaz_onboarding:
{% for account in midaz_onboarding.account %}
  {{ account.id }} - {{ account.name }}
{% endfor %}

Multi-schema data source

To query tables across multiple PostgreSQL schemas, set the DATASOURCE_<NAME>_SCHEMAS variable with a comma-separated list:
DATASOURCE_EXTERNAL_CONFIG_NAME=external_db
DATASOURCE_EXTERNAL_HOST=external-postgres
DATASOURCE_EXTERNAL_PORT=5432
DATASOURCE_EXTERNAL_USER=db_user
DATASOURCE_EXTERNAL_PASSWORD=db_password
DATASOURCE_EXTERNAL_DATABASE=external_database
DATASOURCE_EXTERNAL_TYPE=postgresql
DATASOURCE_EXTERNAL_SSLMODE=disable
DATASOURCE_EXTERNAL_SCHEMAS=sales,inventory,reporting
In templates, use the explicit schema syntax database:schema.table:
{% for order in external_db:sales.orders %}
  {{ order.id }} - {{ order.total }}

  {% for item in external_db:inventory.items|where:"order_id:{{ order.id }}" %}
    Item: {{ item.name }} ({{ item.quantity }} in stock)
  {% endfor %}
{% endfor %}
When generating a report with filters, use schema.table as the table key:
{
  "templateId": "00000000-0000-0000-0000-000000000000",
  "filters": {
    "external_db": {
      "sales.orders": {
        "created_at": { "gte": ["2025-01-01"] }
      }
    }
  }
}
When DATASOURCE_<NAME>_SCHEMAS is not set, Reporter defaults to the public schema only.

Connection behavior

Reporter uses two initialization strategies:
  • Manager component (lazy): Loads configuration without connecting. Connects on-demand when a template references the data source. This provides faster startup.
  • Worker component (eager): Attempts connection on startup with exponential backoff retry (up to 5 retries). Continues with degraded functionality if a data source is unavailable.

Complete environment variables reference


Application

VariableDescriptionDefault
ENV_NAMEEnvironment namedevelopment
LOG_LEVELLog level (debug, info, warn, error)debug
SERVER_PORTManager HTTP port4005
SERVER_ADDRESSManager bind address:4005

Object storage (S3-compatible)

VariableDescriptionDefault
OBJECT_STORAGE_ENDPOINTS3 endpoint URL
OBJECT_STORAGE_REGIONAWS regionus-east-1
OBJECT_STORAGE_ACCESS_KEY_IDAccess key
OBJECT_STORAGE_SECRET_KEYSecret key
OBJECT_STORAGE_USE_PATH_STYLEPath-style URLsfalse
OBJECT_STORAGE_DISABLE_SSLDisable SSLfalse
OBJECT_STORAGE_BUCKETBucket namereporter-storage

MongoDB

VariableDescriptionDefault
MONGO_URIURI scheme (mongodb or mongodb+srv)
MONGO_HOSTMongoDB host
MONGO_NAMEDatabase name
MONGO_USERDatabase user
MONGO_PASSWORDDatabase password
MONGO_PORTDatabase port
MONGO_MAX_POOL_SIZEConnection pool size1000
MONGO_PARAMETERSAdditional URI parameters

RabbitMQ

VariableDescriptionDefault
RABBITMQ_URIURI scheme (amqp)
RABBITMQ_HOSTRabbitMQ host
RABBITMQ_PORT_AMQPAMQP port
RABBITMQ_PORT_HOSTManagement port
RABBITMQ_DEFAULT_USERUser
RABBITMQ_DEFAULT_PASSPassword
RABBITMQ_GENERATE_REPORT_QUEUEQueue name for report generation
RABBITMQ_NUMBERS_OF_WORKERSNumber of consumer workers (worker only)5

Redis / Valkey

VariableDescriptionDefault
REDIS_HOSTRedis host with port (for example, host:6379)
REDIS_PASSWORDRedis password
REDIS_DBDatabase number0
REDIS_PROTOCOLRedis protocol version3
REDIS_MASTER_NAMESentinel master name (if using Sentinel)
REDIS_TLSEnable TLSfalse

PDF generation (worker only)

VariableDescriptionDefault
PDF_POOL_WORKERSNumber of parallel PDF generation workers2
PDF_TIMEOUT_SECONDSTimeout per PDF generation in seconds90

Telemetry (OpenTelemetry)

VariableDescriptionDefault
OTEL_RESOURCE_SERVICE_NAMEService name for traces
OTEL_LIBRARY_NAMEInstrumentation library name
OTEL_RESOURCE_SERVICE_VERSIONService version
OTEL_RESOURCE_DEPLOYMENT_ENVIRONMENTDeployment environment
OTEL_EXPORTER_OTLP_ENDPOINTOTLP exporter endpoint
ENABLE_TELEMETRYEnable telemetry collectionfalse

Authentication

VariableDescriptionDefault
PLUGIN_AUTH_ADDRESSAuth service URL
PLUGIN_AUTH_ENABLEDEnable authenticationfalse

License

VariableDescriptionDefault
LICENSE_KEYLicense key for Reporter
ORGANIZATION_IDSOrganization IDs for license validation