# marceltusachvillegas/frontendsms architecture

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

- Interactive diagram: https://gitdiagram.com/marceltusachvillegas/frontendsms
- Repository: https://github.com/marceltusachvillegas/frontendsms

## Overview

AntiFraude SMS is a mobile app for verifying a phone number, analyzing SMS messages for fraud risk, and reviewing results. The main flow is OTP sign-in, followed by a message inbox populated from backend history; intercepted Android SMS notifications can also be analyzed in the background. The app additionally exposes message details/reporting, an AI assistant, educational content, and profile controls. The sampled sources establish login, persistence, API, inbox, and background-analysis links; links from unsampled screens are shown only as unverified where needed.

Main entry points: [`src/lib/api.ts`](https://github.com/marceltusachvillegas/frontendsms/blob/main/src/lib/api.ts) (Backend API client), [`src/context/auth-context.tsx`](https://github.com/marceltusachvillegas/frontendsms/blob/main/src/context/auth-context.tsx) (Auth context), [`src/background-notification.ts`](https://github.com/marceltusachvillegas/frontendsms/blob/main/src/background-notification.ts) (SMS listener), [`src/app/index.tsx`](https://github.com/marceltusachvillegas/frontendsms/blob/main/src/app/index.tsx) (OTP sign-in)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and session"]
  node_login["OTP sign-in<br/>[index.tsx]"]
  node_auth["Auth context<br/>[auth-context.tsx]"]
  node_token[("Session storage<br/>[token-store.ts]")]
end

subgraph group_protection["SMS protection"]
  node_inbox["Message inbox<br/>[bandejaMensaje.tsx]"]
  node_detail["Message details<br/>[detallemensaje.tsx]"]
  node_background["SMS listener"]
  node_api["Backend API client<br/>[api.ts]"]
end

subgraph group_guidance["Guidance and account"]
  node_assistant["AI assistant chat<br/>[chatAsistente.tsx]"]
  node_education["Education center"]
  node_profile["User profile<br/>[perfil.tsx]"]
end

subgraph group_platform["App platform"]
  node_shell["App navigation<br/>[_layout.tsx]"]
  node_tabs["Tab navigation<br/>[_layout.tsx]"]
end

node_user(("Phone user"))
node_secure[("SecureStore")]
node_notifications["Android notifications"]
node_backend["Anti-fraud backend"]

node_user -->|"starts sign-in"| node_login
node_login -->|"requests OTP"| node_api
node_login -->|"starts session"| node_auth
node_auth -->|"persists session"| node_token
node_token -->|"reads and writes"| node_secure
node_inbox -.->|"loads history"| node_api
node_detail -.->|"uses reports API"| node_api
node_background -->|"handles events"| node_notifications
node_background -->|"reads token"| node_token
node_background -->|"analyzes message"| node_api
node_api -->|"sends HTTP requests"| node_backend
node_assistant -.->|"uses chat API"| node_api
node_profile -.->|"uses session"| node_auth
node_shell -.->|"provides session"| node_auth
node_tabs -.->|"checks session"| node_auth

click node_login "https://github.com/marceltusachvillegas/frontendsms/blob/main/src/app/index.tsx"
click node_auth "https://github.com/marceltusachvillegas/frontendsms/blob/main/src/context/auth-context.tsx"
click node_token "https://github.com/marceltusachvillegas/frontendsms/blob/main/src/lib/token-store.ts"
click node_inbox "https://github.com/marceltusachvillegas/frontendsms/blob/main/src/app/(tabs)/bandejaMensaje.tsx"
click node_detail "https://github.com/marceltusachvillegas/frontendsms/blob/main/src/app/detallemensaje.tsx"
click node_background "https://github.com/marceltusachvillegas/frontendsms/blob/main/src/background-notification.ts"
click node_api "https://github.com/marceltusachvillegas/frontendsms/blob/main/src/lib/api.ts"
click node_assistant "https://github.com/marceltusachvillegas/frontendsms/blob/main/src/app/chatAsistente.tsx"
click node_education "https://github.com/marceltusachvillegas/frontendsms/blob/main/src/app/(tabs)/centroEducativo.tsx"
click node_profile "https://github.com/marceltusachvillegas/frontendsms/blob/main/src/app/(tabs)/perfil.tsx"
click node_shell "https://github.com/marceltusachvillegas/frontendsms/blob/main/src/app/_layout.tsx"
click node_tabs "https://github.com/marceltusachvillegas/frontendsms/blob/main/src/app/(tabs)/_layout.tsx"

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_login,node_auth,node_token,node_user toneBlue
class node_inbox,node_detail,node_background,node_api,node_secure toneAmber
class node_assistant,node_education,node_profile toneMint
class node_shell,node_tabs toneRose
class node_notifications,node_backend toneIndigo
```

## Components

### Access and session

- [OTP sign-in](https://github.com/marceltusachvillegas/frontendsms/blob/main/src/app/index.tsx): `src/app/index.tsx`
- [Auth context](https://github.com/marceltusachvillegas/frontendsms/blob/main/src/context/auth-context.tsx): `src/context/auth-context.tsx`
- [Session storage](https://github.com/marceltusachvillegas/frontendsms/blob/main/src/lib/token-store.ts): `src/lib/token-store.ts`

### SMS protection

- [Message inbox](https://github.com/marceltusachvillegas/frontendsms/blob/main/src/app/(tabs)/bandejaMensaje.tsx): `src/app/(tabs)/bandejaMensaje.tsx`
- [Message details](https://github.com/marceltusachvillegas/frontendsms/blob/main/src/app/detallemensaje.tsx): `src/app/detallemensaje.tsx`
- [SMS listener](https://github.com/marceltusachvillegas/frontendsms/blob/main/src/background-notification.ts): `src/background-notification.ts`
- [Backend API client](https://github.com/marceltusachvillegas/frontendsms/blob/main/src/lib/api.ts): `src/lib/api.ts`

### Guidance and account

- [AI assistant chat](https://github.com/marceltusachvillegas/frontendsms/blob/main/src/app/chatAsistente.tsx): `src/app/chatAsistente.tsx`
- [Education center](https://github.com/marceltusachvillegas/frontendsms/blob/main/src/app/(tabs)/centroEducativo.tsx): `src/app/(tabs)/centroEducativo.tsx`
- [User profile](https://github.com/marceltusachvillegas/frontendsms/blob/main/src/app/(tabs)/perfil.tsx): `src/app/(tabs)/perfil.tsx`

### App platform

- [App navigation](https://github.com/marceltusachvillegas/frontendsms/blob/main/src/app/_layout.tsx): `src/app/_layout.tsx`
- [Tab navigation](https://github.com/marceltusachvillegas/frontendsms/blob/main/src/app/(tabs)/_layout.tsx): `src/app/(tabs)/_layout.tsx`

### Other components

- **Phone user**
- **SecureStore**
- **Android notifications**
- **Anti-fraud backend**

## Connections

- Phone user → OTP sign-in: starts sign-in (evidence: `src/app/index.tsx`)
- OTP sign-in → Backend API client: requests OTP (evidence: `src/app/index.tsx`)
- OTP sign-in → Auth context: starts session (evidence: `src/app/index.tsx`)
- Auth context → Session storage: persists session (evidence: `src/context/auth-context.tsx`)
- Session storage → SecureStore: reads and writes (evidence: `src/lib/token-store.ts`)
- Message inbox → Backend API client: loads history (evidence: `src/app/(tabs)/bandejaMensaje.tsx`)
- Message details → Backend API client: uses reports API (evidence: `src/app/detallemensaje.tsx`)
- SMS listener → Android notifications: handles events (evidence: `src/background-notification.ts`)
- SMS listener → Session storage: reads token (evidence: `src/background-notification.ts`)
- SMS listener → Backend API client: analyzes message (evidence: `src/background-notification.ts`)
- Backend API client → Anti-fraud backend: sends HTTP requests (evidence: `src/lib/api.ts`)
- AI assistant chat → Backend API client: uses chat API (evidence: `src/app/chatAsistente.tsx`)
- User profile → Auth context: uses session (evidence: `src/app/(tabs)/perfil.tsx`)
- App navigation → Auth context: provides session (evidence: `src/app/_layout.tsx`)
- Tab navigation → Auth context: checks session (evidence: `src/app/(tabs)/_layout.tsx`)
