DEV Community

Daniel Freitas
Daniel Freitas

Posted on

I built Cepify — a free Brazilian postal code (CEP) API, ViaCEP-compatible (Spring Boot 4 / Java 25)

Quick context for non-Brazilian readers: a CEP (Código de Endereçamento Postal) is Brazil's equivalent
of a ZIP/postal code. The de-facto free API for it is ViaCEP, which is great — but
I wanted a project to really dig into Spring Boot 4 + Java 25, and I kept wanting something I fully
control. So I built Cepify, a free, high-performance CEP lookup web service.

🔗 https://cepify.com.br

What it does

  • CEP lookup returning JSON, XML and JSONP
  • Address search (state / city / street)
  • ViaCEP compatibility: it mirrors ViaCEP's routes and response shape (including the classic {"erro": "true"} for a missing CEP), so you can switch the base URL on existing ViaCEP code
  • A "proper" REST API too (/v1/ceps/{cep}) with ETag / Cache-Control and standardized errors
  • No sign-up, no API key, with per-IP rate limiting

A few technical decisions I found interesting

  • The database holds ~1.5M postal codes, loaded by an ETL that processes the Brazilian Post Office's e-DNE dataset. Keeping it fresh without taking the production table down was honest work.
  • Caffeine cache in front of lookups (the service is far more read than write) — made responses snappy.
  • Observability via logs, not a table: every request becomes a JSON access-log line + Prometheus metrics. For a read-heavy service (and with privacy/LGPD in mind) that felt healthier than writing everything to the DB.
  • Docs via Swagger/OpenAPI.

Stack: Spring Boot 4, Java 25, PostgreSQL, Caffeine, Flyway, behind Cloudflare.

About

It's a personal, free project — no enterprise SLA, but it's live and working. I'd genuinely love
feedback, especially: what would you want from a postal-code API that existing ones don't offer today?

Top comments (0)