Every freelancer knows this message: "Hey, where are we on the project?"

Followed closely by "Can you resend the logo file?" and "Did I already approve that?"

I got tired of digging through email threads, so I built Ompaloom: a client portal I host myself. Each client gets a magic-link login and sees only their own projects, files, milestones, and messages. No monthly SaaS fee.

The UI was the easy part. The hard part was making sure Client A can never see Client B's stuff. Here are the three pieces that make that work.

The snippets below are simplified to show the pattern. Adapt table and column names to your own schema.

1. Row Level Security does the real work

The temptation with a React frontend is to filter in the query:

// ❌ This is NOT security supabase.from('projects').select('*').eq('client_id', myClientId) 

Anyone can open DevTools, drop the .eq(), and query everything. The anon key is public by design. The filter has to live in the database.

A simplified schema:

create table clients ( id uuid primary key default gen_random_uuid(), owner_id uuid not null references auth.users(id), -- the freelancer user_id uuid references auth.users(id), -- the client's login, set after invite email text not null ); create table projects ( id uuid primary key default gen_random_uuid(), owner_id uuid not null references auth.users(id), client_id uuid not null references clients(id) on delete cascade, name text not null, status text not null default 'in_progress' ); alter table clients enable row level security; alter table projects enable row level security; 

Then two kinds of access: the freelancer sees everything they own, and a client sees only projects linked to their client record.

-- Freelancer: full control over own projects create policy "owner manages projects" on projects for all using ( owner_id = (select auth.uid()) ) with check ( owner_id = (select auth.uid()) ); -- Client: read-only access to their own projects create policy "client reads own projects" on projects for select using ( exists ( select 1 from clients c where c.id = projects.client_id and c.user_id = (select auth.uid()) ) ); 

Two small things that matter:

  • Wrapping auth.uid() in (select ...) lets Postgres evaluate it once per query instead of once per row. Supabase recommends this for performance.
  • Enabling RLS with zero policies blocks everything. That's the safe default. Add access deliberately.

The same pattern repeats for milestones, messages, files, and invoices: each row links back to a project, and the policy checks who that project belongs to.

2. Inviting clients without leaking the service-role key

To send a client a magic-link invite, you need Supabase's admin API, which requires the service-role key. That key bypasses RLS entirely. If it ever ends up in a VITE_ env variable, it ships in your JS bundle and anyone can read it.

So the invite lives in an Edge Function:

// supabase/functions/invite-client/index.ts import { createClient } from 'npm:@supabase/supabase-js@2' Deno.serve(async (req) => { const { email, clientId } = await req.json() // 1. Who is calling? Use the caller's JWT, not the admin key. const userClient = createClient( Deno.env.get('SUPABASE_URL')!, Deno.env.get('SUPABASE_ANON_KEY')!, { global: { headers: { Authorization: req.headers.get('Authorization')! } } } ) const { data: { user } } = await userClient.auth.getUser() if (!user) return new Response('Unauthorized', { status: 401 }) // 2. Does this freelancer actually own this client? (RLS answers that for us) const { data: client } = await userClient .from('clients').select('id').eq('id', clientId).single() if (!client) return new Response('Forbidden', { status: 403 }) // 3. Only now use admin powers, server-side const admin = createClient( Deno.env.get('SUPABASE_URL')!, Deno.env.get('SUPABASE_SERVICE_ROLE_KEY')! ) const { data, error } = await admin.auth.admin.inviteUserByEmail(email, { redirectTo: 'https://portal.yourdomain.com', }) if (error) return new Response(error.message, { status: 400 }) await admin.from('clients').update({ user_id: data.user.id }).eq('id', clientId) return new Response(JSON.stringify({ ok: true }), { status: 200 }) }) 

The order matters: check who's calling with their own token first, and only then use the admin client. Otherwise any logged-in client could call your function and invite people into your workspace.

Clients then log in with a magic link. No passwords to forget, no "reset password" support emails for you.

3. Files: private bucket + signed URLs

Public buckets are convenient and wrong for client work. Contracts and unreleased designs shouldn't sit behind a guessable URL.

  • Make the storage bucket private.
  • Store files under a path that includes the project, like project_id/filename.pdf.
  • Add storage policies that reuse the same "does this user belong to this project?" check.
  • Hand out short-lived signed URLs for downloads:
const { data } = await supabase.storage .from('project-files') .createSignedUrl(`${projectId}/${fileName}`, 60) // valid for 60 seconds 

Even if a link gets forwarded, it expires in a minute.

What I'd tell anyone building something similar

  • Never trust a frontend filter. If RLS isn't enforcing it, it isn't enforced.
  • Test as the wrong user. Log in as Client B and try to fetch Client A's project ID directly. You want an empty result, not an error you're catching in React.
  • Keep admin keys in exactly one place: server-side functions, never .env files that Vite reads.
  • Use your own branding. Clients trust a portal that looks like your business more than a link to yet another SaaS.

Want to skip the build?

I packaged the full thing as Ompaloom: React + TypeScript + Vite + Supabase source code, the database migrations, the client-invite Edge Function, branding assets, and a Vercel deployment guide. It also covers milestone approvals, per-project message threads, and invoice records with paid/unpaid status.

Fair warning: it's self-hosted, not a SaaS. You'll set up Supabase, SMTP, and Vercel yourself. If you're comfortable with that, it's about an afternoon of setup. One-time payment, no subscription.

👉 Ompaloom on Gumroad

How do you handle client communication right now: email, Notion, a SaaS portal? Curious what's working for people 👇