How isayanpal/roomie-finder works
Project Type and Purpose
• This is a full-stack roommate-matching web application built with Next.js (React + Server Components) and TypeScript.
• Purpose: allow students and professionals to create profiles, set preferences, find smart roommate matches, and chat in real time before committing.
• Key features: user onboarding (Google Sign-In via Supabase Auth), preferences management, match listing, in-app chat, and real-time notifications.
File Structure Analysis
• Top-level:
• next.config.ts, tailwind.config.ts, postcss.config.mjs, tsconfig.json – build and framework configs
• prisma/schema.prisma – database schema for Prisma ORM
• middleware.ts – Next.js middleware (e.g., auth guard)
• src/app – Next.js 13 (App Router) pages and server API routes under /api/*
• /api/* folders each contain route.ts files defining REST endpoints (chatHistory, matches, messages, preferences, profile, unreadMessages, user(s)).
• src/app/auth – Google OAuth callback and login page (page.tsx + route.ts)
• src/app/chat, /match, /preferences, /profile, /page.tsx – client-side pages using React components
• src/components – reusable UI building blocks
• custom – page-specific components (AuthForm, ChatHistory, MatchCard…)
• landingpage – marketing/landing page widgets
• ui – low-level UI primitives (Button, Input, Card…)
• magicui – specialized widgets (NumberTicker)
• src/lib – server utilities (Prisma client, helper utils)
• src/utils/supabase – Supabase client (browser) and server wrappers
• public & images – static assets
README Highlights
• Technology stack: Next.js, TypeScript, Supabase (PostgreSQL + Auth), Prisma ORM, Shadcn UI (Radix + Tailwind).
• Features emphasize Smart Matching, Profiles, Chat System, Real-Time Notifications, Google Sign-In.
Main Components
A. Frontend Layer
• Next.js App (React Server & Client Components)
• Pages: Landing, Auth, Profile, Preferences, Matches, Chat
• Components: UI primitives, custom widgets
• Supabase Client SDK for Auth & real-time features
B. Backend/API Layer
• Next.js API Routes (Route Handlers in src/app/api/*)
• middleware.ts for global tasks (auth verification, redirects)
• Prisma Client (src/lib/prisma.ts) ORM abstraction
• Supabase Server SDK (src/utils/supabase/server.ts) for DB and Auth management
C. Database & External Services
• Supabase PostgreSQL (user, profiles, preferences, matches, messages tables)
• Supabase Auth (Google OAuth provider)
• Vercel Hosting / CDN for static assets & serverless functions
Relationships & Data Flows
• User’s browser ←→ Next.js Frontend (pages/components)
• Login via Supabase Client → Google OAuth → Supabase Auth
• Frontend fetches data via built-in fetch() to Next.js API routes
• Next.js API Route → Prisma Client / Supabase Server SDK → PostgreSQL DB
• CRUD operations for Users, Profiles, Preferences, Matches, ChatHistory, Messages
• Real-Time Notifications
• Supabase real-time subscriptions (via WebSocket) or polling through API
• Frontend subscribed via Supabase Client -> display via NotificationBell component
Architectural Patterns & Principles
• Full-stack React SSR + Server Components (Next.js App Router)
• Layered separation: UI → API → ORM → Database
• Single codebase for front & back (monorepo pattern)
• Dependency injection of DB client via src/lib/prisma.ts
• Environment-configured external services (Supabase, Google OAuth)
• Component-driven UI architecture (custom vs. design-system primitives)