Transcription
I am Alexey, and I hate writing SQL queries. Well, okay, I don't hate them. Rather, SQL and I have a complicated relationship, like in a marriage. We live together, but sometimes I really want a divorce. But spending days or weeks on something that can be solved in minutes or hours, just by talking to it, is no longer masochism. It's some kind of very, very severe case. For this video, you will see the creation of a database from scratch for a new project in minutes, the addition of a document management system to an already completed project with 13,000 products, business analytics without knowing SQL and executing queries, as well as a complete transfer of a database from server to server in 10 minutes. This is not theory, this is Supabase MCP server, a tool that I created and use every day. 24 professional tools work with both the cloud version and self-hosted. Tested on myself and on a bunch of bugs that it heroically overcame. A database is the heart of any project. Without it, your application is like me without coffee in the morning: technically alive, but a completely useless and angry creature. A mobile application, a web service, an agent, everything runs on data. Supabase, for those who don't know, is a powerful open-source backend with a PostgreSQL database under the hood. TB is cool, but working with a database with SQL VRU until i - it was constant Googling. Stack Overflow open in forty tabs, 47, Carl, studying syntax, разбирательство about joins, views, and other things that are scary for the average person. I Googled join syntax so many times that contextual advertising started offering me a backend developer job. Now, yes, there is also ChatGPT, clouds, and they do a really good job of generating SQL. But at the same time, you still need to copy the query, paste it into the editor, execute it. An error, damn it, ask to correct it politely again, although you want to swear. Copy again, paste again. And so, in a circle. It's like playing tennis with yourself, only more boring and without any benefit to your health. That's why I created the Supabase MCP server. It works with both the cloud Supabase and the self-hosted version. Full database management through a normal dialogue with E without copy-pasting, without forty-seven tabs. And the pain we all share is routine. A developer spends time on syntax instead of architecture. A manager waits for a download from a perpetually busy developer. A startup founder rushes around between everything. This tool is for everyone who works with data, for those who want to think about business, not about how to correctly write left join for the third time this morning. Everything that previously required knowledge of SQL, working in the Supabase dashboard, digging through documentation, is now a normal conversation, as if you have a personal backend developer who is always online and always in a good mood. But there's a problem. Supabase already made their MCP server. Why did I make another one? Good question. Because their version has 50% of the functionality, mine has 100%. The official MCP from Supabase is only for the cloud. Half of the tools are for managing projects within Supabase itself, not for your product. It also lacks backups. Okay for a start, but not enough for work. That's enough talking. Let's see what our MCP can really do. The MCP server can work with any MCP-compatible client. Today we will look at working in the cloud. But it also works with Kilokodo and any other. Also, you don't have to use Cloud models specifically. You can use absolutely any, including free ones. In the settings menu, we can see that our MCP server is connected. And here are our 24 tools. It sounds like a lot, a whole lot. What does it all mean? We'll quickly go through the categories and tools, and then you'll see how it works in action. I promise, it will be interesting. Let's ask it what tools are available and what it can do with them. Uh, listen, you have access to the Supabase MCP server. It has a considerable number of tools. For each tool, please describe in detail what can be done with that specific tool. Excellent. Let's break down each tool in detail. Well, in general, it has described it for us. Let me go through it myself in order. So, the "show tables" tool, it shows all tables. A very simple but useful thing. "Run SQL Query" is probably the most important tool. With its help, you can execute any SQL query, any Carl. Create a table, no problem, fill it with data, also easily. Write a function, create a trigger for it, easy as pie. Set up Row Level Security, that is, so that, for example, users cannot see other people's data and leak all your service information from the database, also no problem. It will do it with this tool. User management, i.e., "show users" is a list of all users. "Get user," that is, get detailed information about a specific user. Accordingly, "create user," update, delete. So, with these tools, we get full control over accounts. And if memory serves, the official MCP doesn't have this. Yes, you can create a user through, for example, "run SQL," but you need to generate the user ID there. It doesn't always handle this well the first time. And I know from personal experience, yes, when developing any project, it's convenient to immediately create, for example, several test users, for example, an admin, a regular user, and check everything in their name. In short, I needed it, so I made it. Next, working with storage, or file storage. So, "show storage buckets." It shows all buckets in Supabase with complete information about them. "Show storage objects," accordingly, lists all files within a specific bucket, shows their hash ID, name, full path, and so on. The next important section is access key management. "Get one-time token" - this is, accordingly, to get a public key. "Get service key" - to get a service key. "Verify JWT token" is used for security purposes. I don't think we'll dwell on this topic for now. Well, and "project URL," that is, returns the Supabase project URL. Why do we need these tools at all? Firstly, in terms of development, they allow you to view keys and tokens and immediately record them in your project. Or you can ask it for data simply for connection, to connect the same Supabase to the same .env in seconds without rummaging through the Supabase interface. For example, in server configurations. "Show migrations" - this is, accordingly, the migration history. "Apply migration" - it applies the migration and records it in the migration table. In general, this section, like the next one, monitoring statistics, is probably more for advanced users. We won't waste time on it now, as you could easily spend at least an hour just on this. Backend developers themselves understand why this is needed. For beginners, it will be easier to simply set a task for it and check if everything is correct and explain what, how, and why. The same applies to the "Realtime" and "Webhooks" tools. Also, among the important and interesting things, there are tools for backup. That is, the "export schema" and "import schema" tools take all your tables, functions, but without data, and, accordingly, save them. This is a tool for quickly transferring only the project structure. And also two tools for complete copying and backup recovery of your database with all its contents. And here's a very important point. The MCP protocol itself cannot handle data volumes larger than 1 MB. This is the limitation. I've elegantly bypassed this limitation. That is, with the help of these tools, you get detailed instructions for creating a backup right on your machine. That is, if it has access to the terminal, it will open everything and do it itself. If not, it will give you a ready-made list of commands to execute to do everything. That is, with your keys, all connection data. That is, it's convenient that everything is already filled in. So, just copy and execute. Well, the list is good, it's impressive, but what about in practice? That we can now do tasks that used to take hours or days in minutes by voice, without Googling syntax, without endless switching between ChatGPT and Supabase. And the whole point is that you basically don't need to know SQL for some basic operations. That is, in essence, this is not a toy at all, it's a real professional tool. Okay, enough theory, I'm starting to get tired of all these lists myself. I'll show you in practice. Now, in a few minutes, we will design a full-fledged backend, for example, I don't know, for a sneaker online store. We will create all the tables, all the relationships, and functions from scratch. And right now, write in the comments what you think, is this even possible? Now, guys, it will be a complete improvisation. I'm a little nervous, so it's time to hit the like button. Let's first make sure that our database is clean. Here is our self-hosted Supabase deployed. And let's check in the cloud itself that everything is connected correctly. That is, we will ask it directly: "Show me what tables we have in the database." It's interesting that there are no tables in the main "public" schema. This means the database is new. So, we are starting from a clean slate, as we saw in Supabase. Emptiness. Just like in my head when they ask me about my weekend plans. Now, a full-fledged backend for a store will appear here. How to do it? Turn on voice input and start assigning tasks. Uh, listen, design a Supabase database for us that we will later create through the Supabase MCP server for a sneaker online store. We need to consider the following. We will need a lot of tables, probably, to account for the following. We have a sneaker store where there will be, uh, uh, brands like Nike, Adidas, Puma with logos, descriptions. Well, in general, the classic of the genre. We will have sneaker categories, like, I don't know, running, basketball, some kind of lifestyle. And these categories should support subcategories, so that everything is beautiful. So, products, sneaker models, we will need a link to brands and categories, we will need prices, of course, we will need discounts. So, we will create the heart of the store. For products, i.e., sneakers, we will have variants. We will have sizes, let's say from 36 to 45. Sneakers will have colors, SKUs. stock levels, and one product, yes, can have, I don't know, 50 variants. Also, we definitely need to provide tables for customers. We definitely need email, phone number, name, order history. A store without customers will be sad. Accordingly, we need orders. We definitely need order numbers, order statuses. amounts, delivery addresses are also needed. Where's the money, Zin? So, what else do we need? We need order items, what was bought, how much, at what price. And the detail is important to us. Also, for sneakers, we will definitely need a table for reviews, by model with a rating from one to five. We will definitely need a comment field, i.e., the review itself. A mark that the review was made upon purchase, i.e., a mark of a confirmed purchase. What else do we need? We need all the relationships between tables, indexes on foreign keys for speed, so that everything flies. We also need unique constraints, "unique constraints," I think it's called, on email, on SKUs, definitely on order numbers, so that we don't have duplicates. We also need to provide for triggers for auto-update. So, the table will have an "updated_at" field, i.e., when it was updated. We shouldn't forget about that either. What else do we need? We definitely need to check the correctness of the rating assessment. So, that we only have from one to five, so that no one can put 10 or zero. We need correct and proper data types everywhere, i.e., for money, for SKUs, and for text. And now, very importantly. First, propose an architecture, what you would do. Don't do it yet, just propose. I'll look and approve. Important for those who are slow on the uptake, I repeat: just think it through, don't do anything yet. We send this voice message. Now we'll turn it off. It will think and propose. So, an excellent task. Let's think it through. So, let's go in order. Brands, yes, this is ours, this is the base. Categories can be nested, i.e., with subcategory support. So, what do I mean? We can have, for example, running, professional, or basketball, amateur. So, it's cool that it provided a parent ID separately here. I probably wouldn't have thought of that. Okay, so, by name, by category, so that there are no duplicates at the same level. Okay, good. The "Product" table with sneaker models. We have a link to the brand. Everything is correct. For the cost, it provided us with data for a discount in percent. This field will be calculated. The "ProductCategory" table, so it's a many-to-many relationship for products. This is a very important topic for backend, by the way, but I don't think we'll go into it now, because otherwise the video will drag on. Variants of products, sizes, and colors. So, accordingly, for each sneaker, we also have a separate table where colors are used. Okay. So, it set up all the relationships here, sizes too. So that a person cannot choose or we cannot add, say, a size 100 sneaker. So, the "Customers" table, email, phone, name, surname, date created. Okay. So, good. Orders. A link to the customer, so in orders we will also have the amount, delivery address, but here it's even broken down by cities and so on. Good. So, these are order items. So, which specific sneakers the person ordered. A table for reviews. So, the rating, it has provided us with an integer not null. Well, okay. Let's leave it for now. So, it immediately wrote down all the indexes for performance. Okay, good. So, a trigger for auto-update. Ta-da-da. Additional features. A calculated field for the final price. It thought of that. Okay. A view of the customer's order history. Well, this is to make the query execute faster, so as not to bore you. So, with the help of views and these indexes, queries on relationships will fly like me after the third cup of coffee. The trigger will automatically set the modification date, so we won't forget, even if we want to. So, what do we have? In principle, it's at least not bad for a start. So, it writes that it has considered everything. Ta-da-da. Anything to add or change. Okay, let's turn on the voice message and say: "Excellent, then create all the tables, relationships, functions, and generally everything that is needed. What we discussed, I am generally satisfied with. If anything, we will refine it as we go." We send the message, and the magic begins. It will think. Our user approved the action plan. Well, it's my other MCP, it turned it on itself, for reflection. Because the task, guys, is not small at all, I would say. So, let it think for now. Well, it has started calling tools. Naturally, the main one is "run SQL query." It enables extensions here, creates all tables at once. Moreover, well, let it write. I'll have some coffee while it's doing it, because we definitely have a couple of minutes. Two, maybe two and a half minutes. Excellent. Let's check if everything was created. It's already looking at us to see if the tables were created. Let it check while we open Supabase. Well, in principle, we can see that all our tables were created. Here are the tables for brands, as it suggested, the table for categories. So, we have 1, 2, 3. What to count? We'll ask it now. So, it even wrote to us itself. Nine main tables, all relationships, 23 indexes, 7 triggers, 4 useful views, all constraints. Calculated field "final_price." Automatically calculated, taking into account discounts. So, in fact, we've laid a pretty solid foundation, I would say. Well, I didn't even have time to drink coffee. So, the data is structured quite logically, in fact. Well, beauty. Now let's fill our tables, well, with test data for now, how to do it. We return to the chat, turn on voice input and say: "Add Nike USA, Adidas Germany, Puma Germany, New Balance, USA, I think so too. And let's add ASICS. ASICS is, I think, Japan. And fill in real data for these brands." We send the voice message. And now it will populate the database. It's also executing an SQL query. Nike, American transnational corporation. Here, Just Do It. It even found some link to the Adidas logo picture and the Nike logo too. In general, let it do it. And we can open it right here and watch how it inserts the data. Here you go, Puma, logo URL, description. Everything is ready. Okay, we won't stop there. Add categories: running, basketball, lifestyle, training, and, I don't know, football. And subcategories too, you invent some, I don't know, training, pro, and something like that. So, for the development process, it's often necessary to fill the database, let's say, with dummy data, so that we have all the information. We can essentially feed it a CSV file with our data, if we don't have 10,000 items. It will transfer all our data right in the chat. Even if it's 10,000 items, that can also be done. Well, this is through Kilokodo and in several stages, because the volume of the MCP protocol itself will not be enough. So, the limitation of 1 MB will not allow us to do it in parts. Not a problem at all. Well, accordingly, it's adding subcategories here, four steps, five steps already. Well, here are categories for the gym, marathon shoes, competitive shoes for marathons and half-marathons. Extremely light and fast. Excellent. Okay. Let's look at the full structure. Well, let it look for now. All categories are successfully created. Five main subcategories. Full structure. Here are running shoes with four subcategories: road, trail, marathon, for beginners, and so on. Now we can add products. Absolutely right, nerd. You know what? Let's create 10 sneaker models, say, two from each brand in different categories. For each model, create variants, i.e., sizes from 36, let's say, to 45 minimum, I don't know, three colors per model. And for each, set stock levels from 0 to 50 pieces. Well, you'll figure it out yourself, I think. I decided to rack my brains a bit. I'll create 10 realistic sneaker models with variants. Let's start. And it started churning out queries. Getting 10 brands for use, and so on. In general, it's doing the boring backend work sometimes. Now I'll create variants, sizes, and colors for each model. So, let it create for now, we'll see what it's done. So, the "products" table. Here are, accordingly, the 10 models we requested. Everything is filled. Flagship running sneakers. Well, I think each of you understands that filling in real data here is not a problem, but they are even quite similar here. Running sneakers with foam for responsive cushioning. God, what is this? So, here there are as many as eight steps, because, well, there are really sizes and colors here, and therefore there are quite a few queries for it. Now let's check the statistics. Let it check for now, and we'll look. Here are our products, variants. Well, here are 665 variants of sneakers, because, frankly speaking, yes, we have, for example, sizes, breakdown by 0.5, and full white, white, black, blue. Oh my god. So, done. 10 models with variants created. So, products: 665 variants, 19 unique sizes, 15 unique colors, 16,84 units, and total stock. Right, it also did the stock for us. Well, here's the stock. All types are correct. Even the color is coded separately. I wouldn't have figured that out right away. So, it's already written discounts here. Okay. All this is wonderful. It's cool. How many pieces did it break down here? What else will we do? We still need to. Let's try to challenge it even more. So, uh, listen, create 15 customers with realistic names, data, and immediately, create 20 orders in different statuses, and let each order have, I don't know, from one to three items. So, we literally said what we needed, and it went off to write SQL queries without any unnecessary talk. First step. Second. Getting several product variants. So, it looks at the ones that are already in the database, so that our data is real. Create 20 orders. Well, let it create. In short, I'll show you when it's done. Excellent. Now we need to add items to each order. Getting orders. Now we'll create items. I'll add to each order. Well, let it do it here. Let's, so as not to waste time, we'll look. Something about orders. Here are 20 of them, with numbers, with links to customers. So, I remind you, it's not writing nonsense here. So, we can immediately see that, for example, Anna Novikova with this phone number ordered something. So, the customer for this order is this one. Well, she canceled the order, by the way. So, her status is CANCELLED. Well, of course, there are some glitches here that can be fixed. So, the status, for example, would be more correct to do through a type. But this is exactly what you can just tell it by voice to fix. It will fix it, accordingly, amounts, addresses, city, and so on. It even came up with postal codes. So, it's still creating order items. Now we will have this "orders" table. So, here we can see the quantity of each model. So, for example, for order, this one, 0018, someone bought sneakers for 27,000 and bought one model, Nike React, size 37. Well, probably women's. In general, it has probably created everything, and now it's even checking itself. And I want to clarify one important point. Since, for example, working with a database is much clearer than, say, working with an ORM, you can basically work without special prompts. It perfectly understands what it needs to do. Done. 15 customers created, 20 orders. Ta-da-da, 20 orders and so on. So, everything has been completed. Here are the details for each of the orders. So, everything is collected here, who, what, and how. This is a view, by the way. So, for those who don't know, a view, roughly speaking, is a special thing that you can access via API, and it aggregates data from all the necessary tables. So, we have, for example, orders and order items separated. This is done for performance. Accordingly, a view allows you to quickly collect all this and get this data quickly, rather than, for example, in the same ORM, we would read one table, then another, get data by its ID, and so on. Well, it created everything. Let's do something else. I'm even more interested in something else. Uh, listen, add some reviews, like, for different products. Let's say about 25 of them. Set a rating from three to five and write some short comments for each. We send the reviews. And now it will fill in the reviews for us. Our database has fully come to life. There are products, there are customers, there are orders. Now there will be reviews, and this is no longer some empty schema. This is essentially a real living organism. So, again, to add reviews, it went and read which customers could leave a review. And, accordingly, it went to create 25 reviews. It creates them with this query. Here's review one, Ivan, tddda, five stars, tdd, excellent sneakers, and so on. In general, let it do it. Bam. Done. 25 reviews created. Let's look. Here is the "reviews" table. 25 rows. Yes, yes, yes. Well, what did they write here? Excellent value for money. Good running shoes, but slightly inferior to top Nike and Adidas models. Okay, brother, good. Well, you gave it a four, that's fine. And now let's also set up something interesting. It has generally described everything for us here. We could have browsed Supabase, but in general, so that it's clearer for you. What else do we need to do? We have tables, yes, there is such a thing that scares many. This is row-level security. If very briefly, in detail, yes, you can read here what and how we can allow a user to read or write data only specifically about themselves, so that no one can, for example, leave a review.
from another person or, I don't know, steal some of our internal information, like about discounts and so on. That is, we can limit each user, some data. How can this be done? We'll turn on the voice message again. Listen, set up, row-level security for all tables, that products can read and brands, in general, everything related to goods, all users, that is, can read, but no one can edit. Just in general, let no one edit. Reviews, users can only leave under their own name. Orders can also be placed only under their own name, that is, by their own ID. Set up, consequently, rules for all tables. And write to us and tell us, what specifically in each table from users, depending on their role, they will be able to read, write, and delete. In general, honestly speaking, this is probably my least favorite topic, because you can really get stuck on it for a day for all this to work correctly. And since with the help of our MCP server we can create, for example, users, that is, create admins, create buyers, that is, make, for example, their registration, we can at the stage when we don't have a product at all yet, we are just doing the backend for it, we can foresee all these moments and debug all the security. Moreover, for this, it will be enough for us to record a voice message, saying create users, and then check if they are really reading only what they need. Yes, it's clear that here, well, you'll have to use your brain and double-check everything, but it can definitely create some kind of awesome database. But what would have taken us personally, well, I'm saying, a day for me, or even more. Just for this, so that nothing goes wrong anywhere. Go. Here are the policies for the S category. Everyone can read. Creates a policy. Well, in general, let him do it. Let's see now. Done. Roll level Security configured successfully. What has been done? A field has been added to the Customers table for linking. Authentication system. He even thought of that. Which I didn't even think of right now, that it would be needed. RLS is enabled, a twenty-one security policy has been created for access management. Full rights, that is, who can read here and so on. In general, he is even writing down key security points here. Okay, let's see. So, well, I won't torture you with my English. In general, brands, that is, information from the brands table, all users can read. Well, simply put, yes, so that their brand names are displayed in the bot or, I don't know, on the website, mobile app, it doesn't matter. And so on for each table. That is, he also made policies for the category and for everything that is needed, at least, at first glance. But, naturally, it's best to double-check him. That is, what they can do, what they can't do, usage examples, profile creation, review creation. All okay, good. Well, and now a little bit of magic for business owners and analysts. Uh, listen, show me, uh, the top three most popular sneaker models by number of orders, with their brands, average rating, size, well, and so on. In general, such an analytical summary, yes, what sells best, and format it all as an interactive artifact, I don't know, with graphs or with something, in general, so that it's clear what sells best and what to focus on. Sending the message. Guys, I'm not an analyst, so don't pay attention, yes, that I might be asking some nonsense here. If we have analysts, yes, write in the comments what else he can be tormented with, considering that, yes, we have orders, and products, and so on here. But regarding analytics, we will look at it in more detail, I just thought, in the second project, already completed. So, we have some kind of error. So, what is he complaining about? Ah, I don't know anymore, he resent the request. Well, sometimes it happens, he messes up because he names a field incorrectly or something, but it's very, very rare compared to the same N8 NMCP. That is, here everything is clear to him, what and how. That is, here, essentially, you know, SQL language, and agents know almost all of them. So, he's creating some kind of dashboard here. That is, he read the data, that is, he accessed the table, got, consequently, data on sales, on orders. And now he's just giving us HTML code for the page. Sometimes they write in React, by the way. And let's see what he will output now. Ready interactive dashboard created. He offers to open it. Let's see. Here. Online sneaker store sales analytics. Orders, revenue, average check, average rating, top five products by revenue, sales by brand, order status. Consequently, here you can see, uh, ratings of the top 5 products. Here are some matrices drawn. Top three most popular models. Nike, this one, consequently, New Balance Adidas. One request. And in fact, some kind of, but it's exclusively my fault, yes, that maybe something is wrong here, we got the analytics. Everything is connected, everything works. The data is real, that is, it's obtained from the database, it's not made up. And what I want to summarize in general. In fact, we get minutes of expenditure versus hours or even days. And the math, for example, financial, is actually very simple here. Your time, I think everyone can calculate it themselves. And all this, that we did in Supabase, is not simplification, it's, in fact, well, to some extent, a production database with all the links, restrictions, indexes. In fact, well, a real project. You can take it right now and launch a store. Well, almost, yes. It's clear that you need to do the front-end of the project, for example, check everything here, that everything will be correct from a security perspective. Okay. What do we have here for categories? Well, a few days, possibly, yes, you still need to spend, but this was an example from scratch. Here, a completely blank slate. What if the database already exists and the product already exists, and it needs to be improved somehow without any tears and pain? Now I'll quickly upload a backup from one of the real projects, with more than 13,000 products and continue. For the sake of experiment, I uploaded a backup of a real project to the cloud version of Superbase. And here we have a lot of data. That is, we have 13,500 products alone, a lot of functions and so on. And it's important for us not to break anything here now. This will be more interesting. Now I'll show you how to add functionality to a real working project. If you watched my previous video about the seller on Supabase and N8N, then a lot will seem familiar to you. If not, the link will be in the description. Watch it later. The topic of vector search, the operation of Supabase itself, in particular, is covered in sufficient detail there. In short, yes, this is our database from Telegram Bot. 13,500 products, dialogues with clients. That is, the bot consults, helps to choose, compares product positions almost like a live manager, only without breaks. I've also reconnected the clouds to the cloud version. Let's check if it sees everything. Uh, listen, you have access to the Supabase MCP server, and the backend project for the seller is loaded into the database there. Please look at all the tables to be aware of the project itself, who does what, what is responsible for what, and so on. And then we'll chat, my friend. Sending him a message so that he immediately understands the context of our project. That is, he went to look at the tables we have. Now he'll browse them, that is, execute SQL queries, look at the structure. Great. Now I'm aware of the project. In general, I looked here. We have all the products, we have 65 categories alone and 281 subcategories. And it's important to understand, yes, this is not some kind of training example, this is a real working database. And there is a problem, a serious problem, that with its current implementation, the bot cannot sell anything. It can only consult. That is, the dialogue reaches the phrase, for example, of the client: "Okay, I'll take it" and a dead end. There is no оформление, no documents, no invoice, the client leaves to write to the manager separately, and the manager is sleeping, busy, or on vacation. And as a result, yes, we have a lost deal. And now we will move from the consultant mode to the seller mode, that is, from informing about the product to deals. So, let's think about your invoice, that's what we'll add. What do we need for full document flow? Not for show, but so that it really works. Let's enable voice input. Uh, look, we have this working project that you looked at. We need to think about a database for a system for generating commercial proposals and invoices for B2B. We will definitely need tables for commercial proposals, templates for commercial proposals, invoices for payment, and their templates. We need all the links, indexes, unique numbers. Plus, we will need functions for the database, so that the agent who communicates with the buyer can quickly create everything himself, that is, issue invoices, mark who sent what. Propose a correct structure and, in your opinion, think, maybe I missed something and tell me in detail about each table and function that you see, within the scope of this task only, yes, don't create anything yet, just propose and don't go into detail, please, because we don't need to create 30 tables at once. We need to do it briefly, beautifully, aesthetically, so that we can quickly understand and think about everything. And if necessary, we'll add what's needed later. Sending the message. Sounds a bit complicated, but now you'll see what he'll do. Excellent task. Let's think about a minimalistic but functional structure. My vision. Six tables. Add. A table for clients, consequently, with fields, with requisites. Here, the INN will be unique. Indexes. Why without clients? Nowhere. Agreed, bro. A table for commercial proposals, consequently, with statuses and necessary. Okay. This is the core of the system. A position in a commercial proposal, that is, these are specific products. That is, this will be a many-to-many link table, as we did in the previous project. A table for payment invoices. Okay. So, amounts, dates are all here. In general, templates for commercial proposals, templates for invoices, he thought of all the tables. Here, even up to the BIKs right away. Okay. Requisites change rarely, but they must be okay. Database functions, three key ones, that is, generating a unique commercial proposal number. Well, let's have it here. Aha. Well, he did it in Russian right away. That is, the CP number will be like this. Here's CP 2025001 and so on. Generating a unique invoice number. Okay. Trigger for automatic recalculation of amounts in CP. What is this? Why? When the agent adds or removes positions, the amounts change. What I took into account and what I intentionally didn't: minimalism, links, statuses, templates. Intentionally not included, but we can do it later. Change history, file attachments, email logs, and so on. Well, roughly speaking, he has already laid some kind of database for us. That is, how the agent will work with this. That is, for example, let's make a commercial proposal. He, consequently, calls the function, gets the number, inserts the data into the table, and, consequently, the position is also inserted into this commercial proposal. If a person asks for an invoice, he also creates an invoice. If paid, well, this is not on the agent's side, of course, he overdid it here. Well, in general, I think you understood the database. That is, so that we don't add a bunch of tools in the N8N template, to write to the table and so on, all this is solved by functions. That is, there is a function call, we call it, and everything is done automatically. That is, in fact, we, well, how much, a minute and a half, he probably thought and typed everything. Some kind of database has already been laid. Let's tell him to upload it. Uh, create all these tables and functions that you planned. We are generally satisfied with everything. Excellent, everything is ready. Well, let's check, refresh our page and, consequently, we will see that the tables have already appeared. That is, for example, even with examples, links, and so on. Besides creating them, he also tested the functions himself, which I didn't ask him to do. Found a bug in the trigger, immediately fixed it. That is, well, he approached the task quite competently, as much as possible within AI. That is, in fact, in a few minutes, we created a database for a full-fledged document management system. I spent 3 weeks on a similar system last year. 3 weeks. That is, in fact, we have a table of commercial proposal templates, invoices, a table of invoices, and so on. In general, everything we asked him for, he created for us. Created all links, indexes, added some test data, and additionally created the agent instruction table with SQL query examples. Well, okay, let's see. Let's liven up the system with even more test data, because these are empty tables like this. It's boring. And what will we tell him? We need to create, consequently, three condition templates. That is, we have, uh, standard ones for regular customers, for large orders. Create, let's say, 10 test commercial proposals with different statuses, what we have there. Drafts, sent, confirmed, rejected. In general, look. what we already have in the database. While he's doing it, let's go to Supabase and see. We have invoices, status. Let's see if he did it correctly. No, he did it via text type. That is, this type allows us to write any status. And it's more correct and proper, yes, in production, to use, naturally, enum, so-called, that is, when there is a choice, that is, there is status pending, approved, for example, and canceled. Now we will ask him to redo it when he finishes everything. That is, it's important to understand, one, in principle, main principle, that is, about, yes, that in principle it works. And don't try to do everything perfectly at once, but it will be very difficult to do. You can act iteratively. That is, we created what he offers. Okay, we looked. So, something doesn't suit us here, for example, fix it. That is, he is capable of not only creating tables based on our voice request, but he can also edit them: add columns, update columns, delete them, and so on. So, he's finished. The system has been successfully created and populated. He gave six templates, one invoice template, added 11 companies, and so on. Let's look at all this. That is, here we have, consequently, a table of test commercial proposals for now, dates, amounts, and so on. In general, all the data is here, in principle. And a link table between commercial proposals and, consequently, our products is also made. That is, everything is thought out quite competently here. The only thing I don't like, I definitely don't like that the statuses are made as text. That is, this is our invoices table. And in commercial proposals, the status is also text. Uh, listen, in the Invoices table and in the table where commercial proposals are stored, the status field has a text type. We need to make it an enum, so that it's standardized. That is, the current value, create, consequently, an enum and apply it to this table, so that everything is correct. That is, we gave him the task. and he went to redo his work. And with such iterations, we can bring our document management system to a production solution. That is, here he is creating the enum, that is, sending the page, in general, the most tedious part, yes, which takes a lot of time, he takes upon himself. Let's see if he managed to apply everything or not. Yes, there is. Here he set the invoice status. That is, here we can only choose. That is, we cannot set some value, for example, in Russian "in processing," so that we don't have a mess, yes, in the table. But this is if very briefly. And there is also a very important point that needs to be understood. Seriously, this is very important. We have created some kind of system foundation in a few minutes, yes. That is, these new tables we added, links, functions, this is just a skeleton, this is the basis. For this to work further in production, it's clear that we need to create an N8N Workflow for generating, say, PDF commercial proposals, set up sending these PDFs to the client via Telegram, refine the functions for specific business processes, that is, we need to delve into this, test everything, handle errors, add some data validation, yes, like we did with enum, I don't know, set up notifications for managers. That is, there are still many development options here. And this can take another week, maybe even two, maybe a month. That is, it's important to understand the details, what integrations are needed. There's still quite a bit of routine here, it's just a little different now. Before, we Googled queries or asked AI, it told us, we copied, pasted, and so on. And here it's done much easier, if anything. Yes, while I'm talking to you, he's still working here. And MCP speeds up far from everything. It speeds up only the most tedious part, that is, writing the queries themselves, creating the structure. You still have to think with your head. And your head is needed, precisely yours. Sorry, but AI won't replace your brain. You must understand what logic is needed for a specific business, how to correctly structure data, what cases need to be handled, yes, how it will be used. And this is not some magic button, to make me. It's still a tool that only takes over the routine. As long as you think with your head, understand what you're doing, set the task clearly, and then it will do it in minutes. If you feed it bullshit, like I'm doing now, yes, you'll get bullshit too. I didn't say here for no reason that we don't need to create 30 tables. It's not very smart. It will design a system here that we'll spend a week just figuring out what it did. Therefore, it's important to eat the cake in parts. So, yes, MCP, of course, speeds things up a lot, but testing, refining, thinking, all this still remains with you. It's just that now you focus on logic, not on how to write an SQL query or set a trigger on a table. Okay, the statuses are corrected, let's move on. It's going to get even cooler. And in fact, it's very cool, yes, that this structure is already working. Data is being written, functions are being called, statistics are being calculated. This is a living system. And you know what? With the help of MCP, you can not only develop a database, but also analyze, that is, conduct some really serious business analytics without writing a single line of SQL or assembling some kind of N8N Workflow. Now I'll show you what I'm talking about. That is, in fact, I don't know, a product manager, a business owner, a marketer, anyone can ask questions about the data in our database, without SQL, without an analyst, without waiting a week for, I don't know, a developer to be free to export it for you. Everything, now we will conduct, well, quite serious business analytics without a single line of code, absolutely without a single one. Therefore, I will show what I know, yes, if I mess up somewhere. Gentlemen, analysts, correct me in the comments. The point is not, yes, to teach you some kind of analytics, the point is to show that MCP gives access to analytics to anyone. Even if you, like me, vaguely remember what a median is, from a statistics course in college, we have in the table, consequently, many products, here more than 13,000. The spread here, in fact, is from, I'm saying, from 100 rubles to 700,000. The range is like, I don't know, from a bicycle to a BMW. Dozens of categories, hundreds of subcategories of products. And what to do? We just go to the clouds, turn on the input and ask: "Listen, we have, consequently, a database with equipment products, the Products table. Please tell me, what types of analytics regarding warehouse balances and the overall product assortment can be carried out? Suggest, I don't know, five or let's even say seven options for business. Excellent. Eight powerful types. So, ABC analysis of products. What will it show? So, benefit for business. Understand which products to focus on? Optimize procurement. Tarata. Dead stock analysis. Find products that don't sell and freeze money. Tarata. Popularity and margin matrix. Well, in general, he's still writing here, in general, deficit forecast and optimal order. Seasonality? Well, he made this up, we don't have data. But although, if there were data, for example, on sales, then no problem at all. Analysis of assortment completeness by categories. Tarata, cross-sales. Here he offers us options, what, what types of analytics to conduct. And no one prevents you from simply asking in human language what interests you and what you know and understand. That is, we turn on voice input and, uh, listen, uh, make, uh, a diagram of price distribution by categories, uh, minimum price, maximum price, average. Visualize all this interactively in an artifact and in an artifact. Also, make your conclusions from this analysis and show anomalies. Sending the message. Now he'll think for a few minutes and, consequently, will draw it for us based on our data. That is, he extracts data in read mode, that is, he takes, executes an SQL query, gets the number of products, minimum price, maximum, and will simply record this data in an artifact and provide it in a readable form. It's clear, yes, that this MCP can also be used with the same Kilocodes, as I showed in the previous video. You can do serious things there too. That is, you can immediately write it to a file, for example, CSV or something else. And while he's thinking, by the way, I noticed a feature. Guys, who use the cloud version of Supabase, I have not very good news for you, because I made a project on the European server, and it still works much slower than on SF Hosted. I don't know why. Because on SFT these requests just fly. Here he's just some kind of sluggishness. Everything, Supabase has woken up, he has executed, consequently, several requests. And now, based on the data he received, he is creating an artifact right on HTML, as far as I understand. Yes, he started writing in HTML, yes, in HTML. So, he's finished. Let's open it. Here he even found anomalies. Possibly a data error, but this is just more likely product categories. It makes sense to look. And here we, consequently, get categories. But he didn't export all of them, naturally. Price spread is ours. Such price distribution by categories, conclusions from the analysis, that you did some bullshit, man, you did some bullshit for us, friend. Let's have you create a new artifact based on the data you received, because this scheme doesn't reflect anything at all. It's not clear at all here, I would say. Here's something similar to what we need. There, apparently, JSTON just messed up. Here's more about the top five. Top five products. Refrigerated pizza tables, steaming tables, induction cookers, and so on. Comparison of price ranges for the top 15, that is, breakdown by categories. Critical anomalies in prices. Five categories found. Price spread 220 times. Well, there are probably different products in the same category. They need to be separated. That is, he immediately gives us recommendations. Main conclusions: premium segment refrigeration equipment, three clear price segments: premium, economy. Mass position in the middle segment. Anomalies need to be corrected urgently. Well, if they exist, I think an analyst will deal with this issue. The main thing is that you can quickly analyze this huge amount of data with just a voice message. What else can you ask him from what I remember, there is ABC analysis and XYZ analysis, so-called. Uh, listen, uh, conduct, uh, wait, we don't have sales data, and this is the problem, so we'll do a simplified version based on prices and balances. Not ideal, probably, but the principle, I think, will show. Conduct ABC XYZ analysis, ABC by price, that is, importance, yes, we have, consequently, X YZ by product availability in stock. Let it be a 3x3 matrix, I think it's called, and write conclusions. Format all this, yes, in the form of a new interactive artifact. That is, for all categories, describe in detail what, how, and why. And he will get this data and, based on this data, roughly speaking, create an HTML page right online. Here's the data he got, he'll create a cool artifact. This approach, yes, with quick analytics. I also showed videos about N8N MCP. You can do similar things there too. Again, naturally, you can output this data not in the form of artifacts, but write it to files, in a table, it's not a problem. But for this, probably.
Still, it will be more convenient with Kilocode. While the artifact is generating, I came to a very important thought. You probably noticed most attentively that we essentially used only one of the tools. Mainly, it's the execution of SQL queries. That is, to do a full overview of the MCP server, what needs to be done here. Well, I don't know how many hours the video will need. Everyone will definitely be able to sleep. Done. What do we get inside? We will now expand it like this. A 3x3 matrix with distribution. So ABC is classification by revenue. So he wrote by cost, probably of the goods. And classification by availability in stock. That is, we have ABC XYZ analysis. What it represents, for those who are not in the know, this is probably the only thing I remember from analytics. AX is ideal. That is, these are goods, goods that generate high revenue and are in stock. Everything is great here. Here, accordingly, the average value, that is, the revenue is high, but there is not much availability. And low availability for those goods that bring us revenue, that is, expensive ones. Well, from the data we have. We have two items without availability. They need to be replenished urgently. He found it. Okay. Revenue, attention, yes-yes. Well, in general, we'll see. Critical problem. Category A. That is, we have exactly, uh, goods that are expensive, and they generate revenue, yes, but they are not in stock. The best goods, but they are not in stock. Category A brings 7% of all revenue. Well, I don't know where he got the revenue from. We weren't talking about revenue at all, brother, but they are practically not in stock. Yes-yes-yes, you are losing and so on. Your stars are gone, in stock. Replenish stocks. Shelf cabinet. Group. Group is revenue for us. I say, he did it wrong. He apparently didn't listen to my voice messages, and he did it by revenue after all. And we have cost data. Well, I think you understood the general principle. I repeat, I am not an expert in analytics. If someone understands, write in the comments how it should have been done correctly. Teach me. But the main principle, I think, is clear. That is, uh, and you can conduct complex analytics even on some incomplete data. If the data is complete, then, naturally, the quality of this analytics will be much higher. And it is very important, yes, that you understand it yourself. The more you understand, the cooler and faster you will get the result. Listen, show me the five most expensive items in stock. Here are the top five most expensive items in stock. and then an induction hob, cost of stock, number of units, and so on. That is, we can find there, as he suggested, price anomalies, yes, outliers in categories, maybe some item should be attributed to a different category. That is, in a few minutes or maybe a few tens of minutes, yes, if a more in-depth analysis is conducted, or if there is more data, you can get a lot of insights. Okay, let's leave the territory where we don't understand much and are not knowledgeable about this issue, and let's touch on another very important topic. What if we need, a fairly frequent case, to move from cloud Supabase to self-hosted, that is, to transfer data to our own server or to make a backup, or if the 152-FZ on personal data happens at the door. I will show you how in 10 minutes to transfer this entire database with all, uh, respectively, data from these tables, from the cloud, so to speak. I specifically uploaded it here to Supabase, and for this, we will only need two commands. That is, in fact, this is probably the last critical topic in this video. It might be a bit boring, but, [ __ ] very important. And a typical situation, what people often ask about. That is, a person, for example, is creating a startup, starts on the cloud version of Supabase, it's convenient, fast, there are free limits, it's great, you start to develop, grow, and then two blows. The project has grown, needs more capacity. That is, Supabase, even, well, on the free tariff, it's really only enough for development, in fact. And if you start generating load, you start getting users, naturally, the bills can be hundreds of dollars a month. And the second is about personal data of Russian citizens. That is, by law, they must be stored on Russian servers. And you realize that you need to move, yes, to Selfhosted, to have your own server, your own control, your own data in Russia, but how to transfer it quickly and how not to lose it. And this is one of the most frequent cases that people regularly contact me about. With our MCP, it's simple, very simple. Supabase, by the way, is self-hosted. I have a video on YouTube, it turns out, how a DevOps team sets up a server, deploys Supabase from scratch with one command. If you haven't watched it, I recommend watching it. The link will be in the description and at the end of this video. I explained all these issues there. In short, installation is not a problem for us. And it would seem that we have tools for creating backups. And there is a very important technical point, that the MCP protocol itself does not allow transferring files and text larger than 1 MB. This is a limitation of the protocol itself, not mine, nor even the cloud's. It's just a standard. And our database, I remind you, has 13,500 items. This is tens of megabytes here and probably under a hundred, or maybe more, vector representations. That is, there is quite a lot of data here. And we cannot transfer all of this directly through MCP. That is physically impossible. Therefore, I made these two special tools quite cleverly. These tools do not create a backup for you, they do something cooler. They generate a personalized instruction for your specific database with your data, your parameters, that is, logins, keys, server address, and so on. And it takes your data and looks at what version of the operating system it is running on, whether it's Mac or Windows, installs the necessary software if needed, creates ready-made commands where all the data is already substituted. That is, you don't need to search in the interface, take these connection keys, where is which host, where is which password. That is, all of this will be filled in by default. And there are two options. The first, probably the most convenient, it will do everything automatically for you, if it has access to your terminal and file system, that is, to the computer itself. It's quite simple, for example, on Mac. That is, there is a tool here, Ctrl Mac, here it is, and a tool called File System, I think, yes? These are standard tools, and they work quite correctly. Then it will do it itself. That is, it will simply write a script, launch the terminal. Well, you'll see now. The second option, if it doesn't have access, it will give you ready-made commands and instructions within the chat, but you will need to copy and paste these commands manually into the terminal. That is, you will have to do it yourself, but unlike a regular chat, you won't have to substitute passwords, so to speak, into some template. That is, it doesn't give abstract examples. But your data, your keys, your passwords, your server address. Look, we need to make a full backup of my Supabase with all data, functions, triggers, and so on. The MCP server is used for this. That is, it will give you instructions, you just create a script on your desktop and save the backup file there. That is, it goes, gets the connection data, instructions on how to do everything. It sees that we have, what access it has to the file system, yes? For this, I remind you, you will need to install this thing, File System, and allow access. It launches the terminal. So, an error. So, it's impossible with another version. So, something is complaining. We have a backup creation error. Well, we show everything directly. Usually, it doesn't have this. We'll send him the error. I see the problem, what you have installed. Accordingly, it is launching something. That is, it is installing the necessary software that is missing. So, we'll close this terminal. The download of the required version has started. So, this looks beautiful. For those who haven't seen it, it will install it and, uh, yes, then it will update the script to use the correct version. Well, let's wait. I, by the way, understood why it gave an error that the version was wrong. I literally, well, about an hour ago, I made a backup when I uploaded it to the cloud, because the cloud version of Supabase probably has a newer version than I do now. That's why it, naturally, complained that we need a different version. Well, it was installed, so we'll just copy it. And, listen, everything is installed, let's make a backup then. As agreed. Well, it's even better to show how it actually happens than if it were ideal from the start, because in fact, if you have all the software installed, you tell it once, and it does it. The main problems that are possible are precisely because the version is wrong. So, uh, tara-tara. Something here, it's not going according to plan, it's complaining. So, we'll write to it. We need to make the file executable again. Well, yes, because it launched it for the first time. Well, in fact, the connection has started and the data reading has begun. And it will copy everything for a few minutes. And yes, by the way, while it's copying, it would be much easier in Kilocode because the terminal is native. That is, I'll open it now, while it's loading. That is, here, Kilocode itself can easily execute commands, yes, and see the output. That is, it would have fixed everything itself. Most likely, with our first message. And Cloud, as it is, is more user-friendly. For recording videos, it's much more convenient, of course. And, well, frankly, it works faster than Kilocode. It has limited access to the terminal, that is, it can create a file, launch it, but it cannot see what is happening after launching a script or executing a command. That's all. In fact, it took about 10 minutes. That is, it read, uh, respectively, using the script, all the tables, all the data, saved them all, and we got a backup file of 100 MB. That is, MCP cannot handle such a volume. How do we upload all this, for example, to the self-hosted version? Here, I've just cleaned up what we did. We just need to enter the keys for the new version. I have, accordingly, already done that. And now Cloud is working with our self-hosted version. Uh, look, show me what tables we have. Uh, uh, in Supabase. In your Supabase database, there are currently only three tables. All system ones. Then it seems that there are no user tables. Well, that's logical, because Supabase is just starting. We need to restore the backup. It is, accordingly, on my desktop. Here's the file. And what do we do? We just tell it: "Listen, we need to restore the full Supabase backup. It's on my desktop in the Backup folder, I think, something like that." In general, look at its name, and I'll tell you if it's it or not. We could, of course, send it a link here. Well, like, let it look for itself. Using the exact same tools, that is, using the File System tool, it looks at us. Now I'm looking for folders, I'll try to search in the home directory. Cloud just updated, and it's starting to play dumb. Use the File System tool, and then you can see the data on your desktop. What are you looking for with this find? Decided to pretend to be a snake. Here. So, we told it, it looked and found it. Here's the backup file. This is it. Ah, yes, this is it. Upload it completely to our server using Supabase tools. That is, it also receives instructions through the tool. So, excellent, it received full instructions. It creates a restore script on the desktop and, accordingly, will also make it executable and launch it. That is, a similar terminal will open for us. Let me close this one for now, and we'll see now. The terminal has opened. Table schema public zero. Installing the structure. So, why? Well, yes, different Supabase versions, different PostgreSQL versions. And it started to go crazy. Well, that's normal. Unsupported versions in the file header. It's complaining. I'm showing it as it is. That's why, precisely because of version mismatches, because my self-hosted is relatively old, the cloud Supabase is new, that's why it, in principle, figured it out itself. That is, I just sent it that there was an error and our script is not executing. It figured it out, installed the new version, that is, chose it specifically in the script, corrected it, and is now uploading. That is, the upload here is actually faster. That is, it's literally about five minutes, usually twice as fast as creating a backup. Errors can pop up here. There's no point in paying attention to them, because in fact, it will do everything. Well, and, accordingly, it will check everything. And we will see with our own eyes whether the tables appear or not. Well, they, in principle, have already started appearing somewhere even with data. That is, here are the clients, they have arrived at the corner coffee shop. Well, and, accordingly, that's all. Here, it even drew a table in the script that everything is ready. Let's check. Refresh. We look at our products. There are vectors, there are. So, what else did we upload for clients? Yes, so let's go through the functions. They are also there. That is, our vector search has arrived here. In general, everything is exactly the same as it was. In this way, even in complex situations, because, honestly, while I was debugging, the versions of both the cloud version and mine matched, and it was all done with literally one command. But in fact, the migration is now not a pain at all. It's a couple of commands, yes, if there are any inconsistencies, you need to poke it a couple of times for it to correct. That is, MCP gives us ready-made instructions with keys. I remind you, we didn't enter keys or logins anywhere. You either copy it yourself, or it will do it for you if you give it access. That is, in fact, for it, it's no more difficult than cooking soup according to a recipe. Okay, we've come a long way, but in fact, for today's video, despite the fact that we created a project from scratch, improved existing ones, made backups, performed analytics, we used literally a few tools of our MCP server and in fact, the development process itself. There are a lot of features here for creating web services, and so on. It's not even one video, I think five or ten videos would be needed to cover all the functionality, it would be really very difficult. You just need to start building projects with this thing. This is a small teaser for you. That is, in fact, we can, for example, here's the show storage objects tool. For those who don't know, in Supabase, this is file storage. We can also do a lot here, create buckets for files to be uploaded there, so that only images, for example, are uploaded there, so that it doesn't upload viruses, yes, instead of photos, and so on. There are tons of nuances here. So, to summarize, what usually takes weeks, and sometimes months of work, we have compressed into one video. The first thing we did was create a database from scratch, created a lot of tables in literally a few minutes without writing queries, messing around in the Supabase interface, Googling. And we did all this by voice. Second, we improved a real project with 13,500 items, laid the foundation for implementing functionality for sending commercial proposals, issuing invoices. Third. We conducted several analytical tests. Fourth, we made backups, migrated the entire database, from the cloud version, to self-hosted in literally about 15 minutes. These are four full demos. What usually takes from a week to a month of work, in one video. Now the important question: how much of my time did the development of this MCP server take? Honestly, about a month, maybe a little more. I lost count, honestly. I spent a month so you can save months. It sounds like a slogan, but it's true. And yes, I use this MCP server myself in all my projects. Moreover, I'll tell you, it had an alpha version, with which I made the N8N MCP server. If you haven't watched the video, watch it too. I think you'll be impressed. And you think I worked hard for a month or even more out of altruism? But no, of course, it's one of my tools now. For example, this seller that you saw in the video was entirely designed using this MCP server. All tables, data structures, relationships, everything through Cloud and Kilocode and this MCP without manually navigating the Supabase panel. Access to the Supabase MCP server is only available to subscribers of my private channel. I don't plan to sell it separately yet. Also, in the private Telegram, you will find all the materials from my videos. Instructions for installing N8N, instructions for installing Supabase, almost 3 hours of material on Kilocode, access to the DevOps team, which will set up the server with N8N and Supabase for you, access to the N8N MCP server, which will help you program chains. If you haven't seen the videos about these tools yet, I recommend checking them out. Links to the private channel and these videos will be in the description. Also in the description, you will find links to all my social networks. You can subscribe so you don't miss new videos. Well, and if this video was useful for you, a like, subscription, and comment are the best support from your side. Thank you for watching the video to the end. You're a good person, really. Bye. Build with and don't forget to back up.