# akosiriinieru/securtap architecture

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

- Interactive diagram: https://gitdiagram.com/akosiriinieru/securtap
- Repository: https://github.com/akosiriinieru/securtap

## Overview

This is a React Native property and smart-lock administration app backed by Supabase, with Tuya lock integration and push notifications. The main user journey is authentication, then managing properties and guests, operating connected locks, and reviewing entry logs; account settings and notifications support that workflow. App.js owns navigation and session gating. Backend edge functions add lock-event synchronization and lock-status handling. The README was empty, and several screen and function excerpts were partial, so unverified runtime links are shown as dashed rather than assumed.

Main entry points: [`App.js`](https://github.com/akosiriinieru/securtap/blob/main/App.js) (App navigation), [`src/lib/supabase.js`](https://github.com/akosiriinieru/securtap/blob/main/src/lib/supabase.js) (Supabase client), [`supabase/functions/_shared/notify.ts`](https://github.com/akosiriinieru/securtap/blob/main/supabase/functions/_shared/notify.ts) (Notice sender), [`src/screens/LockManagementScreen.js`](https://github.com/akosiriinieru/securtap/blob/main/src/screens/LockManagementScreen.js) (Lock management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Mobile app"]
  node_app["App navigation<br/>[App.js]"]
  node_login["Sign in<br/>[LoginScreen.js]"]
  node_signup["Sign up<br/>[SignUpScreen.js]"]
  node_otp["OTP verification"]
  node_reset["Password reset"]
  node_theme["Theme provider<br/>[ThemeContext.js]"]
  node_network["Network status<br/>[NetworkStatus.js]"]
  node_settings["Settings<br/>[SettingsScreen.js]"]
  node_pushclient["Push registration<br/>[notifications.js]"]
end

subgraph group_management["Property management"]
  node_dashboard["Dashboard<br/>[DashboardScreen.js]"]
  node_properties["Properties"]
  node_guests["Guest management<br/>[GuestsScreen.js]"]
  node_entrylogs["Entry logs<br/>[EntryLogsScreen.js]"]
end

subgraph group_locks["Lock services"]
  node_lockscreen["Lock management"]
  node_tuyaclient["Tuya client<br/>[tuya.js]"]
  node_lockevents["Lock event sync<br/>[index.ts]"]
  node_lockstatus["Lock status function<br/>[index.ts]"]
  node_tuyashared["Tuya shared client<br/>[tuya.ts]"]
end

subgraph group_backend["Supabase backend"]
  node_notify["Notice sender<br/>[notify.ts]"]
  node_supabaseclient["Supabase client<br/>[supabase.js]"]
end

node_admin(("Administrator"))
node_supabase[("Supabase services")]
node_tuya{{"Tuya cloud"}}
node_expo{{"Expo push service"}}

node_admin -->|"opens"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_signup
node_app -->|"routes to"| node_reset
node_app -->|"shows"| node_dashboard
node_app -->|"routes to"| node_properties
node_app -->|"routes to"| node_guests
node_app -->|"routes to"| node_lockscreen
node_app -->|"routes to"| node_entrylogs
node_app -->|"routes to"| node_settings
node_app -->|"wraps in"| node_theme
node_app -->|"renders"| node_network
node_admin -.->|"verifies account"| node_otp
node_app -->|"exchanges auth session"| node_supabaseclient
node_app -->|"registers device"| node_pushclient
node_settings -->|"toggles registration"| node_pushclient
node_login -.->|"uses auth"| node_supabaseclient
node_signup -.->|"uses auth"| node_supabaseclient
node_otp -.->|"uses auth"| node_supabaseclient
node_reset -.->|"uses auth"| node_supabaseclient
node_dashboard -.->|"loads data"| node_supabaseclient
node_properties -.->|"manages records"| node_supabaseclient
node_guests -.->|"manages guests"| node_supabaseclient
node_entrylogs -.->|"loads records"| node_supabaseclient
node_lockscreen -.->|"manages lock records"| node_supabaseclient
node_lockscreen -->|"requests lock actions"| node_tuyaclient
node_tuyaclient -->|"invokes function"| node_supabaseclient
node_supabaseclient -.->|"accesses services"| node_supabase
node_lockevents -->|"uses client"| node_tuyashared
node_lockevents -.->|"sends notices"| node_notify
node_lockstatus -.->|"uses client"| node_tuyashared
node_lockstatus -->|"sends notices"| node_notify
node_tuyaclient -->|"invokes"| node_lockstatus
node_tuyashared -.->|"calls API"| node_tuya
node_notify -->|"sends pushes"| node_expo
node_pushclient -->|"saves device token"| node_supabaseclient
node_notify -->|"stores notices and reads tokens"| node_supabase

click node_app "https://github.com/akosiriinieru/securtap/blob/main/App.js"
click node_login "https://github.com/akosiriinieru/securtap/blob/main/src/screens/LoginScreen.js"
click node_signup "https://github.com/akosiriinieru/securtap/blob/main/src/screens/SignUpScreen.js"
click node_otp "https://github.com/akosiriinieru/securtap/blob/main/src/screens/OtpVerificationScreen.js"
click node_reset "https://github.com/akosiriinieru/securtap/blob/main/src/screens/ResetPasswordScreen.js"
click node_theme "https://github.com/akosiriinieru/securtap/blob/main/src/context/ThemeContext.js"
click node_network "https://github.com/akosiriinieru/securtap/blob/main/src/components/NetworkStatus.js"
click node_dashboard "https://github.com/akosiriinieru/securtap/blob/main/src/screens/DashboardScreen.js"
click node_properties "https://github.com/akosiriinieru/securtap/blob/main/src/screens/PropertiesScreen.js"
click node_guests "https://github.com/akosiriinieru/securtap/blob/main/src/screens/GuestsScreen.js"
click node_entrylogs "https://github.com/akosiriinieru/securtap/blob/main/src/screens/EntryLogsScreen.js"
click node_lockscreen "https://github.com/akosiriinieru/securtap/blob/main/src/screens/LockManagementScreen.js"
click node_tuyaclient "https://github.com/akosiriinieru/securtap/blob/main/src/lib/tuya.js"
click node_lockevents "https://github.com/akosiriinieru/securtap/blob/main/supabase/functions/lock-events-sync/index.ts"
click node_lockstatus "https://github.com/akosiriinieru/securtap/blob/main/supabase/functions/tuya-lock-status/index.ts"
click node_tuyashared "https://github.com/akosiriinieru/securtap/blob/main/supabase/functions/_shared/tuya.ts"
click node_settings "https://github.com/akosiriinieru/securtap/blob/main/src/screens/SettingsScreen.js"
click node_pushclient "https://github.com/akosiriinieru/securtap/blob/main/src/lib/notifications.js"
click node_notify "https://github.com/akosiriinieru/securtap/blob/main/supabase/functions/_shared/notify.ts"
click node_supabaseclient "https://github.com/akosiriinieru/securtap/blob/main/src/lib/supabase.js"

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,node_login,node_signup,node_otp,node_reset,node_theme,node_network,node_settings,node_pushclient toneBlue
class node_dashboard,node_properties,node_guests,node_entrylogs,node_supabase toneAmber
class node_lockscreen,node_tuyaclient,node_lockevents,node_lockstatus,node_tuyashared toneMint
class node_notify,node_supabaseclient toneRose
class node_admin,node_tuya,node_expo toneIndigo
```

## Components

### Mobile app

- [App navigation](https://github.com/akosiriinieru/securtap/blob/main/App.js): `App.js`
- [Sign in](https://github.com/akosiriinieru/securtap/blob/main/src/screens/LoginScreen.js): `src/screens/LoginScreen.js`
- [Sign up](https://github.com/akosiriinieru/securtap/blob/main/src/screens/SignUpScreen.js): `src/screens/SignUpScreen.js`
- [OTP verification](https://github.com/akosiriinieru/securtap/blob/main/src/screens/OtpVerificationScreen.js): `src/screens/OtpVerificationScreen.js`
- [Password reset](https://github.com/akosiriinieru/securtap/blob/main/src/screens/ResetPasswordScreen.js): `src/screens/ResetPasswordScreen.js`
- [Theme provider](https://github.com/akosiriinieru/securtap/blob/main/src/context/ThemeContext.js): `src/context/ThemeContext.js`
- [Network status](https://github.com/akosiriinieru/securtap/blob/main/src/components/NetworkStatus.js): `src/components/NetworkStatus.js`
- [Settings](https://github.com/akosiriinieru/securtap/blob/main/src/screens/SettingsScreen.js): `src/screens/SettingsScreen.js`
- [Push registration](https://github.com/akosiriinieru/securtap/blob/main/src/lib/notifications.js): `src/lib/notifications.js`

### Property management

- [Dashboard](https://github.com/akosiriinieru/securtap/blob/main/src/screens/DashboardScreen.js): `src/screens/DashboardScreen.js`
- [Properties](https://github.com/akosiriinieru/securtap/blob/main/src/screens/PropertiesScreen.js): `src/screens/PropertiesScreen.js`
- [Guest management](https://github.com/akosiriinieru/securtap/blob/main/src/screens/GuestsScreen.js): `src/screens/GuestsScreen.js`
- [Entry logs](https://github.com/akosiriinieru/securtap/blob/main/src/screens/EntryLogsScreen.js): `src/screens/EntryLogsScreen.js`

### Lock services

- [Lock management](https://github.com/akosiriinieru/securtap/blob/main/src/screens/LockManagementScreen.js): `src/screens/LockManagementScreen.js`
- [Tuya client](https://github.com/akosiriinieru/securtap/blob/main/src/lib/tuya.js): `src/lib/tuya.js`
- [Lock event sync](https://github.com/akosiriinieru/securtap/blob/main/supabase/functions/lock-events-sync/index.ts): `supabase/functions/lock-events-sync/index.ts`
- [Lock status function](https://github.com/akosiriinieru/securtap/blob/main/supabase/functions/tuya-lock-status/index.ts): `supabase/functions/tuya-lock-status/index.ts`
- [Tuya shared client](https://github.com/akosiriinieru/securtap/blob/main/supabase/functions/_shared/tuya.ts): `supabase/functions/_shared/tuya.ts`

### Supabase backend

- [Notice sender](https://github.com/akosiriinieru/securtap/blob/main/supabase/functions/_shared/notify.ts): `supabase/functions/_shared/notify.ts`
- [Supabase client](https://github.com/akosiriinieru/securtap/blob/main/src/lib/supabase.js): `src/lib/supabase.js`

### Other components

- **Administrator**
- **Supabase services**
- **Tuya cloud**
- **Expo push service**

## Connections

- Administrator → App navigation: opens
- App navigation → Sign in: routes to (evidence: `App.js`)
- App navigation → Sign up: routes to (evidence: `App.js`)
- App navigation → Password reset: routes to (evidence: `App.js`)
- App navigation → Dashboard: shows (evidence: `App.js`)
- App navigation → Properties: routes to (evidence: `App.js`)
- App navigation → Guest management: routes to (evidence: `App.js`)
- App navigation → Lock management: routes to (evidence: `App.js`)
- App navigation → Entry logs: routes to (evidence: `App.js`)
- App navigation → Settings: routes to (evidence: `App.js`)
- App navigation → Theme provider: wraps in (evidence: `App.js`)
- App navigation → Network status: renders (evidence: `App.js`)
- Administrator → OTP verification: verifies account
- App navigation → Supabase client: exchanges auth session (evidence: `App.js`)
- App navigation → Push registration: registers device (evidence: `App.js`)
- Settings → Push registration: toggles registration (evidence: `src/screens/SettingsScreen.js`)
- Sign in → Supabase client: uses auth (evidence: `src/screens/LoginScreen.js`)
- Sign up → Supabase client: uses auth (evidence: `src/screens/SignUpScreen.js`)
- OTP verification → Supabase client: uses auth (evidence: `src/screens/OtpVerificationScreen.js`)
- Password reset → Supabase client: uses auth
- Dashboard → Supabase client: loads data (evidence: `src/screens/DashboardScreen.js`)
- Properties → Supabase client: manages records (evidence: `src/screens/PropertiesScreen.js`)
- Guest management → Supabase client: manages guests (evidence: `src/screens/GuestsScreen.js`)
- Entry logs → Supabase client: loads records (evidence: `src/screens/EntryLogsScreen.js`)
- Lock management → Supabase client: manages lock records (evidence: `src/screens/LockManagementScreen.js`)
- Lock management → Tuya client: requests lock actions (evidence: `src/screens/LockManagementScreen.js`)
- Tuya client → Supabase client: invokes function (evidence: `src/lib/tuya.js`)
- Supabase client → Supabase services: accesses services
- Lock event sync → Tuya shared client: uses client (evidence: `supabase/functions/lock-events-sync/index.ts`)
- Lock event sync → Notice sender: sends notices (evidence: `supabase/functions/lock-events-sync/index.ts`)
- Lock status function → Tuya shared client: uses client
- Lock status function → Notice sender: sends notices (evidence: `supabase/functions/tuya-lock-status/index.ts`)
- Tuya client → Lock status function: invokes (evidence: `src/lib/tuya.js`)
- Tuya shared client → Tuya cloud: calls API
- Notice sender → Expo push service: sends pushes (evidence: `supabase/functions/_shared/notify.ts`)
- Push registration → Supabase client: saves device token (evidence: `src/lib/notifications.js`)
- Notice sender → Supabase services: stores notices and reads tokens (evidence: `supabase/functions/_shared/notify.ts`)
