<aside> ✅
Prerequisites: to follow along you will need:
Now I love curry but I have a problem, every time I order takeout I promise myself I’m going to try something new, but then I end up ordering the same thing I always order. There’s a whole world of asian cuisine I am missing out on. I think it would be really nice if the restaurant I order from had some way of making a recommendation like a waiter in a restaurant.
In this series of blog posts I am going to walk you through the steps to create a takeout agent using Supabase and n8n. Throughout this series you will learn how these two platforms do a lot of the heavy lifting for us, helping us create our agent in as little time as possible without compromising things like security. Let’s get started!
Like most dev pipelines, we’re going to start by developing locally before deploying, in the last post in this series we will cover the steps to deploy your application.
First of all I want us to think about the design of our database. A little time spent here will save us lots of time later on. I like to use Mermaid Diagrams for planning my database design. Mermaid uses markdown definitions to create diagrams which can then be downloaded to your local machine and checked into source control.
Here you can see my Mermaid Diagram for our takeout restaurant. This is a simplified e-commerce model, we have five tables for storing details about customers, their basket, order, order items and products. The customer table has a foreign key on the primary key, this is because the unique id for the customer will also refer to the user id in Supabase, more about this later. You will also notice we have a basket table. This acts as a temporary holding area, making it easier for the agent to manage items without having to navigate multiple tables, you will learn more about this in part two.

The first thing we need to do is initialise our Supabase project. If you don’t have Supabase and Docker installed locally go ahead and do that first, instructions are here.
Once installed use these commands to initialise and start your project
$ cd ~
$ mkdir takeout
$ cd takeout
$ supabase init
$ supabase start
Now we have Supabase running locally we can start to create our database.
The nice thing about using Mermaid diagrams is we can sync them with Visual Studio Code using the Mermaid Extension.
Install the Extension, log in to your Mermaid account then select which diagram to use. This will create a local version of your diagram which we can use to create our schema in Supabase.
You can use my Entity Relationship Diagram here.
.png)
Here you can see we now have the ERD saved locally, and any changes we make will be sync’d with the version in the cloud.
This is where it gets interesting, we could generate Supabase migrations manually by entering the relevant SQL statements to create each individual table but instead, we’re going to save some time and use Claude AI to do this for us.