How albkue/ai-mood-journal works
AI Mood Journal combines a Flutter client, FastAPI account and journal APIs, relational persistence, and NLP-driven mood analysis and insights. The documented user workflow is to authenticate, create journal entries, and receive mood analysis and personalized trend insights; the repository excerpts show backend and ML internals, but not the Flutter application’s Dart runtime. The README documents the cross-platform client and recommendation capability, while the source index identifies ML modules whose detailed implementations are only partly excerpted.
Main entry points: entry_analyzer.py Entry analyzer · main.py API application · insights_service.py Insights service · auth.py Auth endpoints
Components 24
Mobile client
- Flutter app
frontend/flutter_app
Backend API
- API application
backend/fastapi_server/app/main.py - Auth endpoints
backend/fastapi_server/app/routers/auth.py - Journal endpoints
backend/fastapi_server/app/routers/journal.py - ML endpoints
backend/fastapi_server/app/routers/ml.py - Authentication service
backend/fastapi_server/app/services/auth_service.py - Journal service
backend/fastapi_server/app/services/journal_service.py - Token security
backend/fastapi_server/app/auth.py - Input sanitization
backend/fastapi_server/app/utils/sanitization.py - API schemas
backend/fastapi_server/app/schemas.py
Persistence
- Journal repository
backend/fastapi_server/app/repositories/journal_repository.py - User repository
backend/fastapi_server/app/repositories/user_repository.py - Repository base
backend/fastapi_server/app/repositories/base_repository.py - User and entry models
backend/fastapi_server/app/models.py - Database sessions
backend/fastapi_server/app/database.py
ML analysis
- Entry analyzer
ml/services/entry_analyzer.py - Emotion prediction
ml/services/emotion_predictor.py - Topic modeling
ml/services/topic_modeler.py - Insights aggregation
ml/services/insights_aggregator.py - Insights service
ml/services/insights_service.py - Text preprocessing
ml/preprocessing/text_preprocessor.py - LDA training
ml/training/train_lda.py
Other components
- Journal user
- PostgreSQL
Connections 24
- Journal user → Flutter app: uses
README.md - Flutter app → API application: requests API
- API application → Auth endpoints: registers routes
backend/fastapi_server/app/main.py - API application → Journal endpoints: registers routes
backend/fastapi_server/app/main.py - API application → ML endpoints: registers routes
backend/fastapi_server/app/main.py - Auth endpoints → Authentication service: calls
backend/fastapi_server/app/routers/auth.py - Authentication service → User repository: queries users
backend/fastapi_server/app/services/auth_service.py - Authentication service → Token security: creates tokens
backend/fastapi_server/app/services/auth_service.py - Auth endpoints → Input sanitization: sanitizes input
backend/fastapi_server/app/routers/auth.py - Journal service → Journal repository: manages entries
backend/fastapi_server/app/services/journal_service.py - Journal repository → Repository base: inherits CRUD
backend/fastapi_server/app/repositories/journal_repository.py - User repository → Repository base: inherits CRUD
backend/fastapi_server/app/repositories/user_repository.py - Repository base → Database sessions: uses database base
backend/fastapi_server/app/repositories/base_repository.py - User and entry models → Database sessions: declares mapped models
backend/fastapi_server/app/models.py - Database sessions → PostgreSQL: connects to
backend/fastapi_server/app/database.py - Journal endpoints → Entry analyzer: integrates analysis
README.md - Journal endpoints → Insights service: integrates insights
README.md - ML endpoints → Insights service: integrates insights
README.md - Insights service → Entry analyzer: delegates analysis
ml/services/insights_service.py - Insights service → Insights aggregation: delegates aggregation
ml/services/insights_service.py - Entry analyzer → Emotion prediction: uses predictor
ml/services/entry_analyzer.py - Entry analyzer → Topic modeling: uses modeler
ml/services/entry_analyzer.py - Entry analyzer → Insights aggregation: uses aggregation
ml/services/entry_analyzer.py - LDA training → Topic modeling: trains topic model
ml/training/train_lda.py