Menus

Prerequisites

To use MM Base, you will need the following resources in Supabase:

  • mm_posts table: Stores page and content data
  • Admin account: Account to log in to MM Base
  • mm_assets bucket: Storage for uploading images and files

1. Sign up for Supabase and create a project

If you already have a project, you can skip this step.

Supabase Sign-up
1-1. Sign up at Supabase.

Create Supabase Project
1-2. Create a new project.

2. Create mm_posts table and mm_assets bucket

Copy the provided SQL code and paste it into the SQL Editor.
*Before executing, note that if a table or bucket with the same name already exists, conflicts may occur.

SQL Editor
------------------------------------------------------------
-- 1. Create table for storing content (mm_posts)
------------------------------------------------------------
create table public.mm_posts (
  id int4 generated by default as identity primary key,  -- Unique ID (auto-increment)
  created_at timestamptz not null default now(),         -- Creation timestamp
  public boolean not null default false,                 -- Visibility flag (public/private)
  title text not null,                                   -- Post title
  description text,                                      -- Post description
  image text,                                            -- Cover image URL
  start date,                                            -- Start date
  "end" date,                                            -- End date
  page_data text,                                        -- Page content data (JSON, HTML, etc.)
  path text unique,                                      -- Unique path/slug
  user_id uuid not null references auth.users(id) on delete cascade -- Owner's user ID
);

------------------------------------------------------------
-- 2. Enable Row Level Security (RLS)
------------------------------------------------------------
alter table public.mm_posts enable row level security;

------------------------------------------------------------
-- 3. Policies for mm_posts table (owner-based access)
------------------------------------------------------------

-- Allow delete only for the owner
create policy "mm_posts delete own rows"
on public.mm_posts
for delete
using (auth.uid() = user_id);

-- Allow insert only for the owner
create policy "mm_posts insert (owner)"
on public.mm_posts
for insert
with check (auth.uid() = user_id);

-- Allow update only for the owner
create policy "mm_posts update own rows"
on public.mm_posts
for update
using (auth.uid() = user_id)
with check (auth.uid() = user_id);

-- Allow read for public posts OR for the owner
create policy "mm_posts read"
on public.mm_posts
for select
using ( public OR auth.uid() = user_id );

------------------------------------------------------------
-- 4. Bucket-level policies for mm_assets storage
------------------------------------------------------------

-- Allow bucket info read for everyone
create policy "MM_ASSETS: read for all"
on "storage"."buckets"
for select
using (id = 'mm_assets');

-- Allow bucket insert only for authenticated owner
create policy "MM_ASSETS: insert for owner"
on storage.buckets
for insert
to authenticated
with check (
  auth.uid() = owner
  AND id = 'mm_assets'
);

-- Allow bucket delete only for the owner
create policy "MM_ASSETS: delete for owner"
on "storage"."buckets"
for delete
using (
  id = 'mm_assets'
  AND auth.uid() = owner
);

------------------------------------------------------------
-- 5. Object-level policies for mm_assets storage
------------------------------------------------------------

-- Allow object read for everyone
create policy "MM_ASSETS_OBJECTS: read for all"
on storage.objects
for select
using (bucket_id = 'mm_assets');

-- Allow object insert only for the owner
create policy "MM_ASSETS_OBJECTS: insert for owner"
on storage.objects
for insert
with check (
  auth.uid() = owner
  and bucket_id = 'mm_assets'
);

-- Allow object delete only for the owner
create policy "MM_ASSETS_OBJECTS: delete for owner"
on storage.objects
for delete
using (
  auth.uid() = owner
  and bucket_id = 'mm_assets'
);

3. Create an admin account

In the left-hand menu, go to Authentication, then click Add user in the top right, and select Create new user.
You can use this account to log in to MM Base.

Create Supabase Admin Account