OpenRevenue
OpenRevenue is an open-source, configurable tax and revenue administration platform for governments, municipalities, and public-sector organizations. It is developed by the OpenCorex open-source organization and is an early production-oriented foundation, not a finished revenue system.
OpenRevenue is an independent OpenCorex open-source project. It is not affiliated with Sri Lanka’s Inland Revenue Department or any other government organization. All included tax data is fictional demonstration data and is not legal or tax advice.
Vision and capabilities
The platform is designed for registration, filing, calculation, assessment, payments, append-only taxpayer ledgers, documents, notifications, audit, refunds, objections, compliance, reporting, and integrations. Country packs supply versioned forms, rules, languages, currencies, financial years, workflows, and integration adapters without putting national policy in the core.
The first vertical slice supports creating a taxpayer, approving a sample tax registration, drafting and validating a return, calculating a fictional 10% liability, submitting and assessing it, posting an assessment debit, receiving and allocating a payment, posting a payment credit, reading the ledger, recording audit events, and invoking a notification port.
Applications and stack
- Go API, worker, and scheduler; Chi; PostgreSQL/pgx/sqlc migration-ready design; OpenAPI 3.1; slog; Prometheus; OpenTelemetry configuration.
- React/TypeScript/Vite portal workspace with TanStack Query and shared packages; the taxpayer portal is the initial UI shell.
- PostgreSQL, Redis, MinIO, Mailpit, Prometheus, Grafana, and OpenTelemetry Collector through Docker Compose.
- pnpm/Turborepo monorepo tooling and GitHub Actions foundations.
Architecture
This is a domain-driven modular monolith. Modules own their data and expose application interfaces; domain code has no framework or persistence dependency. Cross-module asynchronous work uses a transactional outbox. Money uses signed 64-bit minor units and ISO-style currency codes. Returns retain form/rule versions. Ledger and audit tables reject updates and deletes.
High-level architecture
flowchart TB
users["Taxpayers, officers, administrators,<br/>government systems, and payment providers"]
subgraph edge["Edge and identity"]
gateway["CDN / WAF / API gateway"]
identity["OIDC identity provider"]
end
subgraph clients["Browser applications"]
public["Public site"]
taxpayer["Taxpayer portal"]
officer["Officer portal"]
admin["Admin portal"]
end
subgraph runtime["OpenRevenue runtime"]
api["Go API"]
worker["Background workers"]
scheduler["Scheduler"]
modules["Domain modules<br/>registration, filing, assessment,<br/>payments, ledger, audit, and reporting"]
country["Versioned country packs"]
outbox["Transactional outbox"]
end
subgraph data["Data services"]
postgres[("PostgreSQL<br/>system of record")]
redis[("Redis<br/>non-authoritative cache")]
objects[("Object storage<br/>documents and exports")]
end
observability["Logs, metrics, and traces"]
users --> gateway
gateway --> clients
clients --> api
gateway <--> identity
api --> modules
worker --> modules
scheduler --> modules
country --> modules
modules --> postgres
modules --> outbox
outbox --> worker
modules --> redis
modules --> objects
api --> observability
worker --> observability
scheduler --> observability
Every application boundary requires tenant, jurisdiction, actor, and correlation
context. Each module owns its PostgreSQL schema and communicates through
application ports or versioned events—never by querying another module’s
tables. Business state, immutable audit facts, and outbox records commit in one
transaction; workers process side effects idempotently.
See architecture overview, domain boundaries, the foundational domain model, country packs, and security architecture.
Quick start
Requirements are pinned in .tool-versions: Go 1.26.5, Node 22.23.1, pnpm
10.14.0, and Docker with Compose v2.
make bootstrap
make services-up
make quality
make api
The API listens on http://localhost:8080; Mailpit is at
http://localhost:8025. API routes require an Authorization header, and
create-taxpayer requires Idempotency-Key. See the
complete developer setup, run
make doctor for actionable prerequisite diagnostics, and run make help for
all commands.
Repository map
apps/ contains deployable processes and portals; internal/ contains bounded contexts; pkg/ contains narrow cross-cutting libraries; web/ contains shared frontend packages; contracts/ contains OpenAPI and event schemas; database/ contains forward-only migrations; country-packs/ contains jurisdiction configuration; infrastructure/, docs/, tests/, and tools/ contain operational assets.
Contributing, security, and roadmap
Read CONTRIBUTING.md, SECURITY.md, GOVERNANCE.md, and ROADMAP.md. Security reports must not be filed publicly. Licensed under Apache-2.0.
评论