Files
zarinpal-analytics-backend/README.md

1.8 KiB

ZarinPal Merchant Analytics — Backend

Go backend for merchant identity, dataset ingestion, deterministic analytics, authenticated APIs, and later AvalAI integration.

Current state: specification bootstrap only. There is intentionally no Go module or application scaffold yet because the architecture and dependency-injection choices still require approval.

Local dataset input

Place the provided archive at:

data/incoming/challenge_data.csv.gz

The entire data/incoming/ payload is ignored by Git. The one-time bootstrap importer will read from this location (or an explicitly supplied path), stream the compressed CSV, validate it, and write an import manifest containing the source checksum, schema version, row counts, quality results, and importer revision. It is an administrative backfill/recovery command, not a scheduled ingestion job. Future production payment data is populated in PostgreSQL by ZarinPal through an upstream contract outside this project's scope. The raw file and resulting PostgreSQL data are not committed.

Planned runnable boundaries

One repository may expose several small cmd/ entry points while sharing domain packages under internal/:

  • HTTP API
  • dataset importer
  • database migration command
  • HTTP API with authenticated SSE analytics delivery
  • on-demand analytics worker that calculates dashboard sections in parallel and caches versioned results in Redis

The exact package layout is deferred until the Go architecture and DI decisions are approved.

Merchant API contract

  • docs/API-SPEC.md defines the reviewable MVP capability, security boundaries, SSE recovery, detail pagination, and CSV-export policy.
  • docs/openapi.yaml is the approved OpenAPI 3.1 interface source of truth for generated frontend types.