# Communication Platform — Frontend Architecture

**Product:** Torbat Communication  
**Status:** SMS MVP Production Ready  
**Module root:** `frontend/modules/communication/`  
**Routes:** `frontend/app/communication/` (thin App Router only)

## Layers

```
app/communication/          → page.tsx, layout.tsx, loading.tsx, error.tsx only
frontend/modules/communication/
  ├── components/           → Portal shell, FeatureLock, ListCrud factory
  ├── constants/            → portals, featureRegistry, resourceRegistry, permissions
  ├── design-system/        → Table, StatGrid, StatusChip, tokens
  ├── features/             → Page implementations
  ├── hooks/                → capabilities, permissions
  ├── pages/                → shared loaders/errors
  ├── services/             → communication-api.ts (BFF client)
  └── types/
frontend/app/api/communication/[...path]/route.ts  → BFF → :8005
```

## Dependency rules

- Business code lives in `frontend/modules/communication/` only
- Reuse `@/src/shared/ui`, `@/components/ds` — never duplicate
- No imports from sibling business modules
- Locked future modules use `CommunicationFeatureLock` — no API calls

## Capability model

Backend `/capabilities` returns `features: string[]`. Normalized to `Record<string, boolean>` in `useCommunicationCapabilities`. Future channel features stay `false` until backend enables them; UI auto-unlocks via gate.

## SMS (active)

Real backend integration for: providers, senders, templates, contacts, sources, messages, queue, OTP, monitoring, health, capabilities.

## Related

- [communication-routing-map.md](./communication-routing-map.md)
- [communication-component-map.md](./communication-component-map.md)
- [communication-feature-lock-report.md](./communication-feature-lock-report.md)
