
Lote — Café Especial
A specialty-coffee store with a full back office: tasting sheets, cart, checkout with card, Pix and boleto, and a CRM panel.
Lote sells single-origin coffees and brewing gear. In the store: listings with faceted filters kept in the URL (origin, roast, process, brew method), full-text search with suggestions, a product page with a tasting sheet (roast curve, SCA score, notes, farm and altitude), an anonymous cart merged at login, coupons, shipping quotes by CEP, a 3-step checkout with card, Pix (QR code) and boleto, orders with cancellation and refund, wishlist, verified-purchase reviews and LGPD tools (data export and account deletion). In the panel (/admin): sales dashboard, products with sensory profile, roast curve, generated variants and image upload straight to storage, inventory, order fulfilment (picking → shipped → delivered, refunds, CSV), a customer CRM (notes, tags, audited contact, blocking), coupons, review moderation, staff with roles and an audit log. I built it end to end — back end, front end and infra — from a written spec with ADRs. Payments are simulated: no real charge ever happens.
A store that never oversells or charges the wrong amount — concurrent checkouts, payment webhooks arriving late or twice, coupons and shipping recalculated on the server — with secure login and domain boundaries that one developer can keep healthy as the code grows.
A modular monolith in Java 25 + Spring Boot 4: Spring Modulith modules with their own Postgres schema and build-verified boundaries, hexagonal architecture inside each one, an event outbox externalized to Kafka, stock reserved with a conditional UPDATE in the order's transaction, idempotent checkout, signed payment webhooks and JWT with rotating refresh tokens. The front end is a React 19 app with types generated from the OpenAPI contract.
281 back-end tests (unit, Testcontainers integration and architecture, with an 85% coverage gate), 51 Playwright E2E tests against the real stack (purchase, account, admin, accessibility with axe in both themes, mobile), a k6 load test with 63 ms p95 on the listing and zero errors — and a public demo you can try.
Want to try it? Sign in to the live store with this user:
cliente@lote.devcafe especial da casaShared customer account — it skips the e-mail code. Simulated payments: card 4242 4242 4242 4242 is approved, 4000 0000 0000 0002 is declined (any future date and CVC); Pix is approved automatically. The free server sleeps when idle, so the first visit can take about a minute.
Modular monolith
A single deploy split into 16 Spring Modulith modules (identity, catalog, inventory, pricing, cart, shipping, ordering, payment, review, wishlist, crm, audit, notification, privacy…). Modules talk only through a public API or events, each owns a Postgres schema with no cross-schema foreign keys, and a boundary violation breaks the build — extracting one into a service later means moving code, not rewriting the domain.
Hexagonal inside each module
domain (plain Java: records, sealed types, the order state machine) → application (use cases and output ports) → adapters (web, JPA, OTP, S3). ArchUnit enforces it: no Spring or JPA in the domain, no adapters in the application layer. Use cases are tested with in-memory fakes in milliseconds.
Events with outbox + Kafka
Domain events are written in the aggregate's transaction to Spring Modulith's Event Publication Registry (outbox) and handled asynchronously by idempotent listeners. Events marked @Externalized go to versioned Kafka topics (lote.orders.v1, lote.catalog.v1) that feed the dashboard projections.
Checkout and stock
Checkout runs in one transaction: stock is reserved with UPDATE … WHERE on_hand − reserved ≥ q, in SKU order to avoid deadlocks, backed by a CHECK constraint. It takes an Idempotency-Key, shipping quotes are HMAC-signed and expire, and the server recomputes the total. Unpaid reservations expire after 15 min via a ShedLock job; every pair of order-state transitions is covered by a parameterized test.
Payments behind a port
The payment module depends only on a PaymentGateway port. Today's adapter talks to a simulated PSP (its own module and schema) that tokenizes test cards, issues Pix and boleto and sends HMAC-signed webhooks through an outbox. Switching to Stripe or Mercado Pago means writing a new adapter.
Authentication and security
ES256 JWT access tokens (15 min, kept only in memory) plus an opaque refresh token rotated on every use in a __Host- HttpOnly, SameSite=Strict cookie; reusing a rotated token revokes the whole session family, and a Redis denylist makes revocation immediate. New devices and the admin panel require an e-mail code from my Go OTP-Service (Resilience4j: timeout, retry, circuit breaker). Bucket4j + Redis rate limiting with hashed keys, OWASP HTML sanitizer, strict CSP in Nginx.
Search
Full-text search and facets in Postgres (tsvector with unaccent and the portuguese config, GIN index) plus pg_trgm for suggestions, behind a SearchPort — swapping in OpenSearch later is just another adapter.
Front end
React 19, strict TypeScript 6 and Vite 8, organized with Feature-Sliced Design; types generated from the OpenAPI contract (openapi-typescript + openapi-fetch); TanStack Query, Table and Virtual; React Hook Form + Zod; Radix UI; Recharts; dnd-kit. A Tailwind v4 design system with light and dark ("dark roast") themes, and the admin panel lazy-loaded.
Infra and quality
Docker Compose for local dev (Postgres 18, Redis, Kafka in KRaft mode, SeaweedFS as S3, Mailpit, OTP-Service), Flyway migrations, Prometheus business metrics, an OpenAPI contract with 97 operations, GitHub Actions CI and a free demo on Vercel (front end) + Render (API, OTP, Postgres, Redis).







