SciTechHub is an iOS SwiftUI app for reading science and technology news, saving content, tracking activity, connecting with other users through social discovery, and sending lightweight direct messages.
Implemented so far:
- Firebase authentication (sign up, sign in, sign out)
- News feed for Science and Technology categories
- Home, Trending, Saved, Friends, and My Notes tabs
- Inbox tab for lightweight direct messages
- Article interactions: love and bookmark
- Reading history tracking
- Notes per user
- Profile editing (name, interests, profile image)
- Social discovery with recommendations and mutual connections
- Friend requests (top-level and mirrored per-user collections)
- Privacy/message permission model in Firestore rules
- On-demand AI article summary in article detail view
- Reddit-style async direct messaging (chat list + conversation view)
- Share article to friend from article detail as a direct message
- SwiftUI
- MVVM architecture
- Firebase iOS SDK (Auth, Firestore, Storage)
- NewsAPI for article data
- OpenAI Chat Completions API for article summarization
SciTechHub/SciTechHubApp.swift: App entry, Firebase initialization, global environment objectsSciTechHub/MainTabView.swift: Main tab navigation and Friends hub UISciTechHub/HomeView.swift: Home feed and recommendation logicSciTechHub/TrendingView.swift: Trending content viewSciTechHub/NewsView.swift: News list and article detail UISciTechHub/NewsViewModel.swift: News fetch logicSciTechHub/ArticleSummaryViewModel.swift: AI summary service + state managementSciTechHub/DirectMessagingView.swift: Inbox UI, conversation UI, friend picker,ChatViewModel,MessageViewModelSciTechHub/BookmarkManager.swift: Bookmark/love persistence + listenersSciTechHub/ProfileView.swift: Profile, settings, and friend requests UISciTechHub/ProfileViewModel.swift: Profile, privacy, social graph, and activity logicSciTechHub/NotesView.swift: User notes flowfirestore.rules: Firestore security rules
- macOS with Xcode installed
- iOS Simulator or iOS device
- Firebase project configured
Recommended:
- Xcode 15+
- iOS 15+ target runtime
-
Open the project:
- Open
SciTechHub.xcodeprojin Xcode.
- Open
-
Configure Firebase:
- Add
GoogleService-Info.plistto the app target. - Ensure Firebase is enabled for Authentication, Firestore, and Storage.
- Add
-
Configure API keys:
- NewsAPI key is currently hardcoded in:
SciTechHub/HomeView.swiftSciTechHub/NewsViewModel.swift
- OpenAI key is read in this order:
OPENAI_API_KEYin app Info.plistOPENAI_API_KEYinsideGoogleService-Info.plistOPENAI_API_KEYfrom process environment
- NewsAPI key is currently hardcoded in:
-
Deploy Firestore rules:
- Use the
firestore.rulesfile in the repo. - Deploy from Firebase Console or Firebase CLI using an account with permission to test/deploy Firestore rules.
- Deploy after every messaging rule change (
/chats+/chats/{chatId}/messagesnow required).
- Use the
- Select the
SciTechHubscheme. - Choose an iOS Simulator (or connected device).
- Build and run from Xcode.
Important collections used by current implementation:
users/{userId}users/{userId}/notes/{noteId}users/{userId}/bookmarks/{bookmarkId}users/{userId}/likedArticles/{articleId}users/{userId}/readArticles/{articleId}users/{userId}/friends/{friendId}users/{userId}/friendRequests/{peerId}friendRequests/{requestId}friends/{userId}(legacy compatibility)chats/{chatId}chats/{chatId}/messages/{messageId}
Chat document shape:
participants: [userId1, userId2]participantNames: { userId: displayName }participantPhotoURLs: { userId: photoURL }lastMessage: StringlastTimestamp: Timestamp
Message document shape:
senderId: StringreceiverId: Stringtext: Stringtimestamp: Timestamp
If this appears while adding friends:
- Confirm latest
firestore.rulesis actually deployed to your Firebase project. - Ensure top-level
friendRequestsread rule supports missing-document precheck reads (the rule containingresource == null). - Ensure the Firebase account used for deployment has permission to test/deploy Firestore rules.
- Verify
OPENAI_API_KEYis set in one of the supported locations. - Confirm network access and valid OpenAI billing/quota.
- Confirm latest
firestore.rulesis deployed. - Ensure
/chats/{chatId}and/chats/{chatId}/messages/{messageId}rules exist in the deployed version. - Ensure users are actually friends if target user privacy is set to
messagePermission = friends.
Current test targets exist but are mostly starter templates:
SciTechHubTestsSciTechHubUITests
Before production release:
- Move API keys out of source files and tracked plist files.
- Add focused unit tests for view models and friend request flows.
- Add Firestore emulator rule tests.
- Add centralized logging for network and Firestore permission errors.