How 390minicapstone/polaris works
Project Type and Purpose
• This is a cross‑platform mobile application built with React Native (Expo) that provides campus map/navigation functionality, integrates with Google Calendar/Maps, and uses Firebase for user authentication and data storage.
• Key indicators: a single “Polaris‑FE” directory containing Expo‑specific config (app.config.js, metro.config.cjs), React components/hooks/contexts, and Firebase config.
File Structure
• app/ & components/ & hooks/ & contexts/ & services/ – the core of your client‑side architecture
• firebase/firebaseConfig.ts – BaaS configuration
• services/googleCalendarService.ts, googleMapsRoutes.ts, firestoreService.ts – external API integrations
• tests under __tests__, jest‑setup.ts – automated testing
• assets/, constants/, utils/ – static data and helper code
README and Docs
• The README is minimal; check docs/frontend for installation and E2E procedures. There’s no internal “backend” code – the app relies on Firebase (Auth+Firestore) and Google APIs.
a. Main Components
1) Mobile Client (React Native App)
– UI Layer: Screens & Navigation (expo‑router, app/(tabs), components/*)
– State Management: React Contexts (AuthContext, BuildingContext, NavigationContext, ThemeContext)
– Domain Logic: Hooks (useGoogleAuth, useNextClassTimer, useMapLocation)
– Service Layer: services/firestoreService, googleCalendarService, googleMapsRoutes
– Utilities & Constants: utils/, constants/
2) External Services
– Firebase Auth (user login, token management)
– Firestore Database (building data, user preferences)
– Google Calendar API
– Google Maps Routes API
3) Testing & CI/CD (optional to show)
– Jest/unit tests
– GitHub Actions (polaris.yml)
b. Relationships & Data Flows
• UI triggers Context or Hook → Hook calls Service → Service issues HTTP/gRPC request to external API → Response flows back to Hook → Context updates → UI re‑renders
• Auth flows: UI → AuthContext → Firebase Auth → return JWT → stored via authStorage → subsequent calls to Firestore/Google APIs
• Navigation flows: User selects destination in UI → NavigationContext → googleMapsRoutes → Map component draws polyline
c. Architectural Patterns & Principles
– Component‑based UI (small, reusable React components)
– Separation of concerns:
• UI vs. State (Contexts) vs. Data‑access (Services) vs. Side‑effects (Hooks)
– Dependency injection via Context Providers
– Single source of static data via constants/ and utils/
– Test‑driven development (extensive __tests__ directories)
d. Key Technologies & Frameworks
– React Native & Expo (app.config.js, metro.config.cjs)
– React Context API & Hooks
– Firebase (Auth + Firestore)
– Google Calendar & Maps REST APIs
– Jest & Testing Library
– GitHub Actions for CI