HomeVideos

I gave Claude its own database, here's what happened

Now Playing

I gave Claude its own database, here's what happened

Transcript

441 segments

0:00

If you're building an app in 2026, then

0:02

you need a database. The issue is that

0:04

most databases are expensive, annoying

0:06

to configure, and can't be handled

0:08

natively by AI agents. And even if they

0:10

can, the AI agent can make one mistake

0:13

and nuke your entire database. So, in

0:15

this video, I'm going to show you a

0:17

solution to that. And I'm going to give

0:18

Claude its own database that's

0:20

specifically designed for working with

0:22

AI agents that will allow me to run

0:24

hundreds of databases in parallel at the

0:26

exact same time. Fork existing

0:28

databases, delete them, create them,

0:30

read them, list them, everything

0:32

natively inside of this AI tool so that

0:34

I don't need to do anything manually.

0:36

And the best part is this is completely

0:38

free. So what is this database that I'm

0:40

talking about? Well, it is ghost.build.

0:43

It is free to use and you can install it

0:45

with literally just one command and then

0:47

add as an MCP server to things like

0:49

Claude, Codeex, any of the main tools

0:51

that you're using specifically for

0:53

development. Now, the idea here is that

0:55

we can really easily spin up databases,

0:57

we can then fork those databases to

0:59

create multiple versions. So, if we want

1:01

to test something or we want the AI

1:03

agent to build something, we can do it

1:04

on a clone of our existing database

1:07

rather than on the base one. So, if

1:08

something goes wrong, nothing will be

1:10

harmed. and then we can test all

1:11

different types of database strategies

1:13

and then apply the one that actually

1:15

works back to the main DB. Now, I want

1:17

to show you exactly how to set it up,

1:19

but I'm just going to quickly pop into

1:20

the docs here so you can understand when

1:22

you would actually use this. Now, first

1:23

of all, there's a free tier here. You

1:25

get 100 compute hours per month, 1 TB of

1:28

storage, and unlimited databases and

1:31

forks. So you could use this for just

1:32

persistent memory on your own if you

1:34

want to have notes or blogs or something

1:36

inside of claude because it doesn't have

1:37

memory by itself or you can use it for

1:39

various projects like I'm going to. And

1:41

in the case of using it, it's good for

1:43

persistent postcript storage, the

1:44

freedom to create and discard databases

1:46

really easily without the anxiety of the

1:48

cost and then forking like I was talking

1:50

about as well as those hard spending

1:52

caps. Now it's probably not the best for

1:53

something like a web dashboard or

1:55

something like usage based pricing for

1:57

precise cost control. You get the idea.

1:59

Okay, so let me show you how to set it

2:00

up. It's very basic. I'm going to leave

2:01

the commands in the description or the

2:03

link to the documentation. Whether

2:05

you're on Mac or Linux, you can copy one

2:07

of these commands. In my case, I'm on

2:08

Mac. We can just go to the terminal. We

2:10

can paste it in, hit enter, and then

2:12

start running. Okay, so I've already got

2:13

it installed, but it will just take a

2:15

second. And then once you've done that,

2:16

you're just going to run the command

2:17

ghost login. When you do that, it's just

2:20

going to uh prompt you to log in with

2:21

GitHub here. I've already authenticated,

2:23

hence why I'm just signed in. Again, you

2:24

don't even need to like sign up. You

2:26

just literally connect with your GitHub

2:27

account. And then we can go back and

2:30

what we're going to run next is the

2:31

ghost mcp install. When we run that

2:35

command, we can pick claude codeex

2:36

cursor whatever. In my case, I'm going

2:38

to go with clawed code because that's

2:39

what I want to use. And then it will

2:41

install. Anyways, I've already got this

2:42

installed. So it said, hey, you know,

2:43

failed to run cuz it's installed

2:45

already. But in your case, it should

2:46

install it. Pick whatever tool you want.

2:48

And then what I'm going to do is just

2:49

run cloud code here. And just to verify

2:52

the install, we can just run the /mcp

2:54

command. If we go here, we should see

2:56

the ghost MCP server. And if we click

2:58

into it, we can view some of the tools.

3:00

We can see, you know, login, execute

3:02

SQL, create database, etc. So, let's get

3:05

out of that. And now what I want to do

3:06

is start running a few demos so I can

3:08

show you why this is actually useful and

3:10

how you can get a benefit from it inside

3:11

of Claude Code. So, for the first demo,

3:13

let's keep it really simple. I'm going

3:14

to go with something like spin up a new

3:16

ghost database called reading log and

3:19

give me a simple schema for tracking

3:20

books. I want title, author, the date

3:22

finished, and then a rating out of five.

3:24

throw in maybe 10 different books about

3:26

AI and machine learning. Let's start

3:28

with that. Okay, cool. Go ahead and

3:31

press enter. And you can see that we

3:33

actually get this really nicely

3:34

formatted text. You guys always ask me

3:36

what I'm using for the voice dictation

3:38

here. I'm using a tool called Whisper

3:40

Flow. Now, let's just quickly pop into

3:42

it here while this is actually running

3:43

the thing. You can see that I'm

3:44

literally a Power user. I have 103,000

3:47

words, you know, 214 words per minute.

3:49

It's obviously a lot faster than you

3:51

having to type manually. And I like the

3:53

fact that it saves the transcripts and

3:54

gives you all of the automatic formatted

3:56

text. Now, it is free to try out and

3:58

use. I'll leave a link to it in the

3:59

description. And fortunately, I have a

4:00

long-term partnership with them because

4:02

I literally use it all the time anyways,

4:04

no matter what. So, I figured I'd let

4:05

you guys know. Regardless, let's wait

4:07

for this to finish. We can see it's in

4:08

the process of calling Ghost. You can

4:10

see it's creating a new database called

4:12

reading log. We're going to wait for

4:14

that to finish and then once it's done,

4:16

we'll pop in here, see the database, and

4:18

start experimenting with it. Okay, cool.

4:19

So, it looks like it just finished. If I

4:21

want to see the commands that it called,

4:22

I'm just going to press control O. And

4:24

you can see that it just kind of seated

4:25

the database with a bunch of different

4:27

values here. It executed some SQL to

4:29

create the different tables. And this is

4:31

happening natively inside of Cloud Code

4:33

just using the MCP server without me

4:35

really having to know anything about the

4:37

database config. Now, from here, what we

4:39

can do is we can ask it something like

4:41

what's the average rating of the books

4:43

in the database, right? And then I can

4:45

go and hopefully execute that query.

4:47

Okay? And we can see that we get a 4.4

4:48

four out of five is that average rating.

4:50

And then of course we can ask it pretty

4:51

much anything else. What I'm going to

4:52

say, give me the books organized by

4:55

rating. Okay. And let's see if it could

4:57

just pull those out and sort them by the

4:59

average rating. Okay, cool. And then we

5:00

get our fivestar, four-st star, and

5:02

three star books showing up in the

5:04

console. That's the first demo just

5:05

showing you very easy. Connects to the

5:07

MCP and uses it automatically. If for

5:09

some reason it's not using the MCP, just

5:11

make sure you include ghost. If you

5:13

include ghost, it will know to go for

5:14

that for the database in case you have

5:16

maybe some other tools installed. Now,

5:17

let's do something a little bit more

5:19

complex. Okay, so for this demo, I'm

5:21

going to say make a new database called

5:23

Movie Night with a schema for tracking

5:24

movies. I want the title, director,

5:26

year, genre, runtime, the rating out of

5:28

10, and then I want you to seed it with

5:30

100 different movies across a mix of

5:33

genres and decades. Okay, so let's run

5:36

that and get it to create something a

5:37

little bit larger. Okay, so it looks

5:39

like it's finished. We've got a bunch of

5:40

movies here. Now, what I'm going to do

5:42

is have it build a dashboard around

5:44

this. So, I'm going to say, now build me

5:45

a simple dashboard for this. I want one

5:47

page, Nex.js, shad cn/ui components.

5:51

Connect directly to the movie night

5:53

database. I want a table view of all of

5:55

the movies, a filter by genre, and three

5:57

statistic cards at the top showing the

5:59

total movies, average rating, and most

6:01

common director. Keep it minimal, just

6:03

make it work. Okay, so let's pop this

6:06

prompt inside of here. And now I'm just

6:08

going to have it create a kind of simple

6:10

dashboard. Now, it's not the best for

6:12

making dashboards just because

6:13

everything natively is happening through

6:14

the MCP. However, you can grab the

6:17

connection string of the underlying

6:18

database and use it kind of however you

6:20

want, but typically it's meant to be

6:21

used directly by the AI agent and manage

6:24

through the MCP server. So, I'm just

6:26

going to go yes and kind of just accept

6:28

all of these commands. Let's wait for it

6:29

to finish. I'll be right back and let's

6:31

see what it looks like. All right, so it

6:32

took a minute there, but this is the

6:33

dashboard that it created. And you can

6:35

see that we can view all of the

6:36

different movies. We can see the rating.

6:38

We can sort by, you know, category,

6:40

whatever, right? And kind of go through

6:41

this. Obviously not perfect, but I just

6:43

asked it to keep it simple, which it

6:45

obviously did. And now let's continue

6:47

and move to the next demo. And actually,

6:49

before we do that, I want to show you

6:51

that if I exit out of this, right,

6:53

because Claude doesn't have memory

6:54

persistently by default, and then I go

6:56

back into it and I say, what databases

6:59

do you have access to with Ghost for

7:02

example, you'll see these databases will

7:04

still exist. And then what we can do is

7:05

we can nuke them, we can clear them, we

7:07

can fork them, which I'm going to show

7:08

you in the next demos right here. But

7:10

you can see it's listing it. we have the

7:11

two DBs and I can say okay delete them

7:14

both right it's probably going to ask to

7:16

verify that but let's see and then let's

7:18

get rid of them okay and we can see that

7:20

both of these databases are deleted now

7:22

let's move to the next demo all right so

7:24

for this one I want to do something that

7:26

really shows the benefit of having this

7:28

kind of tool which is running multiple

7:30

databases at the same time to test

7:32

various strategies in this case we'll

7:33

start with like optimizing a query so

7:35

first let's create a database that we

7:37

can use to optimize so I'm going to say

7:39

make a database called shop analytics

7:41

with a small e-commerce schema. I want

7:43

customers, orders, order items,

7:45

products, categories, seed it with

7:48

100,000 customers, 500,000 orders, and 1

7:53

million order items. Don't add any

7:55

indexes beyond the primary keys. I want

7:57

this to be slow on purpose. Okay, so

8:00

this is going to be crazy. I don't know

8:01

how long it's going to take to actually

8:02

create all of these entries here. The

8:03

thing is I want a really large database

8:05

with a bunch of different values so that

8:07

we can see how slow it is when I try to

8:08

query for something without any indexes

8:11

or materialized views or different

8:12

strategies. And then what we'll do is

8:14

we'll fork three databases at the same

8:16

time. We'll try different strategies.

8:18

We'll run different queries on them. And

8:20

then whatever one gives us the best

8:21

result. We'll go back and apply that to

8:23

the base DB. Okay. So it looks like it's

8:25

done. It's created all of these values.

8:27

Now what I want to do is run a query on

8:29

this and just see how slow it is and

8:31

then we'll do the optimization. Here's

8:33

the query that I want you to run. I want

8:35

you to show the top 10 customers by

8:37

total spend in the last 90 days plus

8:39

their order count and average order

8:41

value. Write it, run it, and then show

8:43

me the timing and the query plan. I want

8:45

to see how long it takes. Okay, so it

8:46

gave me the result here. We're looking

8:47

at like 1 second, 800 milliseconds. Not

8:50

extremely slow, but obviously we can

8:52

make this faster. So now let's see how

8:54

we can optimize this. So I'm going to

8:55

say, okay, it's not too slow, but I

8:57

think we can make this better. What I

8:58

want you to do is fork three databases.

9:01

Do this in parallel. Don't wait for the

9:03

databases to finish forking before you

9:04

fork the next one. Just fork all three

9:06

of them at the same time. And then what

9:08

I want you to do is apply three

9:09

different strategies on these databases

9:12

without touching the base database. That

9:14

would make this query faster. What I

9:16

want you to do is something like

9:17

targeted indexes, materialized view, and

9:20

then maybe a denormalized summary table.

9:22

I want you to benchmark the query on all

9:24

three of these databases and then give

9:25

me the results and rank them. Okay, so

9:28

let's run this now and see what we get.

9:30

Okay, so it just finished here and you

9:32

can see that we have the materialized

9:33

views, summary table and targeted

9:35

indexes and we get the speed increase

9:37

versus the base query. So now what we

9:39

can do because we see how much faster it

9:42

actually is right across these different

9:43

strategies is we can just tell it to

9:44

apply this to the base DB. So we say,

9:47

okay, this is great. Now let's apply

9:48

this strategy to the base DB. Let's use

9:50

a materialized view so that we have an

9:52

improved query speed. Now, the benefit

9:54

is that I was testing this on a separate

9:56

database instance. I can then just

9:58

discard that database instance after. It

10:00

doesn't cost me any money. It's free.

10:02

And that means that I didn't mess

10:03

something up in my main DB before I

10:05

verified that it was actually going to

10:06

work where especially with AI agents is

10:09

extremely important. You can see boom,

10:10

it just went ahead and did this. And now

10:12

we're good to go. So, I'm going to say

10:13

cool. Okay. Remove the other three

10:14

database forks, we don't need them

10:16

anymore, right? And then we can just

10:17

remove them. And there we are. Like this

10:19

is crazy. And that's why I like this

10:21

tool a lot specifically for these types

10:23

of experiments. And now I want to do

10:24

something even crazier. Okay, so now I

10:27

want to do something that is pretty

10:29

common where you have some like

10:30

malformed data. You want to clean

10:32

something up. But I want to do this with

10:34

10 databases running in parallel. So

10:36

what I'm going to do for now is I'm

10:37

going to say the following. I'm going to

10:38

say make a database called users base

10:41

with let's go 500 fake users. I want

10:44

name, email, phone number, a created at

10:47

date, and I want to make the phone

10:48

number column messy on purpose. So, I

10:50

want 3% null, 2% straight up malformed,

10:53

and the rest valid, but a bunch of

10:55

different formats. Mix the bad rows

10:57

throughout. I want to do this for a

10:59

demo. So, I want to create this kind of

11:01

malformed database, which is very common

11:03

to deal with, especially at large

11:04

companies. We have data coming from

11:05

different sources. And then I want to

11:07

spin up 10 databases in parallel to run

11:10

some different strategies on cleaning up

11:12

the database and see how many rows we

11:13

delete, how many we keep, and what those

11:15

strategies end up actually resulting in

11:17

again before I apply them and

11:19

potentially have something dangerous or

11:20

destructive on the main DB. Okay, so the

11:23

base DB is created. Now what I want to

11:24

do is the following. I'm going to say I

11:26

want to add a notnull and a strict

11:28

format check to the phone number column,

11:31

but I need to clean the data first and I

11:33

don't know which approach is best. So, I

11:34

want you to fork the user space 10

11:36

times. Don't use the weight when you're

11:39

forking it. Just make sure that we fork

11:40

them all at the same time without

11:42

waiting. And I want you to have it to be

11:44

like migration test one, migration test

11:46

two, migration test three, and try a

11:48

different cleanup strategy for each. So,

11:51

dropping bad rows, back filling, reg x,

11:54

normalization, quarantine tables,

11:56

whatever you can think of. Let's just do

11:57

10 different strategies and then tell me

11:59

what each one does after. Okay, so let's

12:02

run this. And notice that I'm telling it

12:03

not to use the wait command because by

12:05

default it will wait for the database to

12:07

finish forking before it forks the other

12:08

one. That's going to take a really long

12:10

time. So if we just tell it to fork them

12:12

all at the same time in parallel, it can

12:14

do that. But we just need to manually

12:15

instruct that. So that's what I'm

12:16

saying. Let's wait. Let's see what we

12:18

get. Okay. So you can see that it's

12:19

forking them. It did it in parallel. All

12:21

10 of them happened pretty much

12:22

instantly. And now it's going to go

12:23

through and do that cleanup strategy.

12:25

All right. So it's just giving me the

12:26

result right now. So it looks like it

12:28

was able to apply all 10 of the forks

12:30

and then do all of the different

12:31

strategies here. Now it says for a real

12:33

migration we should combine five with

12:35

three. So I'm going to say okay let's

12:37

run the real migration on each of them.

12:38

See how it performs. Then take the best

12:40

one and apply it to the base DB. Okay.

12:42

And it looks like it's applied and we

12:43

are good to go here. Okay nice. And then

12:45

yeah we can say nuke the other 10 DBs.

12:49

And I think this is the thing that is a

12:50

big unlock for me when using this is

12:52

that when databases aren't annoying they

12:54

don't take a long time to spin up. you

12:56

don't have to spend money on them. You

12:58

stop treating them as precious and you

13:00

just allow yourself to experiment with

13:01

them like I'm doing right now. And

13:03

especially with this AI agentic

13:04

development, you know, I can build four

13:06

versions of the same app with four

13:07

different DBs and then as soon as I'm

13:09

done with one, I just scrap that version

13:10

of the app, scrap the DB, and I move on.

13:12

And there's no cost associated with

13:14

that. So look guys, that's pretty much

13:16

all I had to show you here. This is a

13:17

super cool tool. Again, it's free to

13:19

use. I think it's just a great MCP to

13:21

have and have the ability to use inside

13:23

of something like Cloud Code or really

13:24

any other developer tool. I'd love to

13:26

hear what you guys think of it. So, let

13:28

me know in the comments down below. And

13:29

I look forward to seeing you in another

13:31

video.

Interactive Summary

The video introduces ghost.build, a free, AI-native database solution designed to simplify database management for developers, especially when working with AI agents. It addresses common issues like expensive and complex configurations, and the risk of AI agents making destructive mistakes. Ghost.build offers features like easy installation, native integration with AI tools (e.g., Claude), the ability to run hundreds of databases in parallel, and crucial forking capabilities. These features enable safe experimentation, allowing developers to test database strategies, optimize queries, and clean malformed data on disposable database clones without affecting the main database or incurring costs. This fosters a culture of rapid, cost-free experimentation in AI agentic development.

Suggested questions

7 ready-made prompts