Java library · Spring Boot Starter

MoyNalog Java Client

Java library and Spring Boot Starter for the «Moy Nalog» (Russian Federal Tax Service) API: income, receipts, invoices with business bank account details.

2024·Backend
Java 17Spring Boot StarterHTTP client

Context

Services that work with self-employed contractors need to register income and issue invoices programmatically through the «Moy Nalog» API. No ready-made Java client existed — every team wrote its own, duplicating authentication, token refresh, and error handling.

Solution

A library with two integration options: a Spring Boot Starter with auto-configuration (two lines in application.properties) and a standalone mode without Spring. Internally it provides login/password authentication with automatic retry, background token refresh (ReadWriteLock), sync/async receipt submission, invoice issuance with bank details, proxy support (HTTP/HTTPS, with or without authentication), and a configurable timeout.

Stack and architecture

  • Runtime: Java 17.
  • Network layer: HTTP client with built-in retry.
  • Concurrency: ReadWriteLock on token refresh.
  • Auto-config: Spring Boot Starter.
  • Configuration: via Spring properties or the client constructor.

Role and outcome

We built the library out of a real need: a single entry point for all Federal Tax Service operations, safe multithreaded use, and two lines of configuration to get connected. It has been used in several services in production.

Similar project?

Discuss a similar task

Describe the task — we'll share relevant experience and estimate the implementation.