How denniswoods383/karu-teens-social-platform works
Project type and purpose
• This is a full-stack social media web application built with Next.js (frontend and serverless API layer) and Supabase (backend as a service offering Postgres, Auth, Realtime, and storage).
• Its core purpose is to allow university students to register/log in, manage profiles, create and consume posts, chat in real time, and receive notifications, with AI-powered tools and feedback.
File structure
• Top-level:
• frontend code in next.config.js, pages/, src/components, hooks/, lib/, styles/
• database/ and supabase/ folders with SQL scripts and migrations
• config files: .env.example, supabase configs, tailwind.config.js, tsconfig.json, vercel.json
• markdown files for deployment, optimization, audits, and feature lists
• pages/api/: Next.js serverless functions act as a lightweight backend and proxy to Supabase or other services.
• src/components/, src/hooks/, src/lib/: modular React UI, hooks, and library code for analytics, caching, cloudinary, mpesa, notifications, etc.
• supabase/migrations/: schema migrations defining tables (users, posts, messages, payments, movies, study groups, etc.)
• public/: static assets, service worker, manifest, UI guidelines
README
• Confirms Next.js + React + TypeScript + Tailwind CSS for the frontend
• Supabase for DB, authentication, real-time updates
• Cloudinary for media storage
• Vercel for hosting/deployment, Formspree for form handling
a. Main components
• Client (Next.js React app delivered via Vercel CDN)
• Next.js Serverless API (pages/api/ endpoints)
• Supabase Backend
• Auth service (JWT issuance, RLS enforcement)
• Postgres database (users, posts, comments, messages, relationships, notifications, audit tables)
• Realtime engine (WebSocket channels for feed, chat, notifications)
• Storage (optional, used via Cloudinary for media)
• External services
• Cloudinary (image/video hosting)
• Formspree (feedback forms)
• Mpesa API (mobile payments)
• Possibly email provider via pages/api/send-email
• Third-party monitoring/logging (errorLogger in src/lib)
b. Relationships and interactions
• User’s browser loads the Next.js app (SSR/SSG + client hydration)
• UI makes calls to:
• Next.js API routes for custom logic (e.g. /api/mpesa/pay, /api/send-email)
• Direct Supabase client via src/lib/supabase.ts for auth, queries, subscriptions
• Supabase client SDK connects to Postgres over REST/GraphQL and to Realtime via WebSocket
• Media uploads from UI to Cloudinary; URLs stored in Supabase records
• Notifications emitted via Supabase Realtime and pushed to the client
• Feedback forms posted to Formspree endpoint
c. Architectural patterns and principles
• Full-stack “serverless” model: UI + API co-located in Next.js
• Modular React component library (feature-based folder structure)
• Hook abstraction for data fetching and real-time updates (useSupabase, useWebSocket)
• SQL-first data modeling with migrations; RLS for fine-grained access control
• Single-page-app experience with incremental static regeneration (ISR) where applicable
d. Key technologies/frameworks
• Next.js 14 (pages, API routes, SSR/SSG, middleware)
• React + TypeScript + Tailwind CSS
• Supabase (Auth, Postgres, Realtime)
• Cloudinary for file storage
• Vercel for CI/CD and hosting
• Formspree for form submission