Saltar al contenido principalSaltar a navegaciónSaltar al pie de página
JZdev
HomeAboutProjectsBlogContact
es/en
Contact
es/en
JZ

Menú de navegación

HomeAboutProjectsBlogContact
JZ

Backend Developer specialized in end-to-end systems with Java, Go and Rust — robust, scalable and maintainable solutions.

Get in touch →

Navigation

  • Home
  • About
  • Projects
  • Blog
  • Contact

Services

  • Backend Development
  • REST APIs
  • Full Stack Applications
  • Technical Consulting
© 2026 Javier Zader. Made withand lots of mate 🧉
PrivacyGDPR DataBuilt with Next.js
Inicio/Proyectos/APiGen
Volver a proyectos
CuradoDestacado

APiGen

A code generation platform that turns a SQL schema or OpenAPI contract into a working backend service — 12 target languages, 15+ databases, three cloud stacks.

Ver Origen

Descripción del Proyecto

The Problem#

Every Spring Boot project starts in the same place. You write the entity, then the repository, then the service, then the controller, then DTOs, then the same security setup, then the same observability wiring. Six months later you compare two services from the same team and they all picked slightly different conventions. Multiply that across teams.

I wanted something that turns a SQL schema or OpenAPI contract into a working service in one command — and stays useful after I customize it.

What APiGen Does#

Point it at a SQL schema or OpenAPI spec. Get back a production-shaped service: REST endpoints, persistence layer, security wired, observability instrumented, Dockerfile, Kubernetes manifests, CI pipeline. You can preview before generating, override templates locally without forking, and drive the same engine from CLI, HTTP server, IDE plugin, or MCP.

Loading diagram...
El schema de ejemplo (14 tablas) que apigen consume en el demo del hero — relaciones tomadas del examples/ecommerce-schema.sql real del repo. coupons no aparece: no tiene FKs (el cupón se resuelve por código).

Constraints I Set#

  • Contract-first only. Source of truth is the SQL schema or OpenAPI file. No config DSL layered on top.
  • Generated code must compile and pass tests on the first try. No scaffolding that needs manual fixing.
  • Customizations live next to the project in .apigen/templates. Not in a fork.
  • One engine, every interface. CLI, server, IDE plugin, and MCP all consume the same generation core. No duplication.

My Role#

Single developer. Started December 2024 as a generic Spring Boot REST library. Designed every module, wrote every line that was not auto-generated. Java/Spring background gave me the opinion to encode; APiGen is the platform around that opinion.

How APiGen Started, And Why It Grew#

APiGen began in December 2024 as a generic Spring Boot REST library — the linked repository above. The original code is a base-controller / base-service / base-repository pattern with generics, Hibernate Envers auditing, ModelMapper conversion, centralized exception handling, and pagination, on Spring Boot 3 and Java 21.

The goal was modest: encode my preferred conventions so I would stop rewriting the same controllers, the same security setup, the same exception handlers across services.

As the library matured through 2025, the question shifted. If the conventions are encoded, why does the user have to write the entities at all? Why not generate them from the schema? Then: if the engine can generate Java/Spring, why not Kotlin? Python? Go?

By January 2026 the project became a full code generation platform — the version described in the rest of this page. The link above points to the original generic library so the starting point is verifiable; the platform that grew from it is not public.

Key Decisions#

1. Decoupled pipeline: parsing → IR → template rendering#

The most consequential early decision. Parsers (SQL, OpenAPI) produce a normalized intermediate representation. Templates consume the IR. Neither side knows the other exists.

That separation is what made 12 target languages thinkable. Adding Kotlin does not touch the SQL parser. Adding GraphQL does not touch the codegen pipeline.

Tradeoff: the IR is rigid by design. There is no shortcut from "this OpenAPI quirk" straight to "this Java annotation". Every shortcut has to round-trip through the IR, or the abstraction stops paying off.

Loading diagram...
Parsers y templates no se conocen entre sí: todo pasa por el IR. Por eso sumar un lenguaje no toca el parser SQL, y sumar un protocolo no toca el pipeline de codegen.
Loading diagram...
El mismo pipeline visto en runtime: un `apigen generate` de punta a punta, del schema a 199 archivos que arrancan. Es el run real del terminal del hero.

2. Features as opt-in Gradle modules#

APiGen ships 22 modules: 4 libraries, 4 generators, 13 feature packs (gateway, GraphQL, gRPC, chaos engineering, recommendation, analytics, BFF, notifications, search, observability, and more), and an MCP layer.

Features are not always-on flags. They are separate modules a project opts into. A team that needs gRPC includes the gRPC pack; a team that does not gets nothing extra in their build. Each pack versions independently — the chaos pack can move forward without touching the gateway pack.

Tradeoff: module-boundary discipline. Every feature pack pays a small overhead in setup and contract maintenance. Letting features bleed into core would have made the early experience faster — and the cleanup later much worse.

3. One engine, four delivery surfaces#

The same codegen engine runs behind a CLI (local generation, preview, validation), an HTTP server (preview endpoints, team-shared flows), an IDE plugin (in-editor authoring), and an MCP server (AI assistants drive generation as a tool).

Choosing this on day one forced the engine to be library-shaped from the start, not a CLI with an API bolted on later. That made the MCP integration almost free when it landed.

Loading diagram...
El mismo engine detrás de las cuatro superficies. Por ser library-shaped desde el día uno, integrar MCP fue casi gratis.

What APiGen Can Do Today#

  • 12 target languages — Java/Spring, Kotlin, Python, Node/TypeScript, Go, Rust, C#, PHP, Ruby, Scala, Elixir, Clojure.
  • 15+ databases supported — PostgreSQL, MySQL, MariaDB, Oracle, SQL Server, SQLite, MongoDB, Cassandra, Redis, and more.
  • REST, GraphQL and gRPC from the same model — no logic duplication across protocols.
  • Enterprise features built in by default: soft delete, multi-tenancy, Hibernate Envers auditing, optimistic locking, GDPR/SOC2/PCI compliance reports — 100+ across modules.
  • Multi-level cache out of the box: Caffeine (in-process) + Redis (distributed), with cache-aside policies generated per entity.
  • 3 cloud target stacks — AWS, GCP, Azure, with Terraform output.
  • 60% line / 50% branch coverage minimum, gated in CI.
  • Contract tests (Spring Cloud Contract) on the core library + JMH microbenchmarks on the generation engine.
Loading diagram...
Un solo modelo, derivado del IR, expone los tres protocolos — sin reescribir lógica de negocio.

What I'd Reconsider#

Growing breadth-first. APiGen scaled outward fast — 12 languages, 15 databases, 13 feature packs — while Java/Spring is the only target where I have full operational confidence. The platform looks comprehensive on paper, but a user landing on Elixir or Clojure gets a less mature path than a user landing on Java.

If I started over, I would compress the matrix. Two languages (Java + Python, or Java + Kotlin) and three databases (Postgres, MySQL, Mongo) deep before any breadth growth. "Supports 12 languages" sells better than "supports 2" — but engineering reputation matters more than marketing.

Architecture Snapshot#

22 Gradle modules organized in 4 layers:

  • libs/ — core (engine + IR), security, exceptions, bom (shared dependency catalog).
  • generator/ — cli, codegen, server, ide-plugins.
  • features/ — 13 opt-in packs (graphql, grpc, gateway, chaos, recommendation, analytics, bff, notifications, search, observability, and more).
  • mcp/ — Java + Python MCP servers exposing the engine to AI assistants.
  • Container variants: standard Dockerfile + Dockerfile.native for GraalVM native-image compilation when startup time and memory footprint matter.

The build graph stays clean because the contract is enforced by the shared BOM plus separation of API and implementation modules. No cycles, no shared mutable state across modules.

Loading diagram...
22 módulos en 4 capas. generator/ depende del core+IR; los feature packs se enchufan en codegen sin tocar el core; el BOM gobierna versiones. Sin ciclos.

Tecnologías

Java 25Spring Boot 4GradleOpenAPIGraphQLgRPCDockerKubernetesTerraformMCP

Información

Fuente:Curado
Estado:Destacado

Enlaces

Repositorio de origen

¿Te interesa trabajar conmigo?

Hablemos sobre tu próximo proyecto o conoce más sobre mi experiencia.

ContactarDescargar CV