How hdquandev/qtimetable-ictu works
Project type and purpose
• This is a full-stack, cross-platform mobile application built with React Native + Expo.
• Its goal is to let students view and manage their class schedules, receive real-time reminders, sync data, and share timetables. The backend is provided by Firebase (Auth + Firestore), with local persistence via AsyncStorage and background/notification handling via Expo.
File structure and extract main components
A. Mobile Client
• UI Layer (screens/) – all the visual pages (LoginScreen, MenuScreen, AddNoteScreen, ClassScheduleScreen, SwipeableScreens, etc.)
• Reusable Components (components/) – modal dialogs, theme provider, notification schedulers, sync utilities, log savers, update checks, Firebase config, Firestore helpers
• Navigation – React Navigation v6 configured inside App.js (and possibly a navigation/ folder)
• Context Providers – AuthContext.jsx (authentication state), ThemeProvider.jsx (theme/light-dark)
• Services/Data Layer (services/) – API wrappers (services/api.jsx), token management (services/token.jsx)
• Local Storage – AsyncStorage for caching tokens, preferences, offline data
• Background & Notification Handlers – backgroundTasks.jsx, LocalNotification.jsx, ScheduleNotification.jsx, SyncGhiChu.jsx
B. Backend / Cloud
• Firebase Authentication – user sign-up/sign-in
• Firestore Database – read/write schedule and note data
• (Optional) Firebase Cloud Messaging – if using remote push notifications
C. External & Third-Party
• React Native Calendars – calendar UI
• NativeWind/Tailwind (tailwind.config.js) – styling
D. Ops & Config
• server.py – auxiliary script or local server (maintenance or data scraping)
• CI/CD – GitHub Actions (.github/workflows/main.yml)
• Environment & Build – .env, app.json, eas.json, babel.config.js, package.json
Relationships and data flows
• User taps on a screen → UI Layer invokes navigation or dispatches an action
• Screen logic uses Context (AuthContext) to check auth status
• For data operations, components call services/api.jsx → API module uses firebaseConfig/firestore helpers → Firestore
• Token flows: services/token → AsyncStorage for persistence → reused on app restart
• BackgroundTasks and schedule components register tasks with Expo’s TaskManager → trigger LocalNotification or ScheduleNotification
• Cloud FCM (if enabled) sends push messages → Client receives via Expo PushNotification handlers
Architectural patterns and design principles
• Layered Architecture: UI Layer → Business Logic (Context & Services) → Data Layer → External Services
• Context API: centralized state for Auth and Theme
• Service Layer: abstract external calls (Firebase, AsyncStorage) behind simple methods
• Modular Components: each responsibility isolated (notification, syncing, logging, theming)
• Declarative Navigation: React Navigation for screen transitions