Posting & Feed How it works
This page summarizes the data model and UX for creating posts and how the feed behaves.
Data model
- posts: id, author (profiles.id), content, media_urls, created_at, visibility
- likes: id, post_id, user_id, created_at
- comments: id, post_id, author, text, created_at
Creating a post (client flow)
- User opens the
CreatePostUI. - The client validates content and uploads media (if any).
- The client inserts into
posts(via direct Supabase insert or a protected API route). - The UI optimistically updates the feed and reconciles with the server response.
Feed behaviour
The feed is implemented via components/Feed.tsx. It orders by created_at DESC and supports cursor-based pagination. Likes and comments are posted to their respective tables and update counts optimistically.
Troubleshooting
- If posts don't appear: check the insert network request, RLS policies, and optimistic UI rollbacks.
- If media fails to upload: check storage permissions and allowed file types.