How ishaq-5012/sutra-fintech-ai works
Sutra AI is a financial-management application for small and rural businesses. Users register or sign in, record transactions by form or voice, then review cash-flow forecasts, financial-health scores, risk alerts, and recommendations. The frontend manages session and transaction state and calls a FastAPI backend; backend routes delegate analysis to services that use transaction history and persist results. The excerpts establish the app’s routing, selected service calls, and database setup. Several UI and backend links are based only on indexed imports or API endpoint names, so those are marked unverified where appropriate.
Main entry points: App.tsx App routes · database.py SQL database · main.py FastAPI app · risk_service.py Health and risk analysis
Components 27
Web application
- App routes
frontend/src/App.tsx - Auth state
frontend/src/hooks/useAuth.tsx - Transaction state
frontend/src/hooks/useTransactions.tsx - API client
frontend/src/services/api.ts - Transaction entry
frontend/src/components/TransactionForm.tsx - Voice entry
frontend/src/components/VoiceInput.tsx - Business dashboard
frontend/src/components/Dashboard.tsx - Health view
frontend/src/components/FinancialHealth.tsx - Risk alerts
frontend/src/components/RiskAlerts.tsx - Recommendations view
frontend/src/components/Recommendations.tsx
Backend API
- FastAPI app
backend/app/main.py - Authentication routes
backend/app/api/routes/auth.py - Transaction routes
backend/app/api/routes/transactions.py - Prediction routes
backend/app/api/routes/predictions.py - Recommendation routes
backend/app/api/routes/recommendations.py - Token security
backend/app/core/security.py
Financial analysis
- Cash-flow forecasts
backend/app/services/prediction_service.py - Health and risk analysis
backend/app/services/risk_service.py - Recommendation generation
backend/app/services/recommendation_service.py - Weather and season
backend/app/services/weather_service.py - Transaction text parsing
backend/app/services/nlp_service.py - Historical data generation
backend/app/services/mock_data_service.py
Persistence and domain
- User records
backend/app/models/user.py - Transactions
backend/app/models/transaction.py - Analysis records
backend/app/models/prediction.py - SQL database
backend/app/core/database.py
Other components
- Business user
Connections 48
- Business user → App routes: uses
frontend/src/App.tsx - App routes → Auth state: provides
frontend/src/App.tsx - App routes → Transaction state: provides
frontend/src/App.tsx - App routes → Transaction entry: routes to
frontend/src/App.tsx - App routes → Voice entry: routes to
frontend/src/App.tsx - App routes → Business dashboard: routes to
- App routes → Health view: renders
frontend/src/App.tsx - App routes → Risk alerts: renders
frontend/src/App.tsx - App routes → Recommendations view: renders
frontend/src/App.tsx - Auth state → API client: calls auth API
frontend/src/hooks/useAuth.tsx - Transaction state → API client: calls transaction API
frontend/src/hooks/useTransactions.tsx - Transaction entry → Transaction state: creates transactions
frontend/src/components/TransactionForm.tsx - Voice entry → Transaction state: creates transactions
frontend/src/components/VoiceInput.tsx - Voice entry → API client: parses voice text
frontend/src/components/VoiceInput.tsx - Health view → API client: requests health
frontend/src/components/FinancialHealth.tsx - API client → FastAPI app: sends API requests
- FastAPI app → Authentication routes: registers
backend/app/main.py - FastAPI app → Transaction routes: registers
backend/app/main.py - FastAPI app → Prediction routes: registers
backend/app/main.py - FastAPI app → Recommendation routes: registers
backend/app/main.py - Authentication routes → Token security: uses tokens
backend/app/api/routes/auth.py - Authentication routes → User records: accesses users
backend/app/api/routes/auth.py - Authentication routes → Historical data generation: initializes sample history
backend/app/api/routes/auth.py - Transaction routes → Transaction text parsing: parses transaction text
backend/app/api/routes/transactions.py - Transaction routes → Transactions: accesses transactions
backend/app/api/routes/transactions.py - Prediction routes → Cash-flow forecasts: requests forecasts
backend/app/api/routes/predictions.py - Prediction routes → Health and risk analysis: requests risk analysis
backend/app/api/routes/predictions.py - Prediction routes → Analysis records: accesses analysis records
backend/app/api/routes/predictions.py - Recommendation routes → Recommendation generation: requests recommendations
backend/app/api/routes/recommendations.py - Cash-flow forecasts → Historical data generation: generates history
backend/app/services/prediction_service.py - Health and risk analysis → Weather and season: requests weather factors
backend/app/services/risk_service.py - Health and risk analysis → Cash-flow forecasts: uses forecasts
backend/app/services/risk_service.py - Recommendation generation → Health and risk analysis: uses risk analysis
backend/app/services/recommendation_service.py - Recommendation generation → Weather and season: uses seasonal data
backend/app/services/recommendation_service.py - Cash-flow forecasts → Transactions: reads history
backend/app/services/prediction_service.py - Cash-flow forecasts → Analysis records: caches forecasts
backend/app/services/prediction_service.py - Health and risk analysis → Transactions: reads history
backend/app/services/risk_service.py - Health and risk analysis → Analysis records: stores health scores
backend/app/services/risk_service.py - Historical data generation → Transactions: creates transactions
backend/app/services/mock_data_service.py - Historical data generation → Analysis records: creates health score
backend/app/services/mock_data_service.py - SQL database → User records: defines base
backend/app/models/user.py - SQL database → Transactions: defines base
backend/app/models/transaction.py - SQL database → Analysis records: defines base
backend/app/models/prediction.py - FastAPI app → SQL database: creates tables
backend/app/main.py - Authentication routes → SQL database: uses database session
- Transaction routes → SQL database: uses database session
- Prediction routes → SQL database: uses database session
- Recommendation routes → SQL database: uses database session