# edu-lopes/workflow-chamados-apk architecture

> Architecture diagram of the GitHub repository edu-lopes/workflow-chamados-apk, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/edu-lopes/workflow-chamados-apk
- Repository: https://github.com/edu-lopes/workflow-chamados-apk

## Overview

Workflow Datapar is an Expo/React Native app and Node/Express API that turns Workflow Gmail messages into ticket histories and sends team push notifications. The main path is team member → app login and ticket views → API; Gmail sync imports email events into ticket history, which the app displays and notifications surface. The graph includes session, authentication, and persistence layers. Some module behavior is documented but not fully excerpted, so those links cite the README; unsampled internal calls are not inferred.

Main entry points: [`backend/src/app.ts`](https://github.com/edu-lopes/workflow-chamados-apk/blob/main/backend/src/app.ts) (HTTP routing), [`src/api.ts`](https://github.com/edu-lopes/workflow-chamados-apk/blob/main/src/api.ts) (API client), [`backend/src/modules/gmail.ts`](https://github.com/edu-lopes/workflow-chamados-apk/blob/main/backend/src/modules/gmail.ts) (Gmail sync), [`app/home.tsx`](https://github.com/edu-lopes/workflow-chamados-apk/blob/main/app/home.tsx) (Ticket list)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mobile["Mobile app"]
  node_login["Login screen<br/>[login.tsx]"]
  node_ticket_list["Ticket list<br/>[home.tsx]"]
  node_ticket_detail["Ticket history<br/>[&#91;id&#93;.tsx]"]
  node_session["Session and settings<br/>[session.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_push_client["Push handling<br/>[push.ts]"]
  node_shared_ui["Shared UI<br/>[ui.tsx]"]
end

subgraph group_backend["API services"]
  node_http_api["HTTP routing<br/>[app.ts]"]
  node_server["API runtime<br/>[server.ts]"]
  node_core["Auth and DB core<br/>[core.ts]"]
  node_users["User accounts<br/>[users.ts]"]
  node_gmail_sync["Gmail sync<br/>[gmail.ts]"]
  node_tickets["Ticket operations<br/>[tickets.ts]"]
  node_notifications["Notifications<br/>[notifications.ts]"]
end

subgraph group_data["Persistence"]
  node_mysql[("MariaDB<br/>[schema.sql]")]
end

subgraph group_integrations["External integrations"]
  node_gmail["Google Gmail"]
  node_expo_push["Expo Push API"]
end

node_member(("Team member"))

node_member -->|"signs in"| node_login
node_member -->|"views tickets"| node_ticket_list
node_ticket_list -->|"opens ticket"| node_ticket_detail
node_login -->|"authenticates"| node_session
node_login -->|"calls API"| node_api_client
node_ticket_list -->|"loads tickets"| node_api_client
node_ticket_list -->|"opens pending ticket"| node_push_client
node_ticket_detail -->|"loads history"| node_api_client
node_ticket_detail -->|"dismisses alerts"| node_push_client
node_ticket_detail -->|"renders status"| node_shared_ui
node_session -->|"manages token"| node_api_client
node_push_client -->|"registers token"| node_api_client
node_api_client -->|"sends requests"| node_http_api
node_server -->|"starts server"| node_http_api
node_server -->|"schedules sync"| node_gmail_sync
node_http_api -->|"mounts routes"| node_users
node_http_api -->|"mounts routes"| node_tickets
node_http_api -->|"mounts routes"| node_notifications
node_http_api -->|"mounts routes"| node_gmail_sync
node_http_api -->|"uses config"| node_core
node_users -->|"uses auth and queries"| node_core
node_gmail_sync -->|"uses DB helpers"| node_core
node_notifications -->|"uses DB helpers"| node_core
node_gmail_sync -->|"reads messages"| node_gmail
node_gmail_sync -->|"writes ticket history"| node_mysql
node_users -->|"reads and writes accounts"| node_mysql
node_notifications -->|"stores notification state"| node_mysql
node_notifications -->|"sends push"| node_expo_push
node_tickets -.->|"ticket persistence"| node_mysql

click node_login "https://github.com/edu-lopes/workflow-chamados-apk/blob/main/app/login.tsx"
click node_ticket_list "https://github.com/edu-lopes/workflow-chamados-apk/blob/main/app/home.tsx"
click node_ticket_detail "https://github.com/edu-lopes/workflow-chamados-apk/blob/main/app/ticket/%5Bid%5D.tsx"
click node_session "https://github.com/edu-lopes/workflow-chamados-apk/blob/main/src/session.tsx"
click node_api_client "https://github.com/edu-lopes/workflow-chamados-apk/blob/main/src/api.ts"
click node_push_client "https://github.com/edu-lopes/workflow-chamados-apk/blob/main/src/push.ts"
click node_shared_ui "https://github.com/edu-lopes/workflow-chamados-apk/blob/main/src/ui.tsx"
click node_http_api "https://github.com/edu-lopes/workflow-chamados-apk/blob/main/backend/src/app.ts"
click node_server "https://github.com/edu-lopes/workflow-chamados-apk/blob/main/backend/src/server.ts"
click node_core "https://github.com/edu-lopes/workflow-chamados-apk/blob/main/backend/src/core.ts"
click node_users "https://github.com/edu-lopes/workflow-chamados-apk/blob/main/backend/src/modules/users.ts"
click node_gmail_sync "https://github.com/edu-lopes/workflow-chamados-apk/blob/main/backend/src/modules/gmail.ts"
click node_tickets "https://github.com/edu-lopes/workflow-chamados-apk/blob/main/backend/src/modules/tickets.ts"
click node_notifications "https://github.com/edu-lopes/workflow-chamados-apk/blob/main/backend/src/modules/notifications.ts"
click node_mysql "https://github.com/edu-lopes/workflow-chamados-apk/blob/main/backend/database/schema.sql"

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_ticket_list,node_ticket_detail,node_session,node_api_client,node_push_client,node_shared_ui toneBlue
class node_http_api,node_server,node_core,node_users,node_gmail_sync,node_tickets,node_notifications toneAmber
class node_mysql toneMint
class node_gmail,node_expo_push toneRose
class node_member toneIndigo
```

## Components

### Mobile app

- [Login screen](https://github.com/edu-lopes/workflow-chamados-apk/blob/main/app/login.tsx): `app/login.tsx`
- [Ticket list](https://github.com/edu-lopes/workflow-chamados-apk/blob/main/app/home.tsx): `app/home.tsx`
- [Ticket history](https://github.com/edu-lopes/workflow-chamados-apk/blob/main/app/ticket/%5Bid%5D.tsx): `app/ticket/[id].tsx`
- [Session and settings](https://github.com/edu-lopes/workflow-chamados-apk/blob/main/src/session.tsx): `src/session.tsx`
- [API client](https://github.com/edu-lopes/workflow-chamados-apk/blob/main/src/api.ts): `src/api.ts`
- [Push handling](https://github.com/edu-lopes/workflow-chamados-apk/blob/main/src/push.ts): `src/push.ts`
- [Shared UI](https://github.com/edu-lopes/workflow-chamados-apk/blob/main/src/ui.tsx): `src/ui.tsx`

### API services

- [HTTP routing](https://github.com/edu-lopes/workflow-chamados-apk/blob/main/backend/src/app.ts): `backend/src/app.ts`
- [API runtime](https://github.com/edu-lopes/workflow-chamados-apk/blob/main/backend/src/server.ts): `backend/src/server.ts`
- [Auth and DB core](https://github.com/edu-lopes/workflow-chamados-apk/blob/main/backend/src/core.ts): `backend/src/core.ts`
- [User accounts](https://github.com/edu-lopes/workflow-chamados-apk/blob/main/backend/src/modules/users.ts): `backend/src/modules/users.ts`
- [Gmail sync](https://github.com/edu-lopes/workflow-chamados-apk/blob/main/backend/src/modules/gmail.ts): `backend/src/modules/gmail.ts`
- [Ticket operations](https://github.com/edu-lopes/workflow-chamados-apk/blob/main/backend/src/modules/tickets.ts): `backend/src/modules/tickets.ts`
- [Notifications](https://github.com/edu-lopes/workflow-chamados-apk/blob/main/backend/src/modules/notifications.ts): `backend/src/modules/notifications.ts`

### Persistence

- [MariaDB](https://github.com/edu-lopes/workflow-chamados-apk/blob/main/backend/database/schema.sql): `backend/database/schema.sql`

### External integrations

- **Google Gmail**
- **Expo Push API**

### Other components

- **Team member**

## Connections

- Team member → Login screen: signs in (evidence: `README.md`)
- Team member → Ticket list: views tickets (evidence: `README.md`)
- Ticket list → Ticket history: opens ticket (evidence: `app/home.tsx`)
- Login screen → Session and settings: authenticates (evidence: `app/login.tsx`)
- Login screen → API client: calls API (evidence: `app/login.tsx`)
- Ticket list → API client: loads tickets (evidence: `app/home.tsx`)
- Ticket list → Push handling: opens pending ticket (evidence: `app/home.tsx`)
- Ticket history → API client: loads history (evidence: `app/ticket/[id].tsx`)
- Ticket history → Push handling: dismisses alerts (evidence: `app/ticket/[id].tsx`)
- Ticket history → Shared UI: renders status (evidence: `app/ticket/[id].tsx`)
- Session and settings → API client: manages token (evidence: `src/session.tsx`)
- Push handling → API client: registers token (evidence: `src/push.ts`)
- API client → HTTP routing: sends requests (evidence: `README.md`)
- API runtime → HTTP routing: starts server (evidence: `backend/src/server.ts`)
- API runtime → Gmail sync: schedules sync (evidence: `backend/src/server.ts`)
- HTTP routing → User accounts: mounts routes (evidence: `backend/src/app.ts`)
- HTTP routing → Ticket operations: mounts routes (evidence: `backend/src/app.ts`)
- HTTP routing → Notifications: mounts routes (evidence: `backend/src/app.ts`)
- HTTP routing → Gmail sync: mounts routes (evidence: `backend/src/app.ts`)
- HTTP routing → Auth and DB core: uses config (evidence: `backend/src/app.ts`)
- User accounts → Auth and DB core: uses auth and queries (evidence: `backend/src/modules/users.ts`)
- Gmail sync → Auth and DB core: uses DB helpers (evidence: `backend/src/modules/gmail.ts`)
- Notifications → Auth and DB core: uses DB helpers (evidence: `backend/src/modules/notifications.ts`)
- Gmail sync → Google Gmail: reads messages (evidence: `backend/src/modules/gmail.ts`)
- Gmail sync → MariaDB: writes ticket history (evidence: `backend/src/modules/gmail.ts`)
- User accounts → MariaDB: reads and writes accounts (evidence: `backend/src/modules/users.ts`)
- Notifications → MariaDB: stores notification state (evidence: `backend/src/modules/notifications.ts`)
- Notifications → Expo Push API: sends push (evidence: `README.md`)
- Ticket operations → MariaDB: ticket persistence
