# okeson453/aegisshare-enterprise architecture

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

- Interactive diagram: https://gitdiagram.com/okeson453/aegisshare-enterprise
- Repository: https://github.com/okeson453/aegisshare-enterprise

## Overview

#### Purpose and Runtime
AegisShare is a React 18/TypeScript single-page frontend for a zero-knowledge, compliance-oriented secure file-sharing platform. It is built and served with Vite, styled with Tailwind/CSS, navigated with React Router v6, and uses Zustand stores. Browser-side cryptographic utilities support the zero-knowledge boundary. Entry points are `src/main.tsx`, `src/App.tsx`, and `index.html`.

#### Application Shell and Navigation
The main app composes protected routes, global layout, error handling, and user-facing pages. Shared application chrome is centered in `src/components/layout/AppLayout.tsx`, while authorization gating is implemented at `src/components/routing/ProtectedRoute.tsx`. Core product routes cover vault/files, key management, policy, audit, compliance, access control, and threat intelligence under `src/pages/`.

#### Domain State and Service Boundary
UI components access domain state through Zustand stores and hooks; network/service calls are isolated from pages. Main domains map consistently:
- Authentication: `src/store/authStore.ts`, `src/services/auth.ts`, `src/hooks/useAuth.ts`
- Files/vault: `src/store/filesStore.ts`, `src/services/files.ts`, `src/hooks/useFiles.ts`
- Keys, policies, audit, and threats: `src/store/keysStore.ts`, `src/store/policyStore.ts`, `src/store/auditStore.ts`
The transport boundary is `src/services/api.ts`; mock service implementations in `src/services/mock/` indicate frontend operation can be decoupled from a live backend.

#### Secure Sharing and Cryptography
File workflows are presented through vault pages and reusable file components, including upload, listing, and detail interaction: `src/pages/Vault/Vault.tsx`, `src/components/files/UploadModal.tsx`, `src/components/files/FileDetailPanel.tsx`. Client-side crypto primitives include AES-GCM, Argon2, and ECIES in `src/utils/crypto/aesGcm.ts`, `src/utils/crypto/argon2.ts`, and `src/utils/crypto/ecies.ts`. Token handling and browser-side security controls sit at `src/utils/tokenManager.ts`, `src/utils/csp.ts`, and `src/utils/sri.ts`.

#### Governance, Audit, and Policy
Compliance-oriented workflows are first-class user surfaces: audit-chain visualization, policy authoring/simulation, access control, and compliance reporting. Key paths are `src/pages/AuditChain/AuditChain.tsx`, `src/pages/PolicyEngine/PolicyEngine.tsx`, and `src/pages/AccessControl/AccessControl.tsx`. Policy evaluation has an external integration boundary through `src/lib/opaClient.ts`, with related UI in `src/components/policy/PolicySimulator.tsx`.

#### Administrative Control Plane
A separate admin application/module organizes operational administration, likely rendered from the primary app’s admin route. `src/admin/AdminApp.tsx` and `src/admin/AdminLayout.tsx` establish its shell. Admin state/services are independent from general-product state, e.g. `src/admin/store/adminOverviewStore.ts`, `src/admin/services/adminOverview.ts`, and `src/admin/services/backup.ts`. Major operational domains include users, roles, incidents, backup recovery, service health, sovereignty, license features, and audit logs under `src/admin/pages/`.

#### Real-Time, Observability, and Deployment
WebSocket functionality is abstracted by `src/lib/websocket.ts` and `src/hooks/useWebSocket.ts`, supporting live operational or threat data. Client performance monitoring utilities are in `src/utils/performanceMonitor.ts` and `src/utils/webVitals.ts`; deployment monitoring settings are centralized in `config/monitoring.config.ts`. Environment-specific frontend configuration uses `.env.development` and `.env.production`, with production deployment automated by `.github/workflows/deploy-production.yml`.

Main entry points: [`src/App.tsx`](https://github.com/okeson453/aegisshare-enterprise/blob/main/src/App.tsx) (App router), [`src/store/authStore.ts`](https://github.com/okeson453/aegisshare-enterprise/blob/main/src/store/authStore.ts) (Authentication domain), [`src/pages/Vault/Vault.tsx`](https://github.com/okeson453/aegisshare-enterprise/blob/main/src/pages/Vault/Vault.tsx) (Vault file workflows), [`src/pages/PolicyEngine/PolicyEngine.tsx`](https://github.com/okeson453/aegisshare-enterprise/blob/main/src/pages/PolicyEngine/PolicyEngine.tsx) (Governance surfaces)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shell["Application Shell"]
  node_entry["Vite entry<br/>React bootstrap<br/>[main.tsx]"]
  node_app["App router<br/>React application<br/>[App.tsx]"]
  node_layout["Application layout<br/>shared chrome<br/>[AppLayout.tsx]"]
  node_protected{{"Protected routes<br/>authorization gate<br/>[ProtectedRoute.tsx]"}}
end

subgraph group_product["Product Domains"]
  node_auth["Authentication domain<br/>Zustand store, hook, service<br/>[authStore.ts]"]
  node_vault["Vault file workflows<br/>page and file UI<br/>[Vault.tsx]"]
  node_upload["File upload<br/>reusable UI<br/>[UploadModal.tsx]"]
  node_files["Files domain<br/>Zustand store and service<br/>[filesStore.ts]"]
  node_crypto{{"Browser cryptography<br/>zero-knowledge utilities<br/>[aesGcm.ts]"}}
  node_governance["Governance surfaces<br/>audit, policy, access pages<br/>[PolicyEngine.tsx]"]
  node_policy["Policy simulation<br/>policy UI"]
  node_opa{{"OPA integration<br/>policy client<br/>[opaClient.ts]"}}
end

subgraph group_admin["Admin Control Plane"]
  node_adminapp["Admin application<br/>admin React shell<br/>[AdminApp.tsx]"]
  node_adminlayout["Admin layout<br/>admin chrome<br/>[AdminLayout.tsx]"]
  node_adminstate["Admin overview<br/>admin store and service"]
end

subgraph group_platform["Client Platform"]
  node_api{{"API transport<br/>service boundary<br/>[api.ts]"}}
  node_realtime{{"Real-time client<br/>WebSocket abstraction<br/>[websocket.ts]"}}
  node_security{{"Token security<br/>browser security control<br/>[tokenManager.ts]"}}
  node_observability["Client observability<br/>performance monitoring"]
  node_deploy["Production deployment<br/>CI workflow"]
end

node_entry -->|"mounts"| node_app
node_app -->|"renders"| node_layout
node_app -->|"guards routes with"| node_protected
node_protected -->|"checks session"| node_auth
node_auth -->|"auth requests"| node_api
node_auth -->|"manages tokens"| node_security
node_app -->|"routes to"| node_vault
node_vault -->|"opens"| node_upload
node_vault -->|"uses"| node_files
node_upload -->|"protects files with"| node_crypto
node_files -->|"file requests"| node_api
node_app -->|"routes to"| node_governance
node_governance -->|"includes"| node_policy
node_policy -->|"evaluates through"| node_opa
node_app -->|"hosts admin route"| node_adminapp
node_adminapp -->|"uses"| node_adminlayout
node_adminapp -->|"loads operations"| node_adminstate
node_adminstate -->|"admin requests"| node_api
node_governance -.->|"receives live data"| node_realtime
node_app -.->|"records performance"| node_observability
node_deploy -->|"deploys production build"| node_app

click node_entry "https://github.com/okeson453/aegisshare-enterprise/blob/main/src/main.tsx"
click node_app "https://github.com/okeson453/aegisshare-enterprise/blob/main/src/App.tsx"
click node_layout "https://github.com/okeson453/aegisshare-enterprise/blob/main/src/components/layout/AppLayout.tsx"
click node_protected "https://github.com/okeson453/aegisshare-enterprise/blob/main/src/components/routing/ProtectedRoute.tsx"
click node_auth "https://github.com/okeson453/aegisshare-enterprise/blob/main/src/store/authStore.ts"
click node_vault "https://github.com/okeson453/aegisshare-enterprise/blob/main/src/pages/Vault/Vault.tsx"
click node_upload "https://github.com/okeson453/aegisshare-enterprise/blob/main/src/components/files/UploadModal.tsx"
click node_files "https://github.com/okeson453/aegisshare-enterprise/blob/main/src/store/filesStore.ts"
click node_crypto "https://github.com/okeson453/aegisshare-enterprise/blob/main/src/utils/crypto/aesGcm.ts"
click node_governance "https://github.com/okeson453/aegisshare-enterprise/blob/main/src/pages/PolicyEngine/PolicyEngine.tsx"
click node_policy "https://github.com/okeson453/aegisshare-enterprise/blob/main/src/components/policy/PolicySimulator.tsx"
click node_opa "https://github.com/okeson453/aegisshare-enterprise/blob/main/src/lib/opaClient.ts"
click node_adminapp "https://github.com/okeson453/aegisshare-enterprise/blob/main/src/admin/AdminApp.tsx"
click node_adminlayout "https://github.com/okeson453/aegisshare-enterprise/blob/main/src/admin/AdminLayout.tsx"
click node_adminstate "https://github.com/okeson453/aegisshare-enterprise/blob/main/src/admin/store/adminOverviewStore.ts"
click node_api "https://github.com/okeson453/aegisshare-enterprise/blob/main/src/services/api.ts"
click node_realtime "https://github.com/okeson453/aegisshare-enterprise/blob/main/src/lib/websocket.ts"
click node_security "https://github.com/okeson453/aegisshare-enterprise/blob/main/src/utils/tokenManager.ts"
click node_observability "https://github.com/okeson453/aegisshare-enterprise/blob/main/src/utils/performanceMonitor.ts"
click node_deploy "https://github.com/okeson453/aegisshare-enterprise/blob/main/.github/workflows/deploy-production.yml"

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_entry,node_app,node_layout,node_protected toneBlue
class node_auth,node_vault,node_upload,node_files,node_crypto,node_governance,node_policy,node_opa toneAmber
class node_adminapp,node_adminlayout,node_adminstate toneMint
class node_api,node_realtime,node_security,node_observability,node_deploy toneRose
```

## Components

### Application Shell

- [Vite entry](https://github.com/okeson453/aegisshare-enterprise/blob/main/src/main.tsx): React bootstrap · `src/main.tsx`
- [App router](https://github.com/okeson453/aegisshare-enterprise/blob/main/src/App.tsx): React application · Composes routes, error handling, and product surfaces. · `src/App.tsx`
- [Application layout](https://github.com/okeson453/aegisshare-enterprise/blob/main/src/components/layout/AppLayout.tsx): shared chrome · `src/components/layout/AppLayout.tsx`
- [Protected routes](https://github.com/okeson453/aegisshare-enterprise/blob/main/src/components/routing/ProtectedRoute.tsx): authorization gate · `src/components/routing/ProtectedRoute.tsx`

### Product Domains

- [Authentication domain](https://github.com/okeson453/aegisshare-enterprise/blob/main/src/store/authStore.ts): Zustand store, hook, service · `src/store/authStore.ts`
- [Vault file workflows](https://github.com/okeson453/aegisshare-enterprise/blob/main/src/pages/Vault/Vault.tsx): page and file UI · Upload, listing, and file detail interactions. · `src/pages/Vault/Vault.tsx`
- [File upload](https://github.com/okeson453/aegisshare-enterprise/blob/main/src/components/files/UploadModal.tsx): reusable UI · `src/components/files/UploadModal.tsx`
- [Files domain](https://github.com/okeson453/aegisshare-enterprise/blob/main/src/store/filesStore.ts): Zustand store and service · `src/store/filesStore.ts`
- [Browser cryptography](https://github.com/okeson453/aegisshare-enterprise/blob/main/src/utils/crypto/aesGcm.ts): zero-knowledge utilities · AES-GCM, Argon2, and ECIES primitives. · `src/utils/crypto/aesGcm.ts`
- [Governance surfaces](https://github.com/okeson453/aegisshare-enterprise/blob/main/src/pages/PolicyEngine/PolicyEngine.tsx): audit, policy, access pages · Compliance-oriented audit, policy, and access-control workflows. · `src/pages/PolicyEngine/PolicyEngine.tsx`
- [Policy simulation](https://github.com/okeson453/aegisshare-enterprise/blob/main/src/components/policy/PolicySimulator.tsx): policy UI · `src/components/policy/PolicySimulator.tsx`
- [OPA integration](https://github.com/okeson453/aegisshare-enterprise/blob/main/src/lib/opaClient.ts): policy client · `src/lib/opaClient.ts`

### Admin Control Plane

- [Admin application](https://github.com/okeson453/aegisshare-enterprise/blob/main/src/admin/AdminApp.tsx): admin React shell · Separate operational administration module. · `src/admin/AdminApp.tsx`
- [Admin layout](https://github.com/okeson453/aegisshare-enterprise/blob/main/src/admin/AdminLayout.tsx): admin chrome · `src/admin/AdminLayout.tsx`
- [Admin overview](https://github.com/okeson453/aegisshare-enterprise/blob/main/src/admin/store/adminOverviewStore.ts): admin store and service · `src/admin/store/adminOverviewStore.ts`

### Client Platform

- [API transport](https://github.com/okeson453/aegisshare-enterprise/blob/main/src/services/api.ts): service boundary · Pages and domain services are decoupled from backend transport. · `src/services/api.ts`
- [Real-time client](https://github.com/okeson453/aegisshare-enterprise/blob/main/src/lib/websocket.ts): WebSocket abstraction · `src/lib/websocket.ts`
- [Token security](https://github.com/okeson453/aegisshare-enterprise/blob/main/src/utils/tokenManager.ts): browser security control · `src/utils/tokenManager.ts`
- [Client observability](https://github.com/okeson453/aegisshare-enterprise/blob/main/src/utils/performanceMonitor.ts): performance monitoring · `src/utils/performanceMonitor.ts`
- [Production deployment](https://github.com/okeson453/aegisshare-enterprise/blob/main/.github/workflows/deploy-production.yml): CI workflow · `.github/workflows/deploy-production.yml`

## Connections

- Vite entry → App router: mounts
- App router → Application layout: renders
- App router → Protected routes: guards routes with
- Protected routes → Authentication domain: checks session
- Authentication domain → API transport: auth requests
- Authentication domain → Token security: manages tokens
- App router → Vault file workflows: routes to
- Vault file workflows → File upload: opens
- Vault file workflows → Files domain: uses
- File upload → Browser cryptography: protects files with
- Files domain → API transport: file requests
- App router → Governance surfaces: routes to
- Governance surfaces → Policy simulation: includes
- Policy simulation → OPA integration: evaluates through
- App router → Admin application: hosts admin route
- Admin application → Admin layout: uses
- Admin application → Admin overview: loads operations
- Admin overview → API transport: admin requests
- Governance surfaces → Real-time client: receives live data
- App router → Client observability: records performance
- Production deployment → App router: deploys production build
