OrderHub Day 10 — the finale of Phase 1. The API now documents itself (Swagger UI from annotations) and ships as a small, portable Docker image. The monolith is production-ready. 🏁
📘 See the Swagger UI + Docker build: https://dev48v.infy.uk/orderhub/day10-openapi-docker.html
Docs that write themselves
Add springdoc-openapi, annotate the endpoints, and you get a live, interactive Swagger UI + a machine-readable OpenAPI 3 spec for free:
@Tag(name = "Orders")
class OrderController {
@Operation(summary = "Place a new order")
@ApiResponse(responseCode = "201", description = "Created")
@ApiResponse(responseCode = "400", description = "Validation failed")
@PostMapping ...
}
/v3/api-docs = the spec; /swagger-ui.html = the UI. Your frontend can even generate a typed client from that spec, so its types never drift from the backend. (Tip: keep docs enabled in dev, disabled in prod.)
A real Docker image
A multi-stage Dockerfile: stage 1 builds the jar (Maven + JDK 21), stage 2 runs on a slim JRE, copies Spring Boot's layered jar (deps cached separately from your code for fast rebuilds), runs as a non-root user, and binds $PORT. Plus a .dockerignore so the build context stays lean. One image, runs identically on your laptop, CI, or Render.
Phase 1, done
REST → JPA/Postgres → Flyway → validation → error handling → pagination → config → unit/slice tests → integration tests → docs + Docker. A rock-solid monolith. Phase 2 next: Redis caching and resilience.
🔨 Full walkthrough (springdoc annotations → /swagger-ui → multi-stage Dockerfile) on the page: https://dev48v.infy.uk/orderhub/day10-openapi-docker.html
OrderHub — a production-grade Spring Boot backend, one feature a day.
🌐 https://dev48v.infy.uk · Code: https://github.com/dev48v/order-hub-from-zero
Top comments (0)