Skip to content
All projects
In progressSoftware

CourseMate

Study groups for Waterloo students taking the same courses.

  • Next.js
  • Supabase
  • PostgreSQL
  • Vercel

Built

  1. Email sign-in with Supabase Auth
  2. Postgres model: profiles, courses, groups, memberships
  3. Row-level security guards every row

Architecture

  1. Browser
    Next.js UI
  2. Supabase Auth
    email sign-in
  3. PostgreSQL
    profiles · courses · groups · memberships
  4. RLS policies
    who may see which rows
Data model and request path

Insight

Put security where the data lives. RLS checks every query inside Postgres, so the UI never has to be trusted.

Challenge

ProblemClient-side permission checks can be bypassed.

FixMoved authorization into PostgreSQL RLS policies keyed on auth.uid().

Code

sqlIllustrative sketch — not copied from the project
alter table groups enable row level security;​-- Members can read the groups they belong tocreate policy "members read their groups" on groups  for select using (    exists (select 1 from memberships m            where m.group_id = groups.id              and m.user_id = auth.uid())  );
The pattern an RLS policy follows — written to explain the design, not copied from the CourseMate code.

Status

Done

In progress — the code isn't public yet.

Next

  • Sign in with email
  • Find or start a study group for a course you're taking
↑↓ navigate↵ selectesc close