How afnan-0206/ai-for-accessibility-inclusion works
Samajh is a multilingual document-understanding app: people sign in, submit a notice or form, receive a structured explanation, and can revisit it or ask follow-up questions. The client also provides accessibility controls, read-aloud support, and voice input. The server authenticates requests, analyzes documents, and stores user-scoped results. The map follows the shown route and service calls; some page-to-API relationships are supported by the SOURCE INDEX, while unsampled implementation details are not inferred.
Main entry points: App.jsx App and routes · aiService.js AI analysis service · client.js API client · DocumentResultPage.jsx Analysis and Q&A
Components 27
Client experience
- App and routes
client/src/App.jsx - Document dashboard
client/src/pages/DashboardPage.jsx - Analysis and Q&A
client/src/pages/DocumentResultPage.jsx - Document history
client/src/pages/HistoryPage.jsx - Accessibility controls
client/src/components/A11yIntegration.jsx - Voice input
client/src/hooks/useVoiceInput.js - Read aloud
client/src/components/ReadAloudButton.jsx - API client
client/src/api/client.js
Identity
- Auth state
client/src/context/AuthContext.jsx - Sign-in pages
client/src/pages/LoginPage.jsx - Registration page
client/src/pages/RegisterPage.jsx - Auth routes
server/src/routes/authRoutes.js - Token authentication
server/src/middleware/auth.js - JWT utilities
server/src/utils/jwt.js
Document services
- HTTP API server
server/src/index.js - Document routes
server/src/routes/documentRoutes.js - File upload
server/src/middleware/upload.js - Document operations
server/src/services/documentService.js
AI analysis
- AI analysis service
server/src/services/ai/aiService.js - AI prompts
server/src/services/prompts/documentPrompt.js - Analysis schema
server/src/services/schemas/aiSchema.js - AI parse errors
server/src/services/schemas/aiErrors.js
Persistence
- User records
server/src/models/User.js - Document records
server/src/models/Document.js - Supabase database
server/src/config/db.js
Other components
- Document user
- Google Gemini
Connections 34
- Document user → App and routes: uses
client/src/App.jsx - App and routes → Sign-in pages: routes
client/src/App.jsx - App and routes → Registration page: routes
client/src/App.jsx - App and routes → Document dashboard: protects route
client/src/App.jsx - App and routes → Analysis and Q&A: protects route
client/src/App.jsx - App and routes → Document history: protects route
client/src/App.jsx - App and routes → Auth state: provides state
client/src/App.jsx - App and routes → Accessibility controls: provides controls
client/src/App.jsx - Sign-in pages → Auth state: uses
client/src/pages/LoginPage.jsx - Registration page → Auth state: uses
client/src/pages/RegisterPage.jsx - Auth state → API client: calls auth
client/src/context/AuthContext.jsx - Document dashboard → API client: requests documents
client/src/pages/DashboardPage.jsx - Document history → API client: loads history
client/src/pages/HistoryPage.jsx - Analysis and Q&A → API client: loads and asks
client/src/pages/DocumentResultPage.jsx - Analysis and Q&A → Voice input: uses input
client/src/pages/DocumentResultPage.jsx - Analysis and Q&A → Read aloud: renders summary
client/src/pages/DocumentResultPage.jsx - API client → HTTP API server: sends API requests
client/src/api/client.js - HTTP API server → Auth routes: mounts auth
server/src/index.js - HTTP API server → Document routes: mounts documents
server/src/index.js - Auth routes → User records: reads and writes
server/src/routes/authRoutes.js - Auth routes → JWT utilities: issues tokens
server/src/routes/authRoutes.js - Auth routes → Token authentication: protects profile
server/src/routes/authRoutes.js - Token authentication → JWT utilities: verifies tokens
server/src/middleware/auth.js - Document routes → Token authentication: authenticates
server/src/routes/documentRoutes.js - Document routes → File upload: accepts file
server/src/routes/documentRoutes.js - Document routes → Document operations: calls operations
server/src/routes/documentRoutes.js - Document operations → AI analysis service: analyzes and answers
server/src/services/documentService.js - Document operations → Document records: stores and retrieves
server/src/services/documentService.js - AI analysis service → Google Gemini: generates content
server/src/services/ai/aiService.js - AI analysis service → AI prompts: gets instructions
server/src/services/ai/aiService.js - AI analysis service → Analysis schema: validates output
server/src/services/ai/aiService.js - AI analysis service → AI parse errors: reports parse failure
server/src/services/ai/aiService.js - User records → Supabase database: uses database
server/src/models/User.js - Document records → Supabase database: uses database
server/src/models/Document.js