ivly-api

module
v0.0.0-...-f948fb5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2026 License: AGPL-3.0, AGPL-3.0-only

README

ivly API

Meet the ivly API - a mythical beast of performance and elegance, forged in the fires of clean code and turbocharged logic. It's so fast, it processes data before you even click - a whisper-quiet powerhouse that keeps your invoices flying while you sit back and sip success.

Part of the ivly platform. This repository is one component of a larger stack. The overall architecture, how the pieces fit together, and how to run the full stack end to end are documented in the ivly-release repository - please start there if you are new to ivly.

What is ivly?

Introducing ivly - the undisputed champion of invoice writing software: sleeker than silk, lighter than a cloud, and so easy your cat could use it. It's not just software - it's a revolution in pixels, hand-crafted by invoice angels to make your billing faster, prettier, and almost criminally effortless. Welcome to the last invoicing tool you'll ever need - or want.

Development

Start the devcontainer, then inside:

# create custom config if needed
cp .env.example .env

# development mode (live reload)
make dev

# or build and run manually
make build
./ivly-api

Builds outside the devcontainer need GOEXPERIMENT=nojsonv2. Go 1.27 defaults encoding/json to the v2 implementation, which breaks gobl v0.504.0. Drop it once gobl.cii supports gobl v0.505.0.

API is available at http://localhost:3101/api/v1/health CouchDB Fauxton at http://localhost:5984/_utils

Testing

All commands run inside the devcontainer.

# unit tests with race detection
make test

# integration tests (requires CouchDB, ivly-validator and ivly-printer devcontainers running)
make test-integration

# full CI suite (quality + security + tests + build)
make all
Golden files

Tests compare output against validated reference files in internal/handler/testdata/golden/. To update them after intentional changes:

# XML golden files (ZUGFeRD / XRechnung)
go test -count=1 ./internal/handler/ -run TestXmlGeneration -update

# LaTeX golden files
go test -count=1 ./internal/handler/ -run TestLaTeXGeneration -update-latex

# PDF golden files (requires ivly-printer devcontainer running)
go test -tags integration -count=1 ./internal/handler/ -run TestPDFGeneration -update-pdf

Dependencies

Go Modules (direct)
Module Purpose
github.com/go-chi/chi/v5 HTTP router
github.com/invopop/gobl GOBL business document types
github.com/invopop/gobl.cii CII/ZUGFeRD XML conversion
github.com/oapi-codegen/runtime OpenAPI generated code runtime
golang.org/x/text Internationalization and text processing

PDF generation and XML validation are delegated to the external services described under "External services" below - ivly-api does not link against gobl.latex or any Java/Saxon code directly.

Runtime Services
Service Image Purpose
CouchDB couchdb:3.5.3 Document database (port 5984, started via .devcontainer/services.yml)
ivly-validator devcontainer of ivly-validation XSD / Schematron validation, network alias ivly-validator:8080
ivly-printer devcontainer of ivly-printer GOBL -> PDF rendering, network alias ivly-printer:8080
Build & Code Generation
Tool Purpose
oapi-codegen Generate chi server stubs from OpenAPI v3 spec
addlicense AGPL license header management
air Live reload during development

Install all with make tools-install.

Quality & Security
Tool Purpose Makefile target
golangci-lint Linter make lint
gosec Security scanner make gosec
govulncheck Vulnerability checker make govulncheck
nancy CVE scanning via OSS Index make nancy
gitleaks Secret detection pre-commit hook
Devcontainer System Packages
Package / Feature Purpose Scope
Go 1.27 (Debian Trixie) Base image runtime
golangci-lint Go linter dev tooling
Python 3 pre-commit hooks framework dev tooling
Woodpecker CLI CI pipeline linting (pre-commit hook) dev tooling

LaTeX, Java and Saxon are not installed in this devcontainer - those dependencies live in the ivly-printer and ivly-validation devcontainers respectively.

External services

XML validation and PDF rendering are delegated to sibling services that run as their own devcontainers in separate repositories:

Service Source repo Network alias Purpose
Validation ivly-validation ivly-validator XSD + EN16931 Schematron validation
Printer ivly-printer ivly-printer GOBL -> PDF rendering via LaTeX

All three devcontainers (this one, validation, printer) join the shared Docker network ivly-net. ivly-api reaches the other services via Docker DNS on the network aliases:

  • VALIDATOR_URL=http://ivly-validator:8080
  • PRINTER_URL=http://ivly-printer:8080

To work on the full stack, clone the sibling repos next to ivly-api and open each one in its own VS Code window with the Dev Containers extension:

<workspace>/
  ivly-api/
  ivly-validation/
  ivly-printer/
  gobl.latex/       <- consumed by ivly-printer as a replace directive target

Inside ivly-validation and ivly-printer, start the service with make dev (live reload) or make run. They only need to be running when ivly-api actually hits their endpoints (PDF generation, XML validation).

Pre-commit Hooks

Managed via pre-commit. Install with pre-commit install.

Hooks: yaml/json validation, trailing whitespace, large file detection, merge conflict check, private key detection, branch protection, gitleaks, golangci-lint, go mod tidy, license headers, tests.

Authors

This project is maintained by the ivly contributors. See the AUTHORS file for details.

License

This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0). See the LICENSE file for details.

Directories

Path Synopsis
cmd
ivly-api command
seed command
internal
api
Package api provides primitives to interact with the openapi HTTP API.
Package api provides primitives to interact with the openapi HTTP API.
bootstrap
Package bootstrap seeds minimal, non-demo data into a freshly created database.
Package bootstrap seeds minimal, non-demo data into a freshly created database.
einvoice
Package einvoice wraps gobl.de.xinvoice with post-processing fixes for known issues.
Package einvoice wraps gobl.de.xinvoice with post-processing fixes for known issues.
printer
Package printer provides an HTTP client for the external printer service that renders GOBL invoices to PDF/LaTeX.
Package printer provides an HTTP client for the external printer service that renders GOBL invoices to PDF/LaTeX.
Package seed provides test/demo data for development.
Package seed provides test/demo data for development.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL