Video summary
Supabase Complete Crash Course in Bangla | React, RLS, Realtime & Self-Hosting
Main summary
Key takeaways
Main ideas / lessons (what the video teaches)
-
Supabase isn’t “just an open-source Firebase.” It’s better understood as a complete backend platform that bundles multiple services together:
- Database (Postgres)
- Authentication
- Auto-generated API
- Real-time updates
- Storage (file uploads)
- Security (specifically Row Level Security / RLS in Postgres)
-
Modern web app architecture mindset: a frontend alone isn’t enough.
- You need user identity (login)
- You need authorization (what data users can access)
- You may need file storage and real-time updates
- You need security enforced on the backend (not just in the UI)
-
How the Supabase request pipeline works (conceptually):
- Your React app calls the Supabase client
- Supabase provides an auto-generated API layer
- Requests include identity info (via JWT)
- Supabase checks authorization using RLS
- Auth handles identity; Postgres enforces permissions
-
Course goal: build a Todo app step-by-step to teach beginners how to think about and implement a production-style backend.
-
Infrastructure choice matters:
- Supabase Cloud is managed and easier for prototyping
- Self-hosted Supabase provides deeper understanding/control but requires operational responsibility (Docker containers, env vars, domains/SSL, SMTP, backups, updates, troubleshooting)
Methodology / step-by-step workflow presented
A) Video course plan (learning sequence)
- Understand Supabase conceptually as a backend platform (not only an SDK)
- Set up a hosted or self-hosted environment
- Create a database table in the Supabase dashboard
- Connect a React project to Supabase
- Implement CRUD operations (create/read/update/delete)
- Add authentication
- Enable and configure RLS (Row Level Security)
- Add real-time behavior using subscriptions
- Use Storage for file uploads and show images in the UI
B) Self-hosting setup (high-level instructions)
- Use a VPS and a deployment UI tool (the video uses Coolify)
- Install Supabase from the Coolify dashboard as a resource
- Retrieve admin credentials from environment variables
- Access the Supabase dashboard via the provided URL
- Note that under the hood Supabase runs as Docker containers (services, env vars, domains/SSL, SMTP, etc.)
C) Local development prerequisites (Windows CLI path)
- Install Docker Desktop
- Install Git
- Install Node.js (version 20+ mentioned)
- Install Scoop (Windows package manager)
- Use Scoop to install Supabase CLI
- Verify with
supabase version - Launch a local Supabase project using the CLI
D) Build the Todo app with React + Supabase (CRUD flow)
-
Create a React app UI with:
- Task creation
- Task list + pagination (“Load more”)
- Login and signup screens
-
Create a table in Supabase (example table: task/todos)
- Columns include things like:
id(auto)titledescriptionimage(stored as a URL/text initially in the DB)
- Enable real-time optionally
- Enable RLS later when security is configured
- Columns include things like:
-
Connect React to Supabase:
- Copy the “Connect” instructions from the Supabase dashboard
- Add environment variables to
.env - Create a Supabase client utility module (e.g.,
supabase.ts) - Install the client library via npm (
@supabase/supabase-jsmentioned)
-
Read (Select):
- Use
select()from the table to fetch todos/tasks into React state
- Use
-
Create (Insert):
- Use
insert()and update local React state with the returned row(s)
- Use
-
Update:
- Use
update()with a filter likeeq(id, ...)
- Use
-
Delete:
- Use
delete()with a filter likeeq(id, ...) - Remove from local UI state and rely on server enforcement with RLS once enabled
- Use
E) Searching + pagination (server-side approach)
-
Add states for:
searchvisibleCount/ page size (example: 3)totalCount(to decide whether “Load more” should show)hasMore(derived fromtotalCountvs current visible results)
-
Implement querying with:
orcondition to match title usingilike-style search pattern (case-insensitive)range()for pagination- request count (e.g., exact count) to support
totalCount
-
Add a debounce (example delay ~300ms) so queries run after the user stops typing
-
Emphasis: search/pagination are implemented on the server via Supabase, not only client-side filtering.
F) Authentication flow (signup/login/logout + session restore)
-
Signup page:
- Use Supabase
auth.signUpwithemail+password - Handle errors and show them to the user
- Redirect to login on success
- Use Supabase
-
Email verification:
- In self-hosted mode, SMTP must be configured or verification email may not arrive
-
Login page:
- Use Supabase
auth.signInWithPassword - On success, redirect to the main app route
- Use Supabase
-
Logout:
- Use Supabase
auth.signOut - Redirect to login
- Use Supabase
-
Session persistence on reload:
- Use an effect to read the current session (restoring
sessionstate)
- Use an effect to read the current session (restoring
-
Real-time session state updates:
- Subscribe to
onAuthStateChangeso UI updates properly on sign-in/sign-out - Unsubscribe in cleanup to avoid leaks
- Subscribe to
G) Security: RLS authorization (the key enforcement mechanism)
Core lesson: UI restrictions are not real security. Even if buttons/menus are hidden, a malicious user can call Supabase API endpoints directly.
The RLS process shown
- Initially disable RLS to confirm the app works.
- Enable RLS on the
tasktable. - Apply policies:
- Select policy (public/authenticated read depending on template used)
- Insert policy (deny/allow based on user identity)
- Update policy
- Delete policy
- Add a
user_idcolumn to the table (since policies rely on matching row owner):- Create
user_idcolumn typeuuid(UUID mentioned)
- Create
- In React create flow, insert
user_idfrom the current auth session:user_id: session.user.id(as described)
Policy logic (conceptual)
- Allow access only when:
- the authenticated user’s UID matches the row’s
user_id
- the authenticated user’s UID matches the row’s
- Otherwise deny (Supabase/Postgres enforces it)
Practical outcome demonstrated
- Without proper RLS policies:
- inserting fails with “RLS policy violation”
- After adding:
- users can create/read/update/delete only their own rows
- deleting actually removes from the database (not just UI)
H) Real-time updates (subscriptions)
- Enable real-time on the table in Supabase dashboard
-
In the React dashboard component:
- Create a Supabase channel (e.g., topic:
Task) - Subscribe to
postgres_changesevents:- Example: listen for
INSERTon thetasktable
- Example: listen for
- On insert, update React state using the payload (
payload.new) - Unsubscribe during cleanup
- Create a Supabase channel (e.g., topic:
-
Edge case highlighted:
- If you both insert via API and separately receive the real-time insert event, you may see duplicates
- The fix suggested is adjusting state update logic (not adding twice)
I) Storage for file uploads + public image URLs
-
In Supabase dashboard → Storage:
- Create a bucket (example:
task banner) - Set it to be public (or at least readable based on policies)
- Create a bucket (example:
-
In the app:
- Provide an image file input in the form
- On task creation:
- If an image exists:
- Upload the file to the bucket (
storage.from(bucket).upload(path, file)) - Generate a public URL (
storage.from(bucket).getPublicUrl(path)) - Save that URL alongside the task record
- Upload the file to the bucket (
- If an image exists:
-
RLS/storage policies:
- After enabling RLS for storage-related operations, you must create storage policies too
- Otherwise uploads can fail (the video reports an error and then adds a storage policy)
-
Verification:
- Reload app and confirm the uploaded image appears correctly from the stored public URL
Sources / speakers
- Speaker: Not explicitly named in the subtitles (presenter/teacher is implied).
- Sources mentioned (systems/docs):
- Supabase (platform documentation and dashboard UI)
- PostgreSQL (via Supabase RLS concept)
- React
- Supabase CLI
- Docker
- Coolify
- Hostinger VPS
- Google SMTP
- Git, Node.js, Scoop
- Browser developer tools (Network tab / console)