Samvaad builds a cognitive twin that learns how each user processes information and an advocacy engine that can communicate on their behalf. The system is engineered for accessibility, privacy, and measurable outcomes, with Azure AI and Supabase as core infrastructure.
- Cognitive Twin Engine: captures learning signals and adapts explanations.
- Advocacy Engine: turns user intent into structured messages for calls/chats.
- Accessibility support: speech input/output, contrast controls, adjustable typography.
- Privacy controls: Supabase Row Level Security (RLS) and user-owned data deletion.
flowchart LR
User[Browser]
Frontend[Next.js App Router]
API[Next.js API Routes]
Twin[Cognitive Twin Engine]
Advocate[Advocacy Engine]
Supabase[(Supabase Auth + DB + RLS)]
AOAI[Azure OpenAI]
Speech[Azure Speech]
Translator[Azure Translator]
User --> Frontend
Frontend -->|auth + session| Supabase
Frontend --> API
API --> Twin
API --> Advocate
Twin -->|learning profile| Supabase
Advocate -->|templates/status| Supabase
Twin --> AOAI
Advocate --> AOAI
Advocate --> Speech
Advocate --> Translator
Twin --> Advocate
- Frontend (Next.js App Router): UI, accessibility controls, session handling.
- Backend APIs: route orchestration, validation, Supabase access.
- Cognitive Twin Engine: learning signal capture, prompt construction, adaptive responses.
- Advocacy Engine: template selection, context packaging, delivery formatting.
- Azure AI Services: OpenAI for reasoning, Speech for TTS/STT, Translator for multilingual support.
- Supabase: Auth, database with RLS enforcing per-user isolation.
- User interacts via dashboard or chat (Next.js).
- API routes capture prompts, learning goals, and context.
- Cognitive Twin Engine builds a structured prompt with user profile + history (from Supabase).
- Azure OpenAI returns tailored explanations; results are stored back with RLS.
- UI renders adapted guidance; optional Speech output stays client-side unless Azure Speech is configured.
- User selects an advocacy template or free-form request.
- API routes call Advocacy Engine to shape tone, constraints, and target metadata.
- Engine queries Azure OpenAI for message construction; Translator/Speech are invoked when enabled.
- Final message is stored in Supabase with audit metadata; only user-owned rows are exposed.
- UI presents ready-to-send text or speech for external channels the user controls.
- Supabase RLS keeps user data tenant-scoped; API routes access only via authenticated sessions.
- Only minimal prompt context is sent to Azure services; secrets remain server-side.
- Speech features default to browser APIs; Azure Speech is opt-in for neural quality.
| Azure Service | Purpose | Input | Output | Why this service |
|---|---|---|---|---|
| Azure OpenAI | Cognitive reasoning, adaptive tutoring, advocacy drafting | User goals, profile signals, conversation context | Personalized explanations or advocacy text | High-quality reasoning with controllable deployments and latency |
| Azure Speech | Text-to-speech / speech-to-text for accessibility | User microphone audio or generated text | Transcripts or neural speech | Reliable multilingual STT/TTS with edge caching options |
| Azure Translator | Multilingual learning and advocacy | Source text + target locale | Translated text | Built-in locale detection and enterprise compliance |
Prerequisites: Node.js 18+, pnpm (or npm), Supabase project, Azure OpenAI credentials (for full AI features).
- Install dependencies
pnpm install
- Configure
.env.localNEXT_PUBLIC_SUPABASE_URL=<supabase_url> NEXT_PUBLIC_SUPABASE_ANON_KEY=<supabase_anon_key> AZURE_OPENAI_ENDPOINT=<https://your-resource.openai.azure.com> AZURE_OPENAI_API_KEY=<key> AZURE_OPENAI_DEPLOYMENT=gpt-4 AZURE_OPENAI_API_VERSION=2024-02-15-preview NEXT_PUBLIC_AZURE_SPEECH_KEY=<optional> NEXT_PUBLIC_AZURE_SPEECH_REGION=<optional> NEXT_PUBLIC_AZURE_TRANSLATOR_KEY=<optional> NEXT_PUBLIC_AZURE_TRANSLATOR_ENDPOINT=https://api.cognitive.microsofttranslator.com NEXT_PUBLIC_AZURE_TRANSLATOR_REGION=<optional>
- Apply Supabase migration in
supabase/migrations/20250313212230_init.sql. - Run locally
pnpm dev
- Next.js 15 (App Router), TypeScript, Tailwind CSS
- Supabase (PostgreSQL, Auth, RLS)
- Azure OpenAI, Azure Speech, Azure Translator
- Deployment targets: Vercel or any Node-compatible host
| Route | Purpose |
|---|---|
/ |
Landing |
/login |
Auth |
/dashboard |
Overview |
/dashboard/chat |
Cognitive twin + advocacy chat |
/dashboard/learning |
Learning analytics |
/dashboard/profile |
Preferences and accessibility |
- Cognitive modeling requires capturing weak signals (pace, hesitations) and keeping prompts compact for latency.
- Real-time adaptation needs fast read/write against RLS while preserving session context.
- Advocacy must balance assertiveness, cultural tone, and compliance across channels.
- Accessibility demands speech, contrast, and motion controls without degrading performance.
- Privacy and trust require minimal data sent to Azure endpoints and auditable Supabase storage.
- Multi-tenant cognitive twins with isolated Supabase schemas and shared Azure deployments.
- Real-time voice advocacy with streaming STT → reasoning → TTS loops.
- Fine-grained consent and audit trails per template and recipient.
- Enterprise and education rollout with SCIM/SAML, usage quotas, and localized content packs.
Pull requests are welcome; align changes with accessibility, privacy, and testing standards.
MIT