Allan Roberto’s Post

I published a write-up about a design decision I care about when adding AI capabilities to backend systems: How to use LangChain4j in a Spring Boot app without letting it take over the architecture. What changed in this project was not just "adding AI support". The bigger improvement was architectural: - the code is now organized by context - use cases stay in the application layer - LangChain4j sits behind clear ports and adapters - PostgreSQL + pgvector still own retrieval - tests were reorganized to match the architecture instead of generic technical layers The project now shows a more realistic RAG-style flow with: - document ingestion through REST - chunking and embedding generation - vector storage in PostgreSQL - hybrid retrieval with vector similarity, full-text search, and metadata filters - prompt building and answer generation through LangChain4j adapters What I like most is that the code did not become framework-shaped. The application core still owns the use cases. The infrastructure stays at the edges. Replacing providers is much closer to a wiring change than a rewrite. That is the lesson I think matters in real projects: Use frameworks as adapters. Do not let them become your architecture. Article: https://lnkd.in/dqf2mcRj Repository: https://lnkd.in/dCC5WPNB #java #springboot #postgresql #pgvector #langchain4j #softwarearchitecture #hexagonalarchitecture #cleanarchitecture #rag #backend

  • graphical user interface, text, application, email

To view or add a comment, sign in

Explore content categories