<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Meherwer Ali on Medium]]></title>
        <description><![CDATA[Stories by Meherwer Ali on Medium]]></description>
        <link>https://medium.com/@meherwer_ali?source=rss-a60c600ee073------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*vOWtlkiR7RwHtWdmnj0Dyw.jpeg</url>
            <title>Stories by Meherwer Ali on Medium</title>
            <link>https://medium.com/@meherwer_ali?source=rss-a60c600ee073------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 12:34:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@meherwer_ali/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Stop Losing Context. How We Used Obsidian to Automate Knowledge Sharing Across Our Entire Team]]></title>
            <link>https://medium.com/@meherwer_ali/stop-losing-context-how-we-used-obsidian-to-automate-knowledge-sharing-across-our-entire-team-887c7652629c?source=rss-a60c600ee073------2</link>
            <guid isPermaLink="false">https://medium.com/p/887c7652629c</guid>
            <category><![CDATA[ai-agents-in-action]]></category>
            <category><![CDATA[xcode]]></category>
            <category><![CDATA[workflow-automation]]></category>
            <category><![CDATA[obsidian]]></category>
            <category><![CDATA[claude-code]]></category>
            <dc:creator><![CDATA[Meherwer Ali]]></dc:creator>
            <pubDate>Thu, 30 Apr 2026 06:01:01 GMT</pubDate>
            <atom:updated>2026-04-30T06:01:01.403Z</atom:updated>
            <content:encoded><![CDATA[<p><em>How we used Obsidian, Git, Infisical, and local agent tooling to turn a personal markdown workflow into a shared system for project knowledge, skills, MCPs, and team sync.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iOcEshe7qckgAf2TKEZ_rA.png" /></figure><p>When Andrej Karpathy described his Obsidian-based “RAG without RAG” workflow, the strongest part of the idea wasn’t that it avoided vector databases. It was that the whole system stayed readable.</p><p>The raw inputs were markdown. The compiled outputs were markdown. The navigation layer was markdown. The frontend was Obsidian. The LLM wasn’t hidden behind a retrieval black box — it was working directly on a structure a human could inspect.</p><p>That makes immediate sense for a solo operator. But the more interesting question came right after that:</p><p><strong>What happens when you try to make that model work for a team?</strong></p><p>Not one person managing a private knowledge vault. Four people, multiple repos, shared skills, shared MCPs, shared project context, and a hard requirement that everything stays usable from local clones without every teammate hand-rebuilding their environment.</p><p>That’s where the Obsidian idea stops being a note-taking trick and starts becoming infrastructure.</p><h3>Karpathy Solved One Problem. Teams Have Another One.</h3><p>Karpathy’s setup makes a strong claim: at human scale, well-structured markdown plus a capable LLM can do much of what people usually reach for RAG to do.</p><p>That part is compelling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/445/1*avhVaXvG9Upi_HIK3ZSA7g.png" /></figure><p>But small teams run into a second class of problems that classic RAG never really addresses:</p><ul><li>How does everyone get the same local tool stack?</li><li>Where do shared MCP definitions live?</li><li>How do secrets stay centralized without ending up hardcoded in Git?</li><li>How do project knowledge bases stay current as repos change?</li><li>How do you stop every teammate from inventing their own local workflow?</li></ul><p>Once those become the real constraints, the problem is no longer just retrieval. It becomes <strong>knowledge operations plus runtime distribution</strong>.</p><p>That shift shaped everything about our implementation.</p><h3>We Split the System Into Two Repos</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*vnXHBQXiuVpoxgrKLyKEuQ.png" /></figure><p>The final architecture is simple but deliberately split.</p><h3>obsidian-vault — the knowledge layer</h3><p>This repo holds the team’s shared knowledge:</p><ul><li>project knowledge bases.</li><li>skill documentation for Claude Code and Codex.</li><li>navigation pages, indexes, and breadcrumbs.</li><li>onboarding prompts and teammate handoff docs.</li><li>sync skills that refresh project snapshots and vault metadata.</li></ul><p>The structure still follows the spirit of Karpathy’s model — raw/ for staged source material, wiki/ for compiled interlinked knowledge, and index pages so the LLM can orient itself cheaply before reading deeper.</p><p>But we pushed the vault well beyond article synthesis. It became the canonical place for project overviews, repo links, deployment references, status snapshots, skill catalogs, and operating instructions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/484/1*2zQTRP-NPtJse-Ng7Yaymw.png" /></figure><p>In practice, it became the team’s searchable memory.</p><h3>plugins-marketplace — the runtime layer</h3><p>The second repo exists for a different reason: making sure everyone’s machine can actually run the shared setup. It holds shared MCP plugin definitions, shared skills, setup and sync scripts, and local config sync logic for Claude Code and Codex.</p><p>This distinction matters. A vault can tell your team how the environment works. It cannot, by itself, make the environment converge on every machine.</p><p>We needed something stronger: clone the repo, run setup once, and let the machine sync toward the shared team state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/445/1*IYrNqkGbeWZmNcGhiauiqg.png" /></figure><p>That’s why the marketplace repo exists.</p><h3>The Most Important Design Choice Was the Separation</h3><p>This ended up being the key systems decision.</p><p>If everything lives in the vault, documentation and runtime configuration get tangled together — the vault gets less clean and the runtime story becomes unreliable. If everything lives in the plugin repo, you lose the clarity and navigability that made the Obsidian model attractive in the first place.</p><p>So we made the split explicit:</p><ul><li>obsidian-vault explains, indexes, and preserves team knowledge</li><li>plugins-marketplace distributes runnable capability</li></ul><p>That removes a lot of ambiguity. When someone asks <em>“how do I understand the current shape of this project?”</em> the answer points to the vault. When they ask <em>“how do I get the shared MCPs and skills onto my machine?”</em> the answer points to the marketplace.</p><p>The system becomes easier to reason about because each repo has a clear job.</p><h3>Secrets Were the Real Constraint</h3><p>The hardest problem in the project was not markdown. It was secrets.</p><p>We wanted everyone to use the same MCPs without storing credentials in Git or asking every teammate to hand-edit local config blocks. So we used <strong>Infisical as the secret source of truth</strong>.</p><p>The model is intentionally narrow:</p><ul><li>shared definitions live in Git</li><li>real secret values live in Infisical</li><li>each teammate only stores bootstrap Infisical credentials in a repo-local .env</li></ul><p>From there, the marketplace sync resolves the required values and writes the managed MCP configuration into Claude Code and Codex.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*VxFSdD8gbAUL6iN8jfxzRg.png" /></figure><p>That gave us a much more realistic team setup: one shared runtime spec, centralized secret ownership, and local machine bootstrap without copy-pasting secrets everywhere.</p><p>This is where the project got more interesting than “Obsidian can replace embeddings.” Because if your team cannot reproduce the runtime environment, the knowledge base might be accurate, but it’s operationally weak.</p><h3>The Vault Could Not Stay Static</h3><p>The next problem was drift.</p><p>Knowledge bases decay when they depend on humans remembering to keep them current. So we pushed the system toward derived state instead of manually maintained state, and added two sync paths.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/385/1*tAa1nKpqUkdULGjRV4IAJg.png" /></figure><p><strong>project-vault-sync</strong> updates local repos, reads the registered project list, and refreshes the vault&#39;s project KB artifacts — structure and status pages, repo links, source profiles.</p><p><strong>vault-skills-sync</strong> is the higher-level vault maintenance flow. It pulls the latest vault changes, refreshes project KB pages, regenerates skill inventories and catalogs, stages the updated docs, and commits and pushes when the result is clean and fast-forward safe.</p><p>That changed the vault from a passive notebook into a maintained system. The rule behind it was simple:</p><blockquote>If the source of truth can be derived, derive it. Don’t ask a team to manually type what a script can reliably extract.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*XD91xS21qKfs3OZeT6Njcw.png" /></figure><h3>We Had to Build Beyond One Laptop</h3><p>It is very easy to build a “team system” that really only works on one machine. We had to remove that bias.</p><p>That meant repo-relative verification commands instead of absolute local paths, Windows setup support not just shell scripts, scheduler installation that works beyond one Unix laptop, copy fallback when symlinks are blocked on Windows, and onboarding docs that describe a generic model rather than one engineer’s filesystem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*qA6N1FC6q8tcAtFKPzMprA.png" /></figure><p>This is less glamorous than the Obsidian-versus-RAG discussion, but it’s the part that determines whether the workflow survives real use. Most writeups stop before this layer. That’s exactly where the important engineering starts.</p><h3>The Smallest Useful Addition Was a Handoff File</h3><p>One of the most useful artifacts in the project is also one of the simplest: a single teammate handoff file named initiate.md.</p><p>After both repos are cloned and local setup is complete, that file gets handed to Codex or Claude as the operating brief. Its job is to compress the model into one place: which repo is the runtime layer, which repo is the knowledge layer, what to inspect first, what the sync chain is, how to verify local health, and which rules should not be violated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/431/1*1owPYStWEbw68-mD4O3Fyw.png" /></figure><p>Instead of re-teaching the agent the environment every session, the team now has a standard machine-readable handoff. That’s the kind of small systems decision that makes the rest of the stack more durable.</p><h3>What This Changed About My View of RAG</h3><p>Before building this, it was easy to think of RAG mainly as a retrieval problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*SKqD6ZwCnAl8G1jL4j39Zg.png" /></figure><p>After building this, the more important issue for small teams is usually <strong>knowledge operations</strong>:</p><ul><li>Where does information enter the system?</li><li>What gets promoted from raw to trusted?</li><li>How do updates propagate?</li><li>Which artifacts are human-maintained versus machine-maintained?</li><li>Where does local machine state leak into team state?</li></ul><p>Karpathy’s Obsidian approach is powerful because it simplifies retrieval. But when you operationalize it for a team, the bigger leverage comes from something broader — making the system inspectable, reproducible, and synchronized.</p><p>That’s what most small teams actually need. Not a vector database first. Not a complicated graph retrieval layer first.</p><p>They need a system where knowledge is easy to browse, runtime capabilities are easy to distribute, secrets are centrally managed, and context does not collapse into tribal knowledge.</p><h3>The Gaps Are Real, but They Are the Right Kind of Gaps</h3><p>The system is useful, but not perfect. There are still real issues:</p><ul><li>some MCP flows still depend on local tool config behavior</li><li>shared vault skills still assume each teammate has a local vault checkout</li><li>copied skills on Windows only refresh on the next sync, unlike symlinks</li><li>one canonical runner is still the safest model for automated vault commits</li></ul><p>Those are meaningful issues. But they are implementation-hardening problems, not signs that the overall shape is wrong. If the remaining work is operational polish rather than architectural rescue, you’re usually on the right track.</p><h3>The Main Lesson</h3><p>Karpathy’s original insight was that modern LLMs are good enough at navigating structured markdown that a lot of “RAG infrastructure” is unnecessary.</p><p>Our extension of that idea:</p><blockquote>Once the markdown vault becomes the center of team knowledge, distribution, sync, and secrets need to become first-class parts of the design.</blockquote><p>That’s when the system stops being a clever personal workflow and becomes a real team operating layer.</p><p>Obsidian was not the final product. It was the readable core around which we built a team environment.</p><p>For small teams, that’s the more interesting opportunity — not just avoiding vector databases, but using a plain-text, LLM-native system as the center of both knowledge and execution, while keeping the whole thing understandable enough that humans still trust it.</p><h3>The Stack, Summarized</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*FsBCKGvvlCxLCeChLRE33Q.png" /></figure><p>For solo users, Karpathy’s Obsidian model is already compelling. For small teams, extend it:</p><ul><li><strong>Obsidian</strong> for shared knowledge</li><li><strong>Git</strong> for shared state</li><li><strong>plugins-marketplace</strong> for shared runtime distribution</li><li><strong>Infisical</strong> for secrets</li><li><strong>Scheduled sync</strong> to reduce drift</li><li><strong>initiate.md</strong> so Claude Code and Codex start from the same assumptions</li></ul><p>Still lightweight. Still legible. And unlike a lot of heavyweight “AI knowledge” architecture, it stays close to the way teams already work.</p><p>It doesn’t just help an LLM answer questions about documents. It helps a team keep its tools, knowledge, and context aligned.</p><p><em>This post is a follow-up to </em><a href="https://medium.com/@meherwer_ali/forget-vector-databases-andrej-karpathys-obsidian-setup-is-the-rag-system-you-actually-need-6934ad938435"><em>Forget Vector Databases — Andrej Karpathy’s Obsidian Setup Is the RAG System You Actually Need</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=887c7652629c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Forget Vector Databases — Andrej Karpathy’s Obsidian Setup Is the RAG System You Actually Need]]></title>
            <link>https://medium.com/@meherwer_ali/forget-vector-databases-andrej-karpathys-obsidian-setup-is-the-rag-system-you-actually-need-6934ad938435?source=rss-a60c600ee073------2</link>
            <guid isPermaLink="false">https://medium.com/p/6934ad938435</guid>
            <category><![CDATA[applied-ai]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[obsidian]]></category>
            <category><![CDATA[rags]]></category>
            <category><![CDATA[knowledge-base]]></category>
            <dc:creator><![CDATA[Meherwer Ali]]></dc:creator>
            <pubDate>Mon, 27 Apr 2026 13:19:33 GMT</pubDate>
            <atom:updated>2026-04-27T13:19:33.379Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*G0Ma45zxIn7NOeLTFacOnQ.png" /></figure><p><em>A lightweight, nearly-free knowledge base that punches well above its weight</em></p><p><em>Modern LLMs navigating a structured markdown vault can replace an entire RAG stack — at least at human scale.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HqAqV-C2Ck1ULMnfkV0bMg.png" /></figure><p>There’s a quiet assumption baked into most RAG tutorials: that you need a vector database, embeddings pipelines, chunking strategies, and a retrieval layer before you can give an LLM meaningful access to a large document collection. Andrej Karpathy just proved that assumption wrong — and he did it with a markdown editor.</p><p>In a recent post on X, Karpathy laid out his personal knowledge base built entirely on <a href="https://obsidian.md/">Obsidian</a>. No embeddings. No vector store. No retrieval pipeline. Just a clever file structure, a disciplined ingestion workflow, and an LLM doing what it does best: reading and reasoning over well-organized text.</p><p>The result? A system that handles the exact same problem RAG was designed to solve — letting an LLM navigate and surface accurate information from large document collections — with a fraction of the complexity. And according to Karpathy, a large fraction of his recent token throughput has shifted <em>away</em> from code manipulation and toward this kind of knowledge manipulation.</p><h3>What Problem Are We Actually Solving?</h3><p>LLMs have finite context windows. If you want a model to answer questions about 500 documents, you can’t just paste them all in. Traditional RAG gets around this by:</p><ol><li>Chunking documents into small pieces</li><li>Converting those chunks into vector embeddings</li><li>Storing them in a vector database</li><li>At query time, retrieving the most semantically relevant chunks and injecting them into the prompt</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fFqNDvexxi2pnyG8-F2d1g.png" /></figure><p><em>The traditional RAG stack: powerful, but loaded with infrastructure overhead most teams don’t actually need.</em></p><p>It works. But it comes with real overhead: infrastructure to stand up, embeddings to generate and maintain, retrieval quality to tune, and a layer of abstraction that makes the whole system feel like a black box.</p><p>Karpathy’s insight is that <em>well-structured markdown files with auto-maintained indexes are already a form of retrieval</em> — and modern LLMs are good enough at navigating them that you can skip most of that stack, at least at reasonable scales.</p><h3>The Architecture: Deceptively Simple</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*-ijMgZOUxfFFmuLEwWaQ8w.png" /></figure><p>The entire system lives inside an Obsidian vault. Here’s how it breaks down:</p><p><em>Obsidian’s graph view makes the knowledge structure visible — every node is a wiki article, every edge a backlink.</em></p><h3>/raw — The Staging Area</h3><p>Everything coming in from the outside world lands here first. Articles, research papers, GitHub repos, datasets, images — anything you want to eventually “compile” into a wiki entry. Think of it as your inbox. Karpathy uses the <strong>Obsidian Web Clipper</strong> extension to convert web articles into .md files automatically, plus a hotkey to download all related images to local so the LLM can reference them directly.</p><h3>/wiki — The Compiled Knowledge Base</h3><p>This is where the LLM-generated wiki entries live, organized by topic. The LLM doesn’t just dump summaries here — it categorizes data into concepts, writes articles for each concept, links them together, and maintains backlinks. Karpathy is explicit on this point: <strong>the LLM writes and maintains all the wiki data. He rarely touches it directly.</strong></p><p>At his current scale, one of his wikis has grown to roughly <strong>100 articles and ~400K words</strong> — and it’s still navigable without vector retrieval.</p><h3>Index Files — The Navigation Layer</h3><p>Rather than a single master index, each wiki directory maintains its own index and summary files, kept up-to-date by the LLM as new content gets compiled in. This is what makes Q&amp;A cheap: the model doesn’t scan every file cold. It reads the index, orients itself, then pulls only what’s relevant.</p><h3>Obsidian — The IDE Frontend</h3><p>Obsidian serves as the human-facing UI for the entire system. You can browse raw data, read compiled wiki articles, view generated visualizations, and watch the LLM’s output render in real time. Karpathy has experimented with plugins like <strong>Marp</strong> (for rendering wiki content as slideshows) to get different views into the same underlying data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*LKw7GGWX04TlHSvFmEsU4g.png" /></figure><h3>The Full Lifecycle: From Raw Data to Insight</h3><p>What makes this more than just “a folder of markdown files” is the complete lifecycle Karpathy describes:</p><p><em>The lifecycle isn’t linear — it’s a compounding loop. Every output feeds back in as new input.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/385/1*XrNQTPZp-neuHfKa4Wwsbw.png" /></figure><h3>1. Ingest</h3><p>Source documents land in raw/ via web clipper, manual addition, or LLM-assisted research. Images are downloaded locally so the model can actually see them.</p><h3>2. Compile</h3><p>The LLM incrementally processes raw/ into the wiki — writing articles, categorizing concepts, creating backlinks, and building index files. This is an <em>incremental</em> process; you don&#39;t recompile everything every time. New raw data gets folded in on demand.</p><h3>3. Query</h3><p>Ask the LLM complex, open-ended questions against the wiki. It navigates the index structure, reads the relevant articles, and produces answers. Crucially, Karpathy notes he expected to need “fancy RAG” here — but the LLM’s ability to auto-maintain indexes meant standard context-window reasoning was sufficient.</p><h3>4. Output</h3><p>Answers don’t just come back as terminal text. Karpathy has the LLM render outputs as markdown files, Marp slideshows, or matplotlib images — all viewable directly in Obsidian. The key move: <strong>he files these outputs back into the wiki</strong>, so every query enriches the knowledge base for future queries. Your own explorations always add up.</p><h3>5. Lint</h3><p>Periodically, he runs LLM “health checks” over the wiki to find inconsistent data, impute missing information via web search, and identify interesting connections that warrant new article candidates. The LLMs are, in his words, “quite good at suggesting further questions to ask and look into.”</p><h3>6. Extend with Tools</h3><p>As the system grows, Karpathy has vibe-coded additional tooling — including a small, naive search engine over the wiki with a web UI. He uses it directly, but more often hands it off to an LLM via CLI as a tool for larger queries. The system is extensible by design; it’s not a closed product, it’s a composable workflow.</p><h3>The Finetuning Horizon</h3><p>One detail from Karpathy’s post that most coverage misses: as the wiki grows, the natural next step is <strong>synthetic data generation + finetuning</strong>. The idea is to eventually have an LLM “know” the contents of the wiki in its <em>weights</em> rather than just its context window — shifting from retrieval-augmented generation to genuine parametric knowledge for your specific domain.</p><p><em>The ceiling of this approach: finetuning the LLM on your wiki so the knowledge lives in weights, not just context.</em></p><p>This is speculative territory for most practitioners right now, but it signals where the ceiling of this approach eventually is, and what comes after it.</p><h3>So… Do You Need Real RAG?</h3><p>Honest answer: probably not, if you’re a solo operator or a small team.</p><p><strong>The case for sticking with Obsidian:</strong></p><ul><li>Zero infrastructure cost — no vector DB to host or maintain</li><li>Human-readable — your entire knowledge base is browsable in Obsidian; nothing is locked in an opaque embedding space</li><li>Self-improving — every query and output can be filed back in, making the system smarter over time</li><li>Genuinely competitive at this scale — 100 articles, 400K words, still working without vector retrieval</li></ul><p><strong>The case for graduating to real RAG:</strong></p><ul><li>You’re dealing with tens of thousands of documents or more</li><li>You need sub-second retrieval at query time</li><li>Your use case requires semantic similarity search that goes beyond what a structured index provides</li><li>You’re building a production system with multiple users and SLA requirements</li></ul><p>The practical advice: start with Obsidian. You’ll know when you’ve hit the ceiling — the model will start struggling to navigate the vault and token costs will get unreasonable. That’s your signal to migrate to something like LightRAG. No need to solve that problem before it exists.</p><h3>Why This Works Better Than You’d Expect</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XMhANRHlvycWmA93LUiSIw.png" /></figure><p><em>Obsidian’s wiki-link syntax creates the same navigable graph that RAG systems build artificially — except yours is human-readable.</em></p><p><strong>Markdown with backlinks is already a knowledge graph.</strong> When the LLM generates wiki entries, it links related articles using Obsidian’s syntax. This creates a traversable graph — the same structure that tools like Light RAG build artificially using embeddings. Here it emerges naturally from the compilation process.</p><p><strong>Auto-maintained indexes do the retrieval work.</strong> Traditional RAG uses vector similarity to decide what’s relevant. Here, the LLM maintains index files that summarize and categorize everything. At the scales Karpathy describes, this is genuinely sufficient — and far more interpretable.</p><p><strong>Outputs that feed back in change the economics.</strong> In a traditional RAG system, queries are stateless. Here, every useful output gets filed into the wiki and becomes part of the knowledge base. The system compounds. After enough queries, the wiki becomes a higher-quality artifact than the raw sources it was compiled from.</p><p><strong>The LLM is the retrieval layer.</strong> There’s no separate retrieval component because the LLM navigates indexes, follows links, and synthesizes answers in a single pass. This only works because modern LLMs are genuinely good at navigating well-structured text — something that wasn’t true even two years ago.</p><h3>The Product Gap</h3><p>Karpathy closes his post with an observation worth sitting with:</p><blockquote>“I think there is room here for an incredible new product instead of a hacky collection of scripts.”</blockquote><p>He’s right. What he’s describing is essentially a personal research operating system — and right now it requires stitching together Obsidian, a web clipper extension, a handful of community plugins, custom CLI tools, and an LLM agent. It works, but it’s not a product.</p><p><em>The product Karpathy is describing doesn’t exist yet. It will.</em></p><p>The primitives are all here. The workflow is proven. Someone is going to build the clean version of this, and when they do, it’ll be one of the more useful developer tools of the decade.</p><p>For now, you can build it yourself. And honestly, for most use cases, the hacky collection of scripts is fine.</p><h3>The Bottom Line</h3><p>Karpathy’s Obsidian setup isn’t a workaround. It’s a thoughtfully designed knowledge management system that uses the LLM as the primary actor — ingesting, compiling, querying, outputting, and linting — with Obsidian as the human-facing interface and markdown as the universal format.</p><p>The broader lesson: the “boring” solution often outperforms the sophisticated one when it removes complexity rather than adding it. We’ve been defaulting to RAG in cases where it isn’t strictly necessary, because RAG was the only mental model we had.</p><p>Now we have another one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*bLxfDi_WJDYR1fsRQihAEg.png" /></figure><p><em>Based on Andrej Karpathy’s post on X: </em><a href="https://x.com/karpathy/status/2040470801506541998?s=20"><em>“LLM Knowledge Bases”</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6934ad938435" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying Kubernetes on Bare-Metal Servers: A Comprehensive Guide]]></title>
            <link>https://medium.com/@meherwer_ali/deploying-kubernetes-on-bare-metal-servers-a-comprehensive-guide-8b40f61bd2aa?source=rss-a60c600ee073------2</link>
            <guid isPermaLink="false">https://medium.com/p/8b40f61bd2aa</guid>
            <category><![CDATA[san-storage]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[beginners-guide]]></category>
            <category><![CDATA[baremetal]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Meherwer Ali]]></dc:creator>
            <pubDate>Wed, 16 Oct 2024 16:40:04 GMT</pubDate>
            <atom:updated>2025-10-15T10:45:27.024Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XTpIiEpkEmaxqCVNs0-Lag.png" /></figure><p>Deploying Kubernetes on bare-metal servers offers several advantages, including enhanced performance, better control over hardware resources, and flexibility in network and storage configuration. While most Kubernetes clusters are set up in cloud environments, deploying on bare-metal provides complete control over the underlying infrastructure. In this blog, we’ll walk through the process of setting up a multi-node Kubernetes cluster on bare-metal servers.</p><p>Kubernetes is the dominant container orchestration tool, with around 92% of the market share. When setting up Kubernetes, you can choose between virtual machine (VM)-based deployments or bare-metal setups. Bare-metal Kubernetes offers direct access to hardware and is preferred for performance-critical and latency-sensitive applications.</p><h3>What is Bare-Metal Kubernetes?</h3><p>In bare-metal Kubernetes, clusters and containers run directly on physical servers, bypassing the virtual machines that are typically used in cloud-based setups. This allows containers to interact directly with the hardware, leading to enhanced performance and reduced latency compared to VM-based deployments.</p><h3>How Does It Work?</h3><p>By eliminating the hypervisor layer, bare-metal Kubernetes grants applications direct access to computing resources. This direct interaction improves performance and can reduce network latency by up to three times. It’s ideal for workloads that require high performance or low latency, such as high-frequency trading, real-time analytics, or gaming.</p><h3>Key Features:</h3><ul><li><strong>Direct hardware access</strong>: Containers run directly on the server hardware without virtualization layers.</li><li><strong>No hypervisor</strong>: Unlike VM-based setups, bare-metal Kubernetes does not rely on a hypervisor to manage virtual machines.</li></ul><h3>Use Cases:</h3><ul><li><strong>Performance-critical applications</strong>: High-frequency trading, real-time analytics, scientific computing.</li><li><strong>Latency-sensitive workloads</strong>: Online gaming, telecommunications.</li><li><strong>Resource-intensive workloads</strong>: Applications needing direct access to hardware, like GPU-accelerated tasks.</li></ul><h3>Benefits:</h3><ul><li><strong>Optimized performance</strong>: Direct access to hardware boosts performance by avoiding the overhead of virtualization.</li><li><strong>Reduced latency</strong>: Network latency is cut by up to three times, crucial for applications needing real-time responsiveness.</li><li><strong>Cost savings</strong>: Using existing on-premise infrastructure reduces migration and hypervisor overhead costs.</li><li><strong>Enhanced control</strong>: Organizations have full control over hardware configurations, improving reliability and customization.</li><li><strong>Effective load balancing</strong>: Load balancers like MetalLB ensure efficient traffic distribution in bare-metal environments.</li></ul><h3>Challenges:</h3><ul><li><strong>Complex setup</strong>: Configuring bare-metal servers individually can be more challenging than using VM images.</li><li><strong>Backup and migration difficulties</strong>: Without virtualization, backups and migrations are more complex.</li><li><strong>Node failure risk</strong>: If a bare-metal node fails, all containers on it are impacted, unlike isolated VMs.</li><li><strong>Operational complexity</strong>: Managing Kubernetes without a hypervisor requires significant expertise and time.</li><li><strong>Implementing best practices</strong>: Bare-metal deployments demand deep knowledge of both Kubernetes and hardware to ensure security and performance.</li></ul><h3>How to Deploy Kubernetes on Bare-Metal:</h3><h4>Prerequisites:</h4><ul><li>Two or more Ubuntu 18.04 servers.</li><li>Sudo or root privileges on each server.</li><li>The apt package manager.</li><li>Command-line access using tools like <strong>kubectl</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9nBJTs9wNwbQyPlBePmAgg.png" /><figcaption>K8s design</figcaption></figure><p>By understanding the setup, benefits, and challenges of bare-metal Kubernetes, you can determine if it’s the right choice for your performance-critical applications.</p><h3>Setting Up Kubernetes on Bare-Metal</h3><p>Let’s walk through how to set up Kubernetes on two master nodes (se01 and se02) and attach worker nodes to form a cluster.</p><h3>Step 1: Prepare the Master Nodes (se01)</h3><h4>1.1 Basic Setup</h4><p>We begin by configuring the master nodes. This includes updating the operating system, setting hostnames, disabling swap memory, and enabling required kernel modules.</p><p><strong>Master Node (</strong><strong>se01) Setup:</strong></p><pre># Update the system and reboot<br>sudo apt update &amp;&amp; sudo apt upgrade -y<br>sudo reboot<br><br># Set the hostname for the master node<br>sudo hostnamectl set-hostname &quot;k8s-master-se01.local&quot;<br><br># Edit /etc/hosts to map IPs to hostnames<br>sudo nano /etc/hosts</pre><blockquote>In the /etc/hosts file, add entries for all your master and worker nodes:</blockquote><pre>172.18.18.11 k8s-master-se01.local k8s-master-se01<br>172.18.18.12 k8s-worker-se02.local k8s-worker-se02<br># Add other nodes as required...</pre><h4>1.2 Disable Swap</h4><blockquote>Kubernetes does not support running on nodes with swap enabled. We need to disable swap to avoid potential issues:</blockquote><pre>sudo swapoff -a</pre><blockquote># Ensure swap is disabled permanently by commenting out the swap line in /etc/fstab</blockquote><pre>sudo nano /etc/fstab</pre><h4>1.3 Enable Kernel Modules for Kubernetes Networking</h4><blockquote>Kubernetes requires certain kernel modules to be loaded:</blockquote><pre># Create containerd and Kubernetes conf files for required modules<br>sudo tee /etc/modules-load.d/containerd.conf &lt;&lt;EOF<br>overlay<br>br_netfilter<br>EOF</pre><pre>sudo modprobe overlay<br>sudo modprobe br_netfilter<br># Set up sysctl parameters for networking<br>sudo tee /etc/sysctl.d/kubernetes.conf &lt;&lt;EOF<br>net.bridge.bridge-nf-call-ip6tables = 1<br>net.bridge.bridge-nf-call-iptables = 1<br>net.ipv4.ip_forward = 1<br>EOF<br>sudo sysctl --system</pre><h4>1.4 Install Containerd and Kubernetes Components</h4><blockquote>We will install containerd as the container runtime and the required Kubernetes components (kubelet, kubeadm, kubectl).</blockquote><pre># Install containerd<br>sudo apt update<br>sudo apt install -y apt-transport-https ca-certificates curl software-properties-common<br>curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg<br>echo &quot;deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable&quot; | sudo tee /etc/apt/sources.list.d/docker.list &gt; /dev/null<br>sudo apt update<br>sudo apt install -y containerd.io<br><br># Configure containerd<br>containerd config default | sudo tee /etc/containerd/config.toml &gt;/dev/null 2&gt;&amp;1<br>sudo sed -i &#39;s/SystemdCgroup \= false/SystemdCgroup \= true/g&#39; /etc/containerd/config.toml<br>sudo systemctl restart containerd<br># Install Kubernetes components<br>curl -fsSL https://prod-cdn.packages.k8s.io/repositories/isv:/kubernetes:/core:/stable:/v1.30/deb/Release.key | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/k8s.gpg<br>echo &quot;deb [signed-by=/etc/apt/trusted.gpg.d/k8s.gpg] https://prod-cdn.packages.k8s.io/repositories/isv:/kubernetes:/core:/stable:/v1.30/deb/ /&quot; | sudo tee /etc/apt/sources.list.d/kubernetes.list<br>sudo apt update<br>sudo apt install -y kubelet kubeadm kubectl<br>sudo apt-mark hold kubelet kubeadm kubectl</pre><h3>Step 2: Initialize the Kubernetes Master Node</h3><blockquote>With the master node set up, we can now initialize Kubernetes using kubeadm</blockquote><blockquote>Initialize Kubernetes on the master node</blockquote><pre>sudo kubeadm init --control-plane-endpoint k8s-master-se01.local --pod-network-cidr 10.244.0.0/16 --service-cidr 10.96.0.0/12 --upload-certs</pre><blockquote>After successful initialization you will see an output like this:</blockquote><pre>To start using your cluster, you need to run the following as a regular user:<br>mkdir -p $HOME/.kube<br> sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config<br> sudo chown $(id -u):$(id -g) $HOME/.kube/config<br>Alternatively, if you are the root user, you can run:<br>export KUBECONFIG=/etc/kubernetes/admin.conf<br>You should now deploy a pod network to the cluster.<br>Run &quot;kubectl apply -f [podnetwork].yaml&quot; with one of the options listed at:<br> https://kubernetes.io/docs/concepts/cluster-administration/addons/<br>You can now join any number of the control-plane node running the following command on each as root:<br>sudo kubeadm join k8s-master-se01.local:6443 - token &lt;token&gt; - discovery-token-ca-cert-hash &lt;ca-cert-hash-key&gt;<br> - control-plane - certificate-key &lt;certificate-key&gt;<br>Please note that the certificate-key gives access to cluster sensitive data, keep it secret!<br>As a safeguard, uploaded-certs will be deleted in two hours; If necessary, you can use<br>&quot;sudo kubeadm init phase upload-certs - upload-certs&quot; to reload certs afterward.<br>Then you can join any number of worker nodes by running the following on each as root:<br>sudo kubeadm join k8s-master-se01.local:6443 - token &lt;token&gt;<br> - discovery-token-ca-cert-hash &lt;cert-hash-key&gt;</pre><blockquote>Use certificate that comes out as output if certificates have expired.</blockquote><pre>sudo kubeadm init phase upload-certs --upload-certs</pre><blockquote>get the join command, this join command will be useful for joining master and worker nodes to our already initialized master-node.</blockquote><pre>sudo kubeadm token create - print-join-command</pre><blockquote>It will look something like this:</blockquote><pre>sudo kubeadm join k8s-master-se01.local:6443 - token &lt;token&gt;<br> - discovery-token-ca-cert-hash &lt;cert-hash-key&gt;</pre><blockquote>After the initialization, you need to configure kubectl for your user:</blockquote><pre># Set up kubeconfig for the current user<br>mkdir -p $HOME/.kube<br>sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config<br>sudo chown $(id -u):$(id -g) $HOME/.kube/config</pre><h3>Step3: deploy a pod network to the cluster. In this case, we’ll use Flannel.</h3><h4>3.1 Why Use Flannel?</h4><p>Flannel is a popular networking solution for Kubernetes that provides an easy and reliable way to create a flat, virtual network on top of your physical network infrastructure. It allows pods within the Kubernetes cluster to communicate with each other, regardless of which node they are running on. This is essential for containerized workloads, which may span across multiple nodes in a distributed environment.</p><h4>3.2 How Does Flannel Work?</h4><p>Flannel works by configuring an overlay network, where each node in the Kubernetes cluster gets a unique subnet and IP range. It encapsulates the traffic between pods and ensures that they can communicate seamlessly across the entire cluster, even across different hosts.</p><p>Flannel relies on the <strong>etcd</strong> key-value store for configuration data and uses the <strong>VXLAN</strong> network protocol by default to create the overlay.</p><h4>3.3 Deploying Flannel as the Pod Network</h4><p>Once Kubernetes is set up, you need to install a pod network to allow communication between your pods. Flannel is a simple choice because of its ease of deployment and its performance in small to medium-sized clusters.</p><blockquote>Here’s the command to deploy Flannel:</blockquote><pre>kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml</pre><blockquote>This command applies a YAML configuration that deploys Flannel across all nodes in the Kubernetes cluster.</blockquote><h4>3.4 What Happens After Deployment?</h4><ul><li><strong>Flannel DaemonSet</strong>: Once you run the command, Flannel deploys as a DaemonSet, ensuring that a Flannel pod runs on every node in your cluster. This enables consistent networking across the entire cluster.</li><li><strong>Pod-to-Pod Communication</strong>: Flannel assigns each pod its own IP and ensures that traffic can flow between all pods, even if they are on different nodes.</li><li><strong>Network Overlay</strong>: Using the default VXLAN backend, Flannel creates an overlay network that allows nodes to communicate without needing to adjust the underlying physical network.</li></ul><h4>3.5 Advantages of Using Flannel:</h4><ul><li><strong>Simplicity</strong>: Flannel is known for its simplicity and is perfect for small to medium Kubernetes clusters.</li><li><strong>Quick Setup</strong>: Its quick deployment makes it a good choice for beginners or for clusters that don’t have highly complex networking requirements.</li><li><strong>Efficient for Basic Networking Needs</strong>: If you don’t need advanced features like network policies, Flannel is an efficient and reliable choice.</li></ul><h3>Considerations:</h3><ul><li><strong>Scaling</strong>: While Flannel works great for smaller clusters, if you plan to scale to larger, more complex clusters, you might want to consider using <strong>Calico</strong> or other advanced CNI plugins, which offer more features like network policies.</li><li><strong>No Built-In Network Policy</strong>: Unlike other network plugins (e.g., Calico or Cilium), Flannel does not natively support Kubernetes NetworkPolicies, which might be a limitation for those looking for fine-grained control over pod-to-pod communication.</li></ul><p>By using Flannel, you ensure your Kubernetes cluster has a basic, reliable networking layer, allowing all pods to communicate regardless of which node they are hosted on.</p><h3>Step 4: Prepare the Worker Nodes (se02 and beyond)</h3><blockquote>The steps for the worker nodes are similar to the master node setup but do not include initializing Kubernetes. Instead, the worker nodes join the cluster initialized on the master node.</blockquote><pre># Update and set the hostname<br>sudo apt update &amp;&amp; sudo apt upgrade -y<br>sudo reboot<br>sudo hostnamectl set-hostname &quot;k8s-worker-se02.local&quot;</pre><pre># Same process for disabling swap and setting up kernel modules<br>sudo swapoff -a<br>sudo modprobe overlay<br>sudo modprobe br_netfilter</pre><pre># Install containerd and Kubernetes components<br>sudo apt update<br>sudo apt install -y apt-transport-https ca-certificates curl software-properties-common<br>sudo apt install -y containerd.io kubelet kubeadm kubectl<br>sudo apt-mark hold kubelet kubeadm kubectl</pre><pre># Use the join command from the master node to add the worker to the cluster<br>sudo kubeadm join k8s-master-se01.local:6443 --token &lt;token&gt; --discovery-token-ca-cert-hash &lt;hash&gt;</pre><h3>Bonus-Step: Add Storage to Your Cluster (Optional)</h3><blockquote>If your Kubernetes workloads require persistent storage, you can integrate a SAN or similar storage solution. Here’s an example of how to configure your server to attach SAN storage using open-iscsi:</blockquote><pre># Install iSCSI utilities<br>sudo apt-get install open-iscsi -y<br>sudo systemctl enable iscsid<br>sudo systemctl start iscsid</pre><pre># Rescan to detect new storage<br>sudo rescan-scsi-bus.sh</pre><pre># Format the new disk as ext4<br>sudo mkfs.ext4 /dev/mapper/mpathX  (Replace &#39;X&#39; with your mpath variable)</pre><blockquote>Note: You need to create and attach volume to the target server from your SAN storage in order to scan and get it.</blockquote><pre>###get wwn and lun from<br>ls /dev/disk/by-path/</pre><blockquote>Fibre Channel WWNs are identified as /dev/disk/by-path/pci-&lt;IDENTIFIER&gt;-fc-0x&lt;WWN&gt;-lun-&lt;LUN#&gt;, <br>but you do not need to provide any part of the path leading up to the WWN, <br>including the 0x, and anything after, including the — (hyphen).</blockquote><p>This setup ensures your Kubernetes cluster has access to high-performance, scalable storage.</p><h3>Step 5: Validate the Kubernetes Cluster</h3><blockquote>Once the master and worker nodes are set up, verify the cluster by checking the status of the nodes and the pods:</blockquote><pre># Check nodes<br>kubectl get nodes</pre><pre># Check pod statuses<br>kubectl get pods --all-namespaces</pre><blockquote>All nodes should show a Ready status, and the pods (especially core components like kube-dns) should be running correctly.</blockquote><h3>Conclusion</h3><p>Deploying Kubernetes on bare-metal servers provides more control over your infrastructure, better performance, and often lower costs in the long run. However, it requires more setup and maintenance than cloud-based or virtualized deployments. By following this guide, you can set up a robust, multi-node Kubernetes cluster on bare-metal, with control over network, storage, and compute resources.</p><p>If you want to explore further, consider setting up high availability (HA) Kubernetes clusters, integrating with load balancers, or automating backups and scaling.</p><p>Happy deploying!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8b40f61bd2aa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spring Data JPA Specification Beginners’ Guide]]></title>
            <link>https://medium.com/@meherwer_ali/spring-data-jpa-specification-beginners-guide-47e75785e10f?source=rss-a60c600ee073------2</link>
            <guid isPermaLink="false">https://medium.com/p/47e75785e10f</guid>
            <category><![CDATA[jpa]]></category>
            <category><![CDATA[jparepository]]></category>
            <category><![CDATA[spring-data-jpa]]></category>
            <category><![CDATA[jpa-specification]]></category>
            <category><![CDATA[search-filters]]></category>
            <dc:creator><![CDATA[Meherwer Ali]]></dc:creator>
            <pubDate>Sat, 16 Jul 2022 14:20:56 GMT</pubDate>
            <atom:updated>2022-07-24T14:52:38.280Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/932/1*TxlZsWZCb7aZuEVMzIS2MA.jpeg" /></figure><blockquote>In this article I am going to create a simple implementation for the JPA Specifications to create a single search method with minimal code to cater all the filter requirements that you need. I am gonna try to make it as simple as possible.</blockquote><h4>Whenever we are working on projects of Spring Framework specially using JPA we have a lot of options to write database queries, these methods includes:</h4><ul><li>JPA named queries</li><li>Derived query methods(in repositories using method names)</li><li>Native SQL queries/ JPQL using <strong><em>@Query </em></strong>annotation<strong><em>.</em></strong></li><li>HQL(if using hibernate)</li></ul><p>The real issue arrives when you have to create a dynamic structure for your search queries that creates where clauses at runtime in accordance with the given parameters.</p><p><strong><em>Spring Data JPA Specification helps to create dynamic queries at runtime based on the requirements.</em></strong></p><h4>Lets go through the following implementation for the creation of our search filters.</h4><p><strong><em>Country Entity:</em></strong></p><blockquote>The country entity contains id as a PKey and have two relations with the City.<br>Country has many Cities(OneToMany Relation).<br>Country has one Capital City(OneToOne Relation).</blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/aec5f0a961b2ff44d94d9703ebc073b5/href">https://medium.com/media/aec5f0a961b2ff44d94d9703ebc073b5/href</a></iframe><p><strong><em>City Entity:</em></strong></p><blockquote>The cityEntity contains id as a PKey and have two relations with the City.<br>City Belongs to Country(ManyToOne Relation).</blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7c47e0a279056396ed1e6b5ac91c262e/href">https://medium.com/media/7c47e0a279056396ed1e6b5ac91c262e/href</a></iframe><h3>Step#1:</h3><p>Import Specification and extend your repository with JPA Specification:</p><p>The JpaSpecificationExecutorhas Override methods like findAll(Specification entitySpecification) that we can use for our queries from Database.</p><pre>CountryRepository extends JpaRepository&lt;CountryEntity, String&gt;, JpaSpecificationExecutor&lt;CountryEntity&gt;</pre><blockquote>You can read in details about the JPASpecificationExecutor here:</blockquote><p><a href="https://docs.spring.io/spring-data/jpa/docs/current/api/org/springframework/data/jpa/repository/JpaSpecificationExecutor.html">JpaSpecificationExecutor (Spring Data JPA 2.7.2 API)</a></p><blockquote>Before we move to <strong>Step2 </strong>I need to mention few hibernate implementations that you need to learn about in order to understand the implementation properly.</blockquote><ul><li><strong><em>Criteria:</em></strong> The Criteria API is <strong>a predefined API used to define queries for entities</strong></li><li><strong><em>CriteriQuery:</em></strong> CriteriaQuery instance is <strong>used to create a query object</strong>. This query object’s attributes will be modified with the details of the query.</li><li><strong><em>QueryRoot/root</em></strong>: The root is the <strong>entity which we query from</strong>, in our case it is the <strong>CountryEntity</strong>.</li><li><strong><em>CriteriaBuilder: </em></strong>CriteriaBuilder is used to construct CriteriaQuery objects and their expressions, you can use it to implement where clause and joins etc.</li></ul><h3>Step#2:</h3><p>Create your implementation for defining specifications for your entity:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c3ef0d9ac00e12f2a32c24487778bf78/href">https://medium.com/media/c3ef0d9ac00e12f2a32c24487778bf78/href</a></iframe><p>The above class is not a generic implementation but for starters we should keep it simple. You can create more generic methods in the specification to cater all the fields dynamicall and implement the criteriaBuilder operations(i.e. equals, like, ge, le etc) in a more generic way.</p><blockquote><strong>For applying filters on relations(using joins):</strong></blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9fc9f067a1ec748da95af8e669996bb4/href">https://medium.com/media/9fc9f067a1ec748da95af8e669996bb4/href</a></iframe><p>You can see the withCapitalName(String capitalName) method in country for more better understanding. You can use any type of join in the jointype you have to provide the <em>property </em>(the relation described in your entity) and the <em>JoinType </em>for using a join with the criteriaBuilder.</p><blockquote><strong>For applying filters on OneToMany relations query.distinct(true):</strong></blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ea6ad2ca30f1b27150db71fc522cdea7/href">https://medium.com/media/ea6ad2ca30f1b27150db71fc522cdea7/href</a></iframe><p>Here we have method to get the country that have a cityName starting with the given param(cityName) since there is a OneToMany relationship between country and cities so there can be duplicates, In order to avoid those we append criteriaQuery.distinct(true) to get only unique countries.</p><h3>Step#3:</h3><p>In your service method call the specification using the requestDTO:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c4df722da8d24542f1160df13595c0ea/href">https://medium.com/media/c4df722da8d24542f1160df13595c0ea/href</a></iframe><h3>Conclusion:</h3><p>JPA Specification is a convenient way to create dynamic where clause for your Queries. It provides a sophisticated implementation that can be used for building clean and easy search mechanism. <br>We can add some extra logics and create an API for the consumers that will prove to be an easy and generic way for the filtration of entities.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=47e75785e10f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>