How kevinq989/neighbourly works
Project Type and Purpose
• This is a native iOS application (built in SwiftUI) that uses MVVM patterns on the client and Supabase (cloud-hosted Postgres + Auth + Realtime) as its backend.
• Purpose: allow users to register, post help requests, match on proximity/skills, chat, rate each other, and receive notifications.
File Structure
• Top-level: Xcode project (Neighbourly.xcodeproj), app source in Neighbourly/Neighbourly, unit/UI tests, README, screenshots.
• In Neighbourly/Neighbourly:
– SwiftUI Views: AuthView.swift, HomePageView.swift, ChatView.swift, etc.
– ViewModels: e.g. ChatDetailViewModel.swift.
– Services/Data Layer: Supabase.swift, DataFetching.swift, LocationManager.swift.
– Models: Models.swift.
• No custom backend code here: all server logic is in Supabase; client communicates via REST/Realtime.
Key Insights from README
• Features: Authentication, Posting Requests, Optimized Matching, Rating System, Real-time Notifications.
• Technical Stack: SwiftUI (UI), Combine/async (network), Supabase (Auth, Database, Realtime), CoreLocation (location), APNs (push notifications).
Main Components
a. iOS Client (Mobile App)
• UI Layer: SwiftUI Views
• Presentation / Business Logic Layer: ViewModels + Models (MVVM)
• Data Layer: SupabaseService (in Supabase.swift), DataFetching, LocationManager
b. External Services
• Supabase
• Auth service
• Database (PostgreSQL)
• Realtime subscriptions
• CoreLocation (iOS framework)
• APNs (Apple Push Notification Service)
c. (Optional) Dependency injection or shared utilities if used (e.g., any extensions in View+Extensions.swift).
Relationships & Data Flows
1. User taps UI → SwiftUI View → invokes ViewModel.
2. ViewModel calls Data Layer (SupabaseService or DataFetching).
3. Data Layer issues HTTPS requests / Realtime subscriptions to Supabase.
4. Supabase Auth returns JWT/user profile → Data Layer → ViewModel → View (updates UI).
5. Supabase Database returns request listings, matches, chat messages.
6. Realtime events (new messages, new requests) push via WebSocket → Data Layer → ViewModel → View.
7. LocationManager fetches GPS → ViewModel (to include location in requests or matching).
8. For push notifications: Supabase triggers events → APNs → iOS App.
Architectural Patterns & Principles
• MVVM: isolate UI code (Views) from business logic (ViewModels) and data access (Services).
• Single Responsibility: each service class handles one concern (e.g., SupabaseService for network, LocationManager for GPS).
• Reactive updates: async/await or Combine for real-time and REST responses.
a. “UI Layer (SwiftUI Views)”
b. “Presentation Layer (ViewModels + Models)”
c. “Data Layer (SupabaseService, DataFetching, LocationManager)”
• Auth Service
• Database (PostgreSQL)
• Realtime Service
4. Above the “iOS Client,” place “CoreLocation Framework.”
5. Connect:
6. Component with the main file(s) responsible:
• UI Layer: e.g., HomePageView.swift, ChatView.swift, etc.
• ViewModels: ChatDetailViewModel.swift
• Data Layer: Supabase.swift, DataFetching.swift, LocationManager.swift.