MindsDB Made It Easy, I Made It Hard: Building an AI-Powered Knowledge Map

Hi,

It’s been a while since I posted anything tech-related. So, my friends, here we have it.

This article is all about how and why I used MindsDB for my next project: KbNet.

First Things First: What Even Is MindsDB?

Before I go deep into the technical rabbit hole, let me quickly tell you what MindsDB is.

MindsDB is this cool open-source project that makes building AI-driven applications super smooth. It basically reduces the headache of connecting a bunch of data sources and managing AI integrations in your app.

So instead of writing custom adapters and creating extra packages for every new data source, MindsDB just says:

“Relax, bro, I got you.”

Some features that I personally loved:

  • Connect multiple data sources and pipe them into a unified output.
  • Create pre-built AI models with prompt templates (supports OpenAI, Google Gemini, and more).
  • Run background jobs and triggers on specific events.
  • Create a knowledge base with a single SQL command that handles embedding and storing automatically.
  • And yeah… a lot more.

But you know what? The best part?

MindsDB is SQL-based.

Everything. I repeat — everything can be done via SQL queries.

No SDK madness, no complex APIs.

(Yes, I’ll tell you why that made my life so much easier.)

But Wait, What’s KbNet?

Before jumping into the MindsDB part, let me give you some context.

So, what is KbNet?

In short:

It’s a web app (kinda game-like) that lets users explore different aspects of any topic and do some good old serendipitous discovery.

The idea?

We create a Knowledge Base and generate a map of nodes in a tree format for any topic.

The cool part? You can swipe through these nodes (yeah, swipe gestures FTW), go back in time, rethink your path, and even build a new branch from a completely different perspective.

I honestly wish life worked this way. If I could go back in time and create a new branch, I probably wouldn’t have chosen programming. 🤣

Why I Chose MindsDB (and Decided to Suffer Anyway)

Now, I had two choices:

Either build this system from scratch (why though?)

OR

Use something that can handle the AI and Knowledge Base part for me.

Thankfully, MindsDB came to the rescue and made the first half super smooth.

So smooth that I thought — “I can totally build this entire app in one week.”

(Oh, how innocent I was.)

Then, in a moment of pure genius (read: self-inflicted torture), I decided to not use a graph database.

Instead, I went for a relational database (PostgreSQL!) with WebSockets.

Why? No idea. I probably wanted to challenge myself for no reason. (I hate past me.)

This Article: MindsDB Part Only

(I’ll talk about the database side if I ever open that schema again.)

How I Used MindsDB in KbNet

Key Use Cases:

  1. Create a Knowledge Base
  2. AI agents to generate explored summaries
  3. Background jobs to ingest new data
  4. Connect to many different data sources on the fly

The funniest part?

Once I wrote the initial seed file, I literally just needed to write simple SQL queries to set up everything — the Knowledge Base, AI agents, jobs, data connections… all of it.

And get this:

I didn’t even need to create a project folder. I just spun up the MindsDB Docker container and started testing queries directly.

No project setup, no dependency hell. Just a container and I’m good to go.

Once I had tested everything, I just wrapped my SQL queries into a file and made a simple POST request to the MindsDB API sitting inside the container.

Boom. Project initialized. No fuss.

Here’s the magic function I used:

export async function runMindsDBQuery(query: string) {
  try {
    const res = await fetch(`${mindsDBUrl}/api/sql/query`, {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({ query }),
    });

    if (!res.ok) throw new Error(`HTTP error! status: ${res.status}`);

    const rawData: any = await res.json();

    if (rawData.type == "error")
      throw new Error(`MindsDB error: ${rawData.error_message}`);

    const transformedData = rawData.data.map((row: any[]) => {
      const obj: Record<string, string | number> = {};
      rawData.column_names.forEach((col: string, idx: number) => {
        obj[col] = row[idx]; 
       });
      return obj;
    });
    return transformedData;

  } catch (error) {
    console.log("Error during fetch:", error);
  }
}

`

Yep.

This one function could:

  • Fetch from the Knowledge Base

  • Trigger AI agents

  • Run background jobs

  • Ingest new data

All of it.

MindsDB SQL Syntax is Super Simple

The basic structure to create anything in MindsDB:

sql
[OPERATION] [RESOURCE] [name]
{PARAMETERS}

Examples:

sql
CREATE KNOWLEDGE_BASE kbnet (...parameters...);
DROP JOB my_job;

To fetch data:

sql
SELECT * FROM [RESOURCE];

The coolest thing?

Whether your resource is:

  • Twitter

  • GitHub

  • YouTube

  • Web

  • AI Models

  • Databases

You get the data in a unified SQL table format.

No special transformers, no extra mapping.

Just SELECT and chill.

My Honest Thoughts

MindsDB solved half of my problems without me needing to overthink.

AI, Knowledge Base, Data Ingestion — all went buttery smooth.

And then, of course, I decided (for absolutely no good reason) to use PostgreSQL instead of a graph database to store the nodes.

“Oh, how bad could it be?” — Me, before designing the database schema

“I have made a terrible mistake.” — Me, after designing the database schema

Let’s just say… I’ll tell you about the second part of this adventure if I ever dare to reopen that schema.

Life Lessons

  • SQL-first AI integration is a game-changer.

  • MindsDB is like your overachieving friend who actually makes your life easier.

  • Never trust your pen and paper system designs.

    You will regret them.

Quick Links

See you next time with another mistake I’ll regret.

Priyanshu Verma

Similar Posts