<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Rami_by</title>
    <description>The latest articles on DEV Community by Rami_by (@ramiby).</description>
    <link>https://dev.to/ramiby</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3667323%2Fbaebc8ad-b46c-464d-88e0-6ea1b5ba2c02.png</url>
      <title>DEV Community: Rami_by</title>
      <link>https://dev.to/ramiby</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ramiby"/>
    <language>en</language>
    <item>
      <title>I built a deterministic Spring Boot 3.5 Generator to fix AI Hallucinations</title>
      <dc:creator>Rami_by</dc:creator>
      <pubDate>Wed, 17 Dec 2025 16:30:06 +0000</pubDate>
      <link>https://dev.to/ramiby/i-built-a-deterministic-spring-boot-35-generator-to-fix-ai-hallucinations-5gn4</link>
      <guid>https://dev.to/ramiby/i-built-a-deterministic-spring-boot-35-generator-to-fix-ai-hallucinations-5gn4</guid>
      <description>&lt;p&gt;We all love coding. But let's be honest: the first 48 hours of a new Spring Boot project are painfully repetitive.&lt;/p&gt;

&lt;p&gt;You set up the pom.xml, configure H2, write the same BaseEntity class, create the Controllers, generic services, and configure Swagger. It’s boring work.&lt;/p&gt;

&lt;p&gt;So, we turn to AI. We ask ChatGPT or Cursor to "scaffold a backend." And it works... sort of.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Problem: The "Vibe Coding" Trap&lt;/strong&gt; AI is great at "vibes" (Frontend, CSS, simple logic). But when you ask an LLM to generate a complex database schema with bidirectional relationships (@OneToMany, @ManyToMany) and circular dependency handling, it often fails.&lt;/p&gt;

&lt;p&gt;It hallucinates imports.&lt;/p&gt;

&lt;p&gt;It misses the mappedBy parameter.&lt;/p&gt;

&lt;p&gt;It generates code that looks right but doesn't compile.&lt;/p&gt;

&lt;p&gt;I realized that LLMs are great for creativity, but terrible for structural rigor.&lt;/p&gt;

&lt;p&gt;So I built a tool called ScaffoldAI to fix this.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The "Sandwich" Architecture 🥪&lt;/strong&gt;&lt;br&gt;
I decided to separate the workflow into three distinct layers, using the right tool for the job:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 1: The Context (AI Power)&lt;/strong&gt; 🧠 Before writing code, you need to know what you are building. I use AI here to act as a "Product Manager." You chat with it to generate a Lean Canvas and Pitch Deck. This isn't just fluffy business stuff—it acts as the "Context Window" for what follows.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F12sbtmgbdrsiu96ogc99.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F12sbtmgbdrsiu96ogc99.png" alt=" " width="800" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 2: The Structure (Visual Control)&lt;/strong&gt; 📐 I didn't want the AI guessing my database schema blindly. I built a hybrid workflow:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;AI Suggestion: The AI analyzes your Lean Canvas and suggests the initial Entities and attributes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Manual Refinement: You take control. You can add, delete, or modify entities and define the relationships explicitly using a visual editor.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Visualization: Finally, you get a static, auto-generated ERD Diagram to verify your entire architecture before a single line of code is written.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc9x4i54j9kjgdk8ep5p3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fc9x4i54j9kjgdk8ep5p3.png" alt=" " width="800" height="408"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbgng4250e7izovvbnr6a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbgng4250e7izovvbnr6a.png" alt=" " width="800" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 3: The Code (Deterministic Algorithms)&lt;/strong&gt; ⚙️ This is the controversial part. I do not use LLMs to generate the final Java code. Once the ERD is validated, I use a deterministic engine to map that JSON structure into a compiling Spring Boot Proof-of-Concept (POC).&lt;/p&gt;

&lt;p&gt;Because it's algorithmic:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It compiles 100% of the time.&lt;/li&gt;
&lt;li&gt;No hallucinated annotations.&lt;/li&gt;
&lt;li&gt;Core relationships are wired up correctly automatically.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The Stack&lt;/strong&gt;&lt;br&gt;
The generated output is a solid architectural foundation to build on:&lt;/p&gt;

&lt;p&gt;Java 21&lt;/p&gt;

&lt;p&gt;Spring Boot 3.5&lt;/p&gt;

&lt;p&gt;H2 Database (configured for dev)&lt;/p&gt;

&lt;p&gt;SpringDoc OpenAPI (Swagger UI)&lt;/p&gt;

&lt;p&gt;Lombok &amp;amp; Jakarta Validation&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo2c6dvxaw4v7vzpuqisj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo2c6dvxaw4v7vzpuqisj.png" alt=" " width="800" height="396"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why "Validation First"?&lt;/strong&gt;&lt;br&gt;
I call this framework &lt;strong&gt;ScaffoldAI&lt;/strong&gt; because, like in construction, you shouldn't pour concrete (write code) until you have scaffolding (validation) in place.&lt;/p&gt;

&lt;p&gt;Too many of us build "ghost town" products. By forcing a Lean Canvas step before the Code Generation step, I'm trying to solve the #1 cause of startup failure: building the wrong thing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Roast My Architecture&lt;/strong&gt; 🔥&lt;br&gt;
I’m currently in Public Beta. I’m looking for experienced Spring Boot developers to stress-test the generated code.&lt;/p&gt;

&lt;p&gt;The goal isn't to replace your job—it's to give you a working, compiling POC in 30 seconds so you can skip the boilerplate and start coding the real business logic.&lt;/p&gt;

&lt;p&gt;Does the architecture hold up?&lt;/p&gt;

&lt;p&gt;Are the relationships handling the FetchType.LAZY correctly?&lt;/p&gt;

&lt;p&gt;You can try it for free (no credit card) and export the code to your IDE.&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;Try ScaffoldAI here&lt;/strong&gt;: &lt;a href="https://scaffoldai.io" rel="noopener noreferrer"&gt;https://scaffoldai.io&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let me know in the comments if you think deterministic code gen is the future, or if LLMs will eventually solve the consistency problem.&lt;/p&gt;

</description>
      <category>java</category>
      <category>springboot</category>
      <category>architecture</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
