Project Overview: Social project - Educational multivendor marketplace built with Next.js and Supabase (PostgreSQL). The core concept is fundamental: The primary experience is school-based community exchange. Families first interact within their own school community. However, users must also have the option to expand their search to nearby sellers outside their school. This hybrid model (private community + local discovery) is central to the architecture of the platform. The UI has already been scaffolded using Vercel’s v0. We now need to complete backend logic, database structure, permissions, and filtering to make the MVP fully functional. Core Functional Principle 1. Default mode: Users see listings only from their own school. 2. Optional expansion: Users can switch to “Search nearby” and see listings from other users within a defined radius (e.g., 5–50 km). The system must support both flows cleanly and securely. Scope of Work: 1 Database & Access Model Design or refine Supabase schema to support: Schools Users (linked to a school) Listings Donation requests Location (latitude/longitude or postcode-based) Key requirement: Each listing belongs to a school but can be discoverable outside the school when “nearby mode” is activated. Implement Row Level Security (RLS) rules carefully: By default: only same-school listings When nearby filter is active: include listings within radius 2 Marketplace Logic Implement: User registration & school join via code Listing creation (sale or donation) Filtering by: School (default) Category Grade Nearby radius Toggle switch: “My School” / “Nearby” Donation request flow Shool role to manage donation assignments No payment integration required. No logistics required. 3 Geolocation One of the following approaches: Store precise coordinates (lat/lng) for users or listings Or postcode-based distance calculation System must allow: Radius-based filtering (e.g., 5km, 10km, 50km) Efficient querying (indexed location fields) 4 Code Quality & Deployment TypeScript Clean Next.js App Router structure Supabase properly configured Database migrations committed Clean Vercel deployment Environment variables documented Acceptance Criteria The MVP is complete when: Users register and join a school Default feed shows only their school’s listings Users can switch to “Nearby” and see listings within radius Listings marked as donation can be requested School can assign donations No console errors Deployment stable on Vercel