# ezn24/assessment-4-mad architecture

> Architecture diagram of the GitHub repository ezn24/assessment-4-mad, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ezn24/assessment-4-mad
- Repository: https://github.com/ezn24/assessment-4-mad

## Overview

1. **Overall shape**  
   VizMinder A4 is a **React Native + Expo** app that targets **installed Android APKs**. The JavaScript app lives at the repo root and in `src/`, while the `android/` folder contains custom native code for exact alarms and a lock-screen reminder activity.

2. **App shell and UI composition**  
   `App.js` is the entrypoint for the JS side and likely wires the theme, data providers, and the main screen. The primary user experience is centered in `src/screens/HomeScreen.js`, with Material 3 styling from `src/theme.js`.

3. **Reminder domain layer**  
   The reminder feature is organized around `src/models/reminder.js`, `src/hooks/useReminders.js`, and `src/data/seedReminders.js`. The hook is the main state/use-case boundary for creating, editing, toggling, searching, deleting, and scheduling reminder items.

4. **Local-first persistence**  
   `src/services/storage.js` and `expo-sqlite` provide the durable local store for reminders, so the app can work offline and survive restarts. This local SQLite layer is the primary source of truth for day-to-day usage.

5. **Cloud sync and identity**  
   `src/services/firebase.js` handles Firebase Authentication and Firestore sync. The app supports **anonymous auth fallback** plus **email/password login**, and cloud data is stored under `users/{firebaseUserId}/reminders/{reminderId}`. Firebase config is injected through `app.config.js` from environment variables via `.env` and `src/services/expoConfig.js`.

6. **Background reminder delivery path**  
   Background scheduling is split between `src/services/backgroundTasks.js`, `src/services/notifications.js`, and `src/services/nativeAlarm.js`. On Android, the installed APK path uses native exact alarms; on non-native or fallback paths, Expo notifications provide the scheduling/permission layer.

7. **Android native boundary**  
   The `android/app/src/main/java/com/ezn24/vizmindera4/` package contains `AlarmSchedulerModule.kt`, `AlarmSchedulerPackage.kt`, `AlarmReceiver.kt`, `AlarmActivity.kt`, `MainActivity.kt`, and `MainApplication.kt`. This is the key architectural boundary between React Native and Android: JS schedules reminders, native Android triggers the alarm, shows a high-priority full-screen notification, and opens a lock-screen reminder UI.

8. **User interaction and visual cues**  
   The UI uses `react-native-paper`, `react-native-gesture-handler`, `react-native-calendars`, `@react-native-community/datetimepicker`, `expo-image-picker`, `expo-haptics`, `react-native-animatable`, and `react-native-confetti-cannon`. These libraries support the app’s visual-first reminder flow: image/emoji/icon cues, swipe delete, calendar schedule view, date/time picking, tactile feedback, and completion celebration.

9. **Settings and app behavior**  
   `@react-native-async-storage/async-storage` is used for lightweight preferences, such as theme/dynamic color or other app settings. The theme layer is Material 3 oriented, with optional Android dynamic color extraction via `@pchmn/expo-material3-theme`.

10. **Platform/runtime constraints**  
   This repo is intentionally not “Expo Go only.” The README makes it clear that full alarm behavior, exact alarms, and the custom full-screen alarm activity require the **built Android app**. That is why the `android/` directory is checked in and why APK builds are part of the normal workflow.

11. **Testing and validation**  
   `__tests__/reminder.test.js` covers reminder model behavior with Jest, using `jest-expo` and `jest.setup.js`. The repository also includes Firebase Test Lab documentation and APK build scripts, reflecting that some behaviors must be validated on a real Android device/emulator, not just in JS tests.

12. **Build and delivery tooling**  
   Build orchestration is split across Expo/EAS config (`app.json`, `app.config.js`, `eas.json`) and native Android Gradle files under `android/`. Scripts such as `scripts/build-local-apk.ps1` and the README’s APK/test-lab steps show that the deliverable is an Android install artifact, not just a JS bundle.

13. **Main data flow to draw in a diagram**  
   The important end-to-end flow is: **user action in `HomeScreen` → reminder state in `useReminders` → local SQLite storage → optional Firestore sync via Firebase → scheduled alarm via JS/native bridge → Android `AlarmReceiver`/`AlarmActivity` notification and full-screen UI**. That flow captures the main architectural seams of the repo.

Main entry points: [`src/hooks/useReminders.js`](https://github.com/ezn24/assessment-4-mad/blob/main/src/hooks/useReminders.js) (useReminders), [`src/screens/HomeScreen.js`](https://github.com/ezn24/assessment-4-mad/blob/main/src/screens/HomeScreen.js) (Home), [`src/services/backgroundTasks.js`](https://github.com/ezn24/assessment-4-mad/blob/main/src/services/backgroundTasks.js) (Background tasks), [`android/app/src/main/java/com/ezn24/vizmindera4/AlarmSchedulerModule.kt`](https://github.com/ezn24/assessment-4-mad/blob/main/android/app/src/main/java/com/ezn24/vizmindera4/AlarmSchedulerModule.kt) (Alarm module)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_js_app["JS App"]
  node_app_js["App.js<br/>entrypoint<br/>[App.js]"]
  node_home_screen["Home<br/>screen<br/>[HomeScreen.js]"]
  node_theme["Theme<br/>[theme.js]"]
  node_use_reminders["useReminders<br/>state/use-case<br/>[useReminders.js]"]
  node_reminder_model["Reminder<br/>domain model<br/>[reminder.js]"]
  node_seed_data["Seed data<br/>fixture data<br/>[seedReminders.js]"]
  node_storage_service[("Storage<br/>local persistence<br/>[storage.js]")]
  node_firebase_service[("Firebase<br/>cloud sync<br/>[firebase.js]")]
  node_expo_config["Expo config<br/>runtime config<br/>[expoConfig.js]"]
  node_background_tasks["Background tasks<br/>scheduler<br/>[backgroundTasks.js]"]
  node_notifications["Notifications<br/>delivery layer<br/>[notifications.js]"]
  node_native_alarm["Native alarm<br/>android bridge<br/>[nativeAlarm.js]"]
end

subgraph group_android_native["Android Native"]
  node_alarm_module["Alarm module<br/>native bridge"]
  node_alarm_package["Alarm package<br/>native package"]
  node_alarm_receiver["Alarm receiver<br/>android receiver<br/>[AlarmReceiver.kt]"]
  node_alarm_activity["Alarm activity<br/>full-screen UI<br/>[AlarmActivity.kt]"]
  node_main_activity["MainActivity<br/>android host<br/>[MainActivity.kt]"]
  node_main_application["MainApplication<br/>android host<br/>[MainApplication.kt]"]
end

subgraph group_tooling["Tooling"]
  node_app_config["App config<br/>build config<br/>[app.config.js]"]
  node_eas_config["EAS config<br/>build config<br/>[eas.json]"]
  node_test_suite["Tests<br/>jest<br/>[reminder.test.js]"]
  node_apk_script["APK script<br/>build script"]
end

node_app_js -->|"renders"| node_home_screen
node_app_js -->|"uses"| node_theme
node_home_screen -->|"drives"| node_use_reminders
node_home_screen -->|"styles"| node_theme
node_use_reminders -->|"operates on"| node_reminder_model
node_use_reminders -.->|"hydrates"| node_seed_data
node_use_reminders -->|"persists"| node_storage_service
node_use_reminders -->|"syncs"| node_firebase_service
node_firebase_service -->|"configured by"| node_expo_config
node_use_reminders -->|"schedules"| node_background_tasks
node_background_tasks -->|"fallbacks to"| node_notifications
node_background_tasks -->|"bridges to"| node_native_alarm
node_native_alarm -->|"calls"| node_alarm_module
node_alarm_module -->|"registered by"| node_alarm_package
node_alarm_module -->|"fires"| node_alarm_receiver
node_alarm_receiver -->|"opens"| node_alarm_activity
node_main_application -->|"loads"| node_alarm_package
node_main_activity -->|"hosts"| node_app_js
node_app_config -->|"feeds"| node_expo_config
node_eas_config -.->|"coordinates"| node_app_config
node_test_suite -->|"verifies"| node_reminder_model
node_apk_script -.->|"builds"| node_main_application

click node_app_js "https://github.com/ezn24/assessment-4-mad/blob/main/App.js"
click node_home_screen "https://github.com/ezn24/assessment-4-mad/blob/main/src/screens/HomeScreen.js"
click node_theme "https://github.com/ezn24/assessment-4-mad/blob/main/src/theme.js"
click node_use_reminders "https://github.com/ezn24/assessment-4-mad/blob/main/src/hooks/useReminders.js"
click node_reminder_model "https://github.com/ezn24/assessment-4-mad/blob/main/src/models/reminder.js"
click node_seed_data "https://github.com/ezn24/assessment-4-mad/blob/main/src/data/seedReminders.js"
click node_storage_service "https://github.com/ezn24/assessment-4-mad/blob/main/src/services/storage.js"
click node_firebase_service "https://github.com/ezn24/assessment-4-mad/blob/main/src/services/firebase.js"
click node_expo_config "https://github.com/ezn24/assessment-4-mad/blob/main/src/services/expoConfig.js"
click node_background_tasks "https://github.com/ezn24/assessment-4-mad/blob/main/src/services/backgroundTasks.js"
click node_notifications "https://github.com/ezn24/assessment-4-mad/blob/main/src/services/notifications.js"
click node_native_alarm "https://github.com/ezn24/assessment-4-mad/blob/main/src/services/nativeAlarm.js"
click node_alarm_module "https://github.com/ezn24/assessment-4-mad/blob/main/android/app/src/main/java/com/ezn24/vizmindera4/AlarmSchedulerModule.kt"
click node_alarm_package "https://github.com/ezn24/assessment-4-mad/blob/main/android/app/src/main/java/com/ezn24/vizmindera4/AlarmSchedulerPackage.kt"
click node_alarm_receiver "https://github.com/ezn24/assessment-4-mad/blob/main/android/app/src/main/java/com/ezn24/vizmindera4/AlarmReceiver.kt"
click node_alarm_activity "https://github.com/ezn24/assessment-4-mad/blob/main/android/app/src/main/java/com/ezn24/vizmindera4/AlarmActivity.kt"
click node_main_activity "https://github.com/ezn24/assessment-4-mad/blob/main/android/app/src/main/java/com/ezn24/vizmindera4/MainActivity.kt"
click node_main_application "https://github.com/ezn24/assessment-4-mad/blob/main/android/app/src/main/java/com/ezn24/vizmindera4/MainApplication.kt"
click node_app_config "https://github.com/ezn24/assessment-4-mad/blob/main/app.config.js"
click node_eas_config "https://github.com/ezn24/assessment-4-mad/blob/main/eas.json"
click node_test_suite "https://github.com/ezn24/assessment-4-mad/blob/main/__tests__/reminder.test.js"
click node_apk_script "https://github.com/ezn24/assessment-4-mad/blob/main/scripts/build-local-apk.ps1"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app_js,node_home_screen,node_theme,node_use_reminders,node_reminder_model,node_seed_data,node_storage_service,node_firebase_service,node_expo_config,node_background_tasks,node_notifications,node_native_alarm toneBlue
class node_alarm_module,node_alarm_package,node_alarm_receiver,node_alarm_activity,node_main_activity,node_main_application toneAmber
class node_app_config,node_eas_config,node_test_suite,node_apk_script toneMint
```

## Components

### JS App

Expo/React Native application shell, screens, domain logic, and services.

- [App.js](https://github.com/ezn24/assessment-4-mad/blob/main/App.js): entrypoint · JS app entry that wires providers and the main UI. · `App.js`
- [Home](https://github.com/ezn24/assessment-4-mad/blob/main/src/screens/HomeScreen.js): screen · Primary reminder UI and user interaction surface. · `src/screens/HomeScreen.js`
- [Theme](https://github.com/ezn24/assessment-4-mad/blob/main/src/theme.js): ui theme · Material 3 styling and dynamic color behavior. · `src/theme.js`
- [useReminders](https://github.com/ezn24/assessment-4-mad/blob/main/src/hooks/useReminders.js): state/use-case · Main reminder workflow for CRUD, search, toggle, and scheduling. · `src/hooks/useReminders.js`
- [Reminder](https://github.com/ezn24/assessment-4-mad/blob/main/src/models/reminder.js): domain model · Reminder data shape and domain rules. · `src/models/reminder.js`
- [Seed data](https://github.com/ezn24/assessment-4-mad/blob/main/src/data/seedReminders.js): fixture data · Initial reminder examples and defaults. · `src/data/seedReminders.js`
- [Storage](https://github.com/ezn24/assessment-4-mad/blob/main/src/services/storage.js): local persistence · SQLite-backed local source of truth for reminders. · `src/services/storage.js`
- [Firebase](https://github.com/ezn24/assessment-4-mad/blob/main/src/services/firebase.js): cloud sync · Authentication and Firestore sync for user reminders. · `src/services/firebase.js`
- [Expo config](https://github.com/ezn24/assessment-4-mad/blob/main/src/services/expoConfig.js): runtime config · Reads environment-driven config for Expo and Firebase. · `src/services/expoConfig.js`
- [Background tasks](https://github.com/ezn24/assessment-4-mad/blob/main/src/services/backgroundTasks.js): scheduler · Coordinates reminder scheduling work in JS. · `src/services/backgroundTasks.js`
- [Notifications](https://github.com/ezn24/assessment-4-mad/blob/main/src/services/notifications.js): delivery layer · Expo notification permissions and fallback scheduling. · `src/services/notifications.js`
- [Native alarm](https://github.com/ezn24/assessment-4-mad/blob/main/src/services/nativeAlarm.js): android bridge · JS bridge for exact alarm scheduling on Android. · `src/services/nativeAlarm.js`

### Android Native

Custom Android alarm and lock-screen delivery boundary.

- [Alarm module](https://github.com/ezn24/assessment-4-mad/blob/main/android/app/src/main/java/com/ezn24/vizmindera4/AlarmSchedulerModule.kt): native bridge · Exposes exact-alarm scheduling to React Native. · `android/app/src/main/java/com/ezn24/vizmindera4/AlarmSchedulerModule.kt`
- [Alarm package](https://github.com/ezn24/assessment-4-mad/blob/main/android/app/src/main/java/com/ezn24/vizmindera4/AlarmSchedulerPackage.kt): native package · Registers the alarm module with the app runtime. · `android/app/src/main/java/com/ezn24/vizmindera4/AlarmSchedulerPackage.kt`
- [Alarm receiver](https://github.com/ezn24/assessment-4-mad/blob/main/android/app/src/main/java/com/ezn24/vizmindera4/AlarmReceiver.kt): android receiver · Receives alarm events and triggers reminder delivery. · `android/app/src/main/java/com/ezn24/vizmindera4/AlarmReceiver.kt`
- [Alarm activity](https://github.com/ezn24/assessment-4-mad/blob/main/android/app/src/main/java/com/ezn24/vizmindera4/AlarmActivity.kt): full-screen UI · Lock-screen reminder activity shown on alarm. · `android/app/src/main/java/com/ezn24/vizmindera4/AlarmActivity.kt`
- [MainActivity](https://github.com/ezn24/assessment-4-mad/blob/main/android/app/src/main/java/com/ezn24/vizmindera4/MainActivity.kt): android host · React Native host activity for the installed app. · `android/app/src/main/java/com/ezn24/vizmindera4/MainActivity.kt`
- [MainApplication](https://github.com/ezn24/assessment-4-mad/blob/main/android/app/src/main/java/com/ezn24/vizmindera4/MainApplication.kt): android host · Android application bootstrap and package registration. · `android/app/src/main/java/com/ezn24/vizmindera4/MainApplication.kt`

### Tooling

Build, config, and validation support.

- [App config](https://github.com/ezn24/assessment-4-mad/blob/main/app.config.js): build config · Expo app configuration and environment injection. · `app.config.js`
- [EAS config](https://github.com/ezn24/assessment-4-mad/blob/main/eas.json): build config · Expo Application Services build profiles. · `eas.json`
- [Tests](https://github.com/ezn24/assessment-4-mad/blob/main/__tests__/reminder.test.js): jest · Reminder model validation and behavior tests. · `__tests__/reminder.test.js`
- [APK script](https://github.com/ezn24/assessment-4-mad/blob/main/scripts/build-local-apk.ps1): build script · Local Android APK build automation. · `scripts/build-local-apk.ps1`

## Connections

- App.js → Home: renders · App mounts the primary screen.
- App.js → Theme: uses · Global UI theme is applied at the app shell.
- Home → useReminders: drives · User actions flow through the reminder use-case boundary.
- Home → Theme: styles · Screen consumes Material 3 styling.
- useReminders → Reminder: operates on · Business logic is centered on reminder entities.
- useReminders → Seed data: hydrates · Initial reminders can be seeded into state.
- useReminders → Storage: persists · Local SQLite storage is the primary source of truth.
- useReminders → Firebase: syncs · Cloud sync mirrors reminders for authenticated users.
- Firebase → Expo config: configured by · Firebase settings are injected from runtime config.
- useReminders → Background tasks: schedules · Reminder changes trigger background delivery setup.
- Background tasks → Notifications: fallbacks to · Notification permissions and Expo scheduling are the fallback path.
- Background tasks → Native alarm: bridges to · Android exact alarms are used on the native path.
- Native alarm → Alarm module: calls · JS invokes the native scheduling module.
- Alarm module → Alarm package: registered by · Module is exposed through the RN package.
- Alarm module → Alarm receiver: fires · Scheduled alarms are delivered to the receiver.
- Alarm receiver → Alarm activity: opens · Alarm events surface a lock-screen reminder UI.
- MainApplication → Alarm package: loads · Android app bootstrap registers the custom package.
- MainActivity → App.js: hosts · Main Android activity hosts the JS application.
- App config → Expo config: feeds · Build-time config supports runtime environment access.
- EAS config → App config: coordinates · EAS profiles work with Expo app configuration.
- Tests → Reminder: verifies · Jest coverage focuses on reminder behavior.
- APK script → MainApplication: builds · Local build script produces an installable Android artifact.
