# gyildiz21/hayem-sistemi architecture

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

- Interactive diagram: https://gitdiagram.com/gyildiz21/hayem-sistemi
- Repository: https://github.com/gyildiz21/hayem-sistemi

## Overview

#### Purpose and Entry Points
This is a React/Vite single-page operations platform centered on trainings, tasks, workflow automation, documents, auditability, integrations, and administrative controls. The browser bootstraps at `src/main.jsx`, composes application state/UI in `src/App.jsx`, and maps protected feature routes through `src/routes/AppRoutes.jsx`.

#### Application Shell and Access Boundary
Authentication and application-wide data are provided through React contexts, while layout and route protection separate authenticated operational views from login flows. Core paths: `src/contexts/AuthContext.jsx`, `src/contexts/DataContext.jsx`, `src/components/auth/ProtectedRoute.jsx`. The UI shell is `src/components/layout/MainLayout.jsx`; individual pages aggregate feature panels rather than embedding persistence logic.

#### Firebase Data and Server Boundary
Firebase is the primary backend boundary, configured client-side in `src/services/firebase.js`, governed by `firestore.rules`, and indexed via `firestore.indexes.json`. Firebase Cloud Functions provide trusted integration/webhook endpoints in `functions/index.js`, with specialized handlers for OAuth and WhatsApp at `functions/oauthHandler.js` and `functions/whatsappWebhook.js`. The deployment configuration is `firebase.json`.

#### Core Work Management Flow
Training and task records appear to be the central operational domain: training views feed task workspaces, Kanban planning, dependencies, workloads, timelines, comments, and calendars. Service-layer operations isolate these flows from React components: `src/services/trainingService.js`, `src/services/taskService.js`, and `src/services/kanbanService.js`. Primary user surfaces include `src/pages/TrainingsPage.jsx`, `src/pages/TaskWorkspace.jsx`, and `src/pages/KanbanBoard.jsx`.

#### Workflow, Rules, and Automation
The platform supports both predefined business workflows and configurable automation. Domain workflow definitions are React modules under `src/workflows/CertificateWorkflow.jsx`, `src/workflows/FinanceWorkflow.jsx`, and `src/workflows/EBYSWorkflow.jsx`. Configured workflows, intake forms, templates, permissions, and policy rules are managed through `src/services/workflowBuilderService.js`, `src/services/automationService.js`, and `src/services/policyRuleService.js`, surfaced at `src/pages/WorkflowBuilderCenter.jsx` and `src/pages/AutomationCenter.jsx`.

#### Documents, AI, and External Integrations
Documents are uploaded/queryable artifacts with classification and AI-related processing boundaries. Key services are `src/services/documentService.js`, `src/services/classificationService.js`, and `src/services/ai.js`; the user entry surface is `src/pages/DocumentsPage.jsx`. Integration features include OAuth token handling, Gmail/OneDrive imports, API keys, and WhatsApp message processing via `src/services/oauthTokenService.js`, `src/services/gmailImportService.js`, `src/services/onedriveImportService.js`, and `src/services/whatsappWebhookService.js`. External-provider callback handling is represented by `src/pages/OAuthCallback.jsx`.

#### Governance, Reliability, and Observability
Audit logging, lineage/replay, security checks, backups/restores, release rollback, SLA tracking, performance monitoring, reporting, and code-health analysis are first-class platform capabilities rather than incidental utilities. Representative boundaries are `src/services/auditService.js`, `src/services/backupService.js`, `src/services/restoreService.js`, `src/services/slaService.js`, and `src/services/releaseService.js`. Related control centers include `src/pages/SecurityCenter.jsx`, `src/pages/BackupCenter.jsx`, and `src/pages/TraceCenter.jsx`.

#### Runtime and Operational Shape
The frontend runs as a Vite-built React application (`package.json`, `vite.config.js`); backend functions run in the Firebase Functions runtime (`functions/package.json`). Firebase Authentication, Firestore, and Cloud Functions are the material infrastructure indicated by repository configuration and code. Emulator/seed/migration scripts under `tests/` and `seed.js` support local data setup and operational maintenance.

Main entry points: [`src/components/layout/MainLayout.jsx`](https://github.com/gyildiz21/hayem-sistemi/blob/main/src/components/layout/MainLayout.jsx) (Operational shell), [`src/services/firebase.js`](https://github.com/gyildiz21/hayem-sistemi/blob/main/src/services/firebase.js) (Firebase client boundary), [`src/App.jsx`](https://github.com/gyildiz21/hayem-sistemi/blob/main/src/App.jsx) (Application composition), [`src/routes/AppRoutes.jsx`](https://github.com/gyildiz21/hayem-sistemi/blob/main/src/routes/AppRoutes.jsx) (Protected feature routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React SPA"]
  node_bootstrap(("Browser bootstrap<br/>React entry<br/>[main.jsx]"))
  node_app["Application composition<br/>React app<br/>[App.jsx]"]
  node_routes["Protected feature routes<br/>router<br/>[AppRoutes.jsx]"]
  node_auth["Authentication state<br/>React context<br/>[AuthContext.jsx]"]
  node_data["Shared application data<br/>React context<br/>[DataContext.jsx]"]
  node_access["Route access guard<br/>protected route<br/>[ProtectedRoute.jsx]"]
  node_shell["Operational shell<br/>layout<br/>[MainLayout.jsx]"]
  node_oauth_callback["OAuth callback<br/>callback page<br/>[OAuthCallback.jsx]"]
end

subgraph group_domain["Operations domains"]
  node_work["Training and task work<br/>domain services<br/>[taskService.js]"]
  node_work_ui["Work planning surfaces<br/>feature pages<br/>[TaskWorkspace.jsx]"]
  node_workflow["Workflow and automation<br/>domain services"]
  node_workflow_ui["Workflow control centers<br/>feature pages"]
  node_documents["Documents and AI<br/>domain services<br/>[documentService.js]"]
  node_documents_ui["Document workspace<br/>feature page<br/>[DocumentsPage.jsx]"]
  node_governance["Governance and reliability<br/>control services<br/>[auditService.js]"]
  node_governance_ui["Operational control centers<br/>feature pages<br/>[TraceCenter.jsx]"]
end

subgraph group_backend["Trusted backend"]
  node_functions{{"Integration and webhook API<br/>Cloud Functions<br/>[index.js]"}}
  node_integrations["External provider integrations<br/>integration services"]
end

subgraph group_platform["Firebase platform"]
  node_firebase_client{{"Firebase client boundary<br/>client SDK<br/>[firebase.js]"}}
  node_firebase[("Firebase services<br/>Auth, Firestore, Functions<br/>[firestore.rules]")]
end

node_bootstrap -->|"mounts"| node_app
node_app -->|"provides"| node_auth
node_app -->|"provides"| node_data
node_app -->|"renders"| node_routes
node_routes -->|"guards"| node_access
node_access -->|"checks session"| node_auth
node_routes -->|"wraps authenticated views"| node_shell
node_shell -->|"hosts"| node_work_ui
node_shell -->|"hosts"| node_workflow_ui
node_shell -->|"hosts"| node_documents_ui
node_shell -->|"hosts"| node_governance_ui
node_work_ui -->|"operates"| node_work
node_workflow_ui -->|"configures"| node_workflow
node_documents_ui -->|"manages"| node_documents
node_governance_ui -->|"controls"| node_governance
node_work -->|"persists through"| node_firebase_client
node_workflow -->|"persists through"| node_firebase_client
node_documents -->|"stores through"| node_firebase_client
node_governance -->|"records through"| node_firebase_client
node_firebase_client -->|"uses"| node_firebase
node_integrations -->|"invokes trusted endpoints"| node_functions
node_functions -->|"uses trusted access"| node_firebase
node_oauth_callback -->|"completes provider authorization"| node_integrations

click node_bootstrap "https://github.com/gyildiz21/hayem-sistemi/blob/main/src/main.jsx"
click node_app "https://github.com/gyildiz21/hayem-sistemi/blob/main/src/App.jsx"
click node_routes "https://github.com/gyildiz21/hayem-sistemi/blob/main/src/routes/AppRoutes.jsx"
click node_auth "https://github.com/gyildiz21/hayem-sistemi/blob/main/src/contexts/AuthContext.jsx"
click node_data "https://github.com/gyildiz21/hayem-sistemi/blob/main/src/contexts/DataContext.jsx"
click node_access "https://github.com/gyildiz21/hayem-sistemi/blob/main/src/components/auth/ProtectedRoute.jsx"
click node_shell "https://github.com/gyildiz21/hayem-sistemi/blob/main/src/components/layout/MainLayout.jsx"
click node_work "https://github.com/gyildiz21/hayem-sistemi/blob/main/src/services/taskService.js"
click node_work_ui "https://github.com/gyildiz21/hayem-sistemi/blob/main/src/pages/TaskWorkspace.jsx"
click node_workflow "https://github.com/gyildiz21/hayem-sistemi/blob/main/src/services/workflowBuilderService.js"
click node_workflow_ui "https://github.com/gyildiz21/hayem-sistemi/blob/main/src/pages/WorkflowBuilderCenter.jsx"
click node_documents "https://github.com/gyildiz21/hayem-sistemi/blob/main/src/services/documentService.js"
click node_documents_ui "https://github.com/gyildiz21/hayem-sistemi/blob/main/src/pages/DocumentsPage.jsx"
click node_governance "https://github.com/gyildiz21/hayem-sistemi/blob/main/src/services/auditService.js"
click node_governance_ui "https://github.com/gyildiz21/hayem-sistemi/blob/main/src/pages/TraceCenter.jsx"
click node_firebase_client "https://github.com/gyildiz21/hayem-sistemi/blob/main/src/services/firebase.js"
click node_functions "https://github.com/gyildiz21/hayem-sistemi/blob/main/functions/index.js"
click node_firebase "https://github.com/gyildiz21/hayem-sistemi/blob/main/firestore.rules"
click node_integrations "https://github.com/gyildiz21/hayem-sistemi/blob/main/src/services/oauthTokenService.js"
click node_oauth_callback "https://github.com/gyildiz21/hayem-sistemi/blob/main/src/pages/OAuthCallback.jsx"

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_bootstrap,node_app,node_routes,node_auth,node_data,node_access,node_shell,node_oauth_callback toneBlue
class node_work,node_work_ui,node_workflow,node_workflow_ui,node_documents,node_documents_ui,node_governance,node_governance_ui toneAmber
class node_functions,node_integrations toneMint
class node_firebase_client,node_firebase toneRose
```

## Components

### React SPA

Vite browser application.

- [Browser bootstrap](https://github.com/gyildiz21/hayem-sistemi/blob/main/src/main.jsx): React entry · `src/main.jsx`
- [Application composition](https://github.com/gyildiz21/hayem-sistemi/blob/main/src/App.jsx): React app · `src/App.jsx`
- [Protected feature routes](https://github.com/gyildiz21/hayem-sistemi/blob/main/src/routes/AppRoutes.jsx): router · `src/routes/AppRoutes.jsx`
- [Authentication state](https://github.com/gyildiz21/hayem-sistemi/blob/main/src/contexts/AuthContext.jsx): React context · `src/contexts/AuthContext.jsx`
- [Shared application data](https://github.com/gyildiz21/hayem-sistemi/blob/main/src/contexts/DataContext.jsx): React context · `src/contexts/DataContext.jsx`
- [Route access guard](https://github.com/gyildiz21/hayem-sistemi/blob/main/src/components/auth/ProtectedRoute.jsx): protected route · `src/components/auth/ProtectedRoute.jsx`
- [Operational shell](https://github.com/gyildiz21/hayem-sistemi/blob/main/src/components/layout/MainLayout.jsx): layout · `src/components/layout/MainLayout.jsx`
- [OAuth callback](https://github.com/gyildiz21/hayem-sistemi/blob/main/src/pages/OAuthCallback.jsx): callback page · `src/pages/OAuthCallback.jsx`

### Operations domains

- [Training and task work](https://github.com/gyildiz21/hayem-sistemi/blob/main/src/services/taskService.js): domain services · Training, task, and Kanban operations. · `src/services/taskService.js`
- [Work planning surfaces](https://github.com/gyildiz21/hayem-sistemi/blob/main/src/pages/TaskWorkspace.jsx): feature pages · Training, task workspace, and Kanban views. · `src/pages/TaskWorkspace.jsx`
- [Workflow and automation](https://github.com/gyildiz21/hayem-sistemi/blob/main/src/services/workflowBuilderService.js): domain services · Configurable workflows, automation, and policy rules. · `src/services/workflowBuilderService.js`
- [Workflow control centers](https://github.com/gyildiz21/hayem-sistemi/blob/main/src/pages/WorkflowBuilderCenter.jsx): feature pages · Workflow Builder and Automation centers. · `src/pages/WorkflowBuilderCenter.jsx`
- [Documents and AI](https://github.com/gyildiz21/hayem-sistemi/blob/main/src/services/documentService.js): domain services · Document storage, classification, and AI processing. · `src/services/documentService.js`
- [Document workspace](https://github.com/gyildiz21/hayem-sistemi/blob/main/src/pages/DocumentsPage.jsx): feature page · `src/pages/DocumentsPage.jsx`
- [Governance and reliability](https://github.com/gyildiz21/hayem-sistemi/blob/main/src/services/auditService.js): control services · Audit, backup/restore, SLA, release, and trace controls. · `src/services/auditService.js`
- [Operational control centers](https://github.com/gyildiz21/hayem-sistemi/blob/main/src/pages/TraceCenter.jsx): feature pages · Security, backup, and trace views. · `src/pages/TraceCenter.jsx`

### Trusted backend

Firebase Functions endpoints.

- [Integration and webhook API](https://github.com/gyildiz21/hayem-sistemi/blob/main/functions/index.js): Cloud Functions · Trusted OAuth and WhatsApp handlers. · `functions/index.js`
- [External provider integrations](https://github.com/gyildiz21/hayem-sistemi/blob/main/src/services/oauthTokenService.js): integration services · OAuth tokens, Gmail/OneDrive imports, and WhatsApp processing. · `src/services/oauthTokenService.js`

### Firebase platform

- [Firebase client boundary](https://github.com/gyildiz21/hayem-sistemi/blob/main/src/services/firebase.js): client SDK · `src/services/firebase.js`
- [Firebase services](https://github.com/gyildiz21/hayem-sistemi/blob/main/firestore.rules): Auth, Firestore, Functions · Rules and indexes govern persisted operational data. · `firestore.rules`

## Connections

- Browser bootstrap → Application composition: mounts
- Application composition → Authentication state: provides
- Application composition → Shared application data: provides
- Application composition → Protected feature routes: renders
- Protected feature routes → Route access guard: guards
- Route access guard → Authentication state: checks session
- Protected feature routes → Operational shell: wraps authenticated views
- Operational shell → Work planning surfaces: hosts
- Operational shell → Workflow control centers: hosts
- Operational shell → Document workspace: hosts
- Operational shell → Operational control centers: hosts
- Work planning surfaces → Training and task work: operates
- Workflow control centers → Workflow and automation: configures
- Document workspace → Documents and AI: manages
- Operational control centers → Governance and reliability: controls
- Training and task work → Firebase client boundary: persists through
- Workflow and automation → Firebase client boundary: persists through
- Documents and AI → Firebase client boundary: stores through
- Governance and reliability → Firebase client boundary: records through
- Firebase client boundary → Firebase services: uses
- External provider integrations → Integration and webhook API: invokes trusted endpoints
- Integration and webhook API → Firebase services: uses trusted access
- OAuth callback → External provider integrations: completes provider authorization
