How husnaqayyum99-byte/hks works
Apna Wakeel is a Pakistan-focused legal information and navigation product: users describe a legal problem, answer follow-up questions, and receive an evidence-backed response; signed-in users can also manage chat history, documents, and voice input. The frontend provides the user workflow and account experience, while the FastAPI backend exposes authentication, conversation, legal, and document routes. The sampled orchestrator shows a staged case-analysis pipeline. Some frontend-to-backend wiring and unsampled route internals are not shown, so those relationships are omitted rather than inferred.
Main entry points: orchestrator.py Case orchestrator · App.jsx App workflow · main.py FastAPI application · ai_service.py AI model service
Components 34
Frontend experience
- App workflow
apna-wakeel-frontend/src/App.jsx - Problem intake
apna-wakeel-frontend/src/pages/Describe.jsx - Clarification
apna-wakeel-frontend/src/pages/FollowUp.jsx - Analysis view
apna-wakeel-frontend/src/pages/Analysis.jsx - Legal results
apna-wakeel-frontend/src/pages/Results.jsx - Chat workspace
apna-wakeel-frontend/src/pages/Dashboard.jsx - Voice experience
apna-wakeel-frontend/src/pages/Voice.jsx - Speech service
apna-wakeel-frontend/src/services/speech.js - API client
apna-wakeel-frontend/src/services/api.js - Auth client
apna-wakeel-frontend/src/services/auth.js - Auth state
apna-wakeel-frontend/src/context/AuthContext.jsx - Language support
apna-wakeel-frontend/src/i18n/LanguageContext.jsx
Backend API
- FastAPI application
bknd/app/main.py - Authentication routes
bknd/app/api/auth.py - Conversation routes
bknd/app/api/conversations.py - Legal routes
bknd/app/api/legal.py - Document routes
bknd/app/api/documents.py
Case analysis
- Case orchestrator
bknd/app/agents/orchestrator.py - Case intake
bknd/app/agents/intake_agent.py - Case classification
bknd/app/agents/classification_agent.py - Follow-up generation
bknd/app/agents/followup_agent.py - Research planning
bknd/app/agents/research_agent.py - Claim verification
bknd/app/agents/verification_agent.py - Response generation
bknd/app/agents/response_agent.py
Legal sources
- Source registry
bknd/app/legal_sources/source_registry.py - Evidence retrieval
bknd/app/legal_sources/evidence_retriever.py - Statute retrieval
bknd/app/legal_sources/statute_retriever.py - Evidence record
bknd/app/legal_sources/evidence.py
Platform services
- AI model service
bknd/app/services/ai_service.py - Conversation database
bknd/app/database/connection.py - Auth service
bknd/app/services/auth_service.py - Supabase
bknd/app/supabase_client.py - Runtime settings
bknd/app/core/config.py
Other components
- Legal help seeker
Connections 44
- Legal help seeker → App workflow: uses
apna-wakeel-frontend/src/App.jsx - App workflow → Problem intake: renders
apna-wakeel-frontend/src/App.jsx - App workflow → Clarification: renders
apna-wakeel-frontend/src/App.jsx - App workflow → Analysis view: renders
apna-wakeel-frontend/src/App.jsx - App workflow → Legal results: renders
apna-wakeel-frontend/src/App.jsx - App workflow → Chat workspace: renders
apna-wakeel-frontend/src/App.jsx - App workflow → Auth state: reads auth state
apna-wakeel-frontend/src/App.jsx - Problem intake → Clarification: continues to
apna-wakeel-frontend/src/App.jsx - Clarification → Analysis view: continues to
apna-wakeel-frontend/src/App.jsx - Analysis view → Legal results: continues to
apna-wakeel-frontend/src/App.jsx - Chat workspace → API client: calls
apna-wakeel-frontend/src/pages/Dashboard.jsx - Voice experience → Speech service: uses
apna-wakeel-frontend/src/pages/Voice.jsx - Auth state → Auth client: uses
apna-wakeel-frontend/src/context/AuthContext.jsx - Auth client → FastAPI application: requests auth API
- FastAPI application → Authentication routes: registers
bknd/app/main.py - FastAPI application → Conversation routes: registers
bknd/app/main.py - FastAPI application → Legal routes: registers
bknd/app/main.py - FastAPI application → Document routes: registers
bknd/app/main.py - Conversation routes → Case orchestrator: processes cases
bknd/app/api/conversations.py - Conversation routes → Conversation database: reads and writes
bknd/app/api/conversations.py - Document routes → Conversation database: uses
bknd/app/api/documents.py - Authentication routes → Auth service: delegates
bknd/app/api/auth.py - Auth service → Supabase: authenticates with
bknd/app/services/auth_service.py - Case orchestrator → Case intake: calls
bknd/app/agents/orchestrator.py - Case orchestrator → Case classification: classifies with
bknd/app/agents/orchestrator.py - Case orchestrator → Follow-up generation: requests questions
bknd/app/agents/orchestrator.py - Case orchestrator → Research planning: plans research
bknd/app/agents/orchestrator.py - Case orchestrator → Claim verification: verifies claims
bknd/app/agents/orchestrator.py - Case orchestrator → Response generation: generates response
bknd/app/agents/orchestrator.py - Case orchestrator → Source registry: selects sources
bknd/app/agents/orchestrator.py - Case orchestrator → Evidence retrieval: collects evidence
bknd/app/agents/orchestrator.py - Case orchestrator → Statute retrieval: collects statutes
bknd/app/agents/orchestrator.py - Evidence retrieval → Source registry: uses registry
bknd/app/legal_sources/evidence_retriever.py - Evidence retrieval → Evidence record: builds records
bknd/app/legal_sources/evidence_retriever.py - Statute retrieval → Evidence record: uses records
bknd/app/legal_sources/statute_retriever.py - Research planning → AI model service: generates plan
bknd/app/agents/research_agent.py - Response generation → AI model service: generates response
bknd/app/agents/response_agent.py - Claim verification → AI model service: checks claims
bknd/app/agents/verification_agent.py - Response generation → Evidence record: uses evidence
bknd/app/agents/response_agent.py - Claim verification → Evidence record: uses evidence
bknd/app/agents/verification_agent.py - AI model service → Runtime settings: reads model config
bknd/app/services/ai_service.py - Conversation database → Runtime settings: reads DB config
bknd/app/database/connection.py - FastAPI application → Conversation database: initializes schema
bknd/app/main.py - Supabase → Runtime settings: reads credentials
bknd/app/supabase_client.py