Dattavani Backend: core-service Module Map

Dattavani Backend: core-service Module Map A hierarchy diagram generated by Archify. core-service · FastAPI app in core-service/app · Root core-service FastAPI app incore-service/app Startup and settings · app object, lifespan, env settings · Branch Startup and settings app object, lifespan, envsettings main.py · app, error handlers, middleware, 27 routers · Leaf main.py app, error handlers,middleware, 27 routers lifespan.py · shared HTTP client, AI semaphores, cache warm-up · Leaf lifespan.py shared HTTP client, AIsemaphores, cache warm-up config.py · pydantic Settings from .env.<ENV> · Leaf config.py pydantic Settingsfrom .env.<ENV> Request plumbing · runs around every handler · Branch Request plumbing runs around every handler middleware/ · request id, log context, CORS on errors · Leaf middleware/ request id, logcontext, CORS on errors dependencies/ · kid JWT, parent-or-kid JWT, RLS Supabase clients · Leaf dependencies/ kid JWT, parent-or-kidJWT, RLS Supabase clients services/auth.py + supabase.py · parent JWT check, shared anon and service clients · Leaf services/auth.py +supabase.py parent JWT check, sharedanon and service clients utils/ · ApiResponse builder, JSON logs, JWT decode, RPC retry · Leaf utils/ ApiResponse builder,JSON logs, JWTdecode, RPC retry HTTP API by domain · routers in app/routers, logic in app/services · Branch HTTP API by domain routers in app/routers,logic in app/services Auth and family · parents, kids, PIN, consent · Branch Auth and family parents, kids, PIN,consent user_management.py · /api/auth: OTP, social, refresh, me, PIN, consent, deletion · Leaf user_management.py /api/auth: OTP,social, refresh, me,PIN, consent, deletion kids.py · /api/kids: profiles, select-profile, sessions, onboarding · Leaf kids.py /api/kids: profiles,select-profile,sessions, onboarding profiles.py · /api/profiles: initialize, link, merge, unlink · Leaf profiles.py /api/profiles: initialize,link, merge, unlink Auth services · auth_me_service, kid_profile_jwt, pin_security, consent_service, account_deletion_service · Leaf Auth services auth_me_service,kid_profile_jwt,pin_security,consent_service,account_deletion_service App config and flags · what the app reads at boot · Branch App config and flags what the app reads at boot config_features.py · /api/config and /api/config/features · Leaf config_features.py /api/config and/api/config/features Config services · app_public_config_service, feature_flag_service, cache/app_config_cache · Leaf Config services app_public_config_service, feature_flag_service,cache/app_config_cache Learning content · books, chapters, quizzes, stories, screen time · Branch Learning content books, chapters, quizzes,stories, screen time daily_learnings.py · /api/learnings: books, sections, chapters, chunks, quizzes · Leaf daily_learnings.py /api/learnings: books,sections, chapters,chunks, quizzes book_detail_v2 routers (3) · /api/v2/learnings: book detail, quiz, complete · Leaf book_detail_v2routers (3) /api/v2/learnings: bookdetail, quiz, complete story_time.py · /api/stories: bedtime stories · Leaf story_time.py /api/stories:bedtime stories story_time_v2.py · /api/v2/stories · Leaf story_time_v2.py /api/v2/stories daily_usage.py · household daily screen-time minutes · Leaf daily_usage.py household dailyscreen-time minutes favourites.py · /api/favourites · Leaf favourites.py /api/favourites Content services · daily_learnings_service, book_detail_v2_service, story_time_service, daily_usage_service, membership_guard · Leaf Content services daily_learnings_service,book_detail_v2_service,story_time_service,daily_usage_service,membership_guard Ask Tataji and AI · chat, RAG, avatar video, live voice · Branch Ask Tataji and AI chat, RAG, avatarvideo, live voice ask_tataji.py · /api/chat, /api/conversations, /api/tataji · Leaf ask_tataji.py /api/chat,/api/conversations, /api/tataji rag.py · /api/rag, parent JWT applied at include · Leaf rag.py /api/rag, parent JWTapplied at include avatar_session.py · /api/avatar-session · Leaf avatar_session.py /api/avatar-session swamiji_voice.py · /api/swamiji · Leaf swamiji_voice.py /api/swamiji AI services · chrag_client, chat_persistence_service, tataji_audio_service, curated_prompt_cache_service, avatar_session, swamiji_voice_service · Leaf AI services chrag_client,chat_persistence_service, tataji_audio_service,curated_prompt_cache_service, avatar_session,swamiji_voice_service Gamification · XP, levels, rings, streaks, leaderboard · Branch Gamification XP, levels, rings,streaks, leaderboard gamification.py · home-stats, levels, weekly-stats, leaderboard, track-activity · Leaf gamification.py home-stats, levels,weekly-stats, leaderboard,track-activity Gamification services · gamification_service, xp_engine, levels_service, badge_service · Leaf Gamificationservices gamification_service,xp_engine, levels_service,badge_service Subscriptions and payments · trial, Stripe, RevenueCat, promo · Branch Subscriptionsand payments trial, Stripe,RevenueCat, promo subscription.py · /api/subscription: status, plans, billing-route, change, cancel · Leaf subscription.py /api/subscription: status,plans, billing-route,change, cancel payments.py · /api/payments: Stripe checkout, portal, invoices, Stripe webhook · Leaf payments.py /api/payments: Stripecheckout, portal,invoices, Stripe webhook payment_redirects.py · /payments/return, cancel, portal-return pages · Leaf payment_redirects.py /payments/return, cancel,portal-return pages promo.py · promo code redemption · Leaf promo.py promo code redemption RevenueCat webhook routers (2) · production /api/payments and sandbox /sandbox-api/payments · Leaf RevenueCat webhookrouters (2) production /api/paymentsand sandbox/sandbox-api/payments Billing services · payment_service, trial_service, revenuecat_service, subscription_lifecycle_service, promo_service · Leaf Billing services payment_service,trial_service,revenuecat_service,subscription_lifecycle_service, promo_service Notifications and engagement · push tokens, inbox, review prompt · Branch Notificationsand engagement push tokens, inbox,review prompt notifications.py · FCM device token, inbox, mark read · Leaf notifications.py FCM device token,inbox, mark read review_prompt.py · store review prompt status and attempts · Leaf review_prompt.py store review promptstatus and attempts Notification services · notification_service (FCM), notification_inbox_service, email_service (SMTP), parent_review_prompt_service · Leaf Notificationservices notification_service(FCM),notification_inbox_service, email_service (SMTP),parent_review_prompt_service Sharing, media and feedback · share links, resume points, parent feedback · Branch Sharing, media andfeedback share links, resumepoints, parent feedback social_share.py · share payloads and share events · Leaf social_share.py share payloads andshare events media.py · /api/media resume positions · Leaf media.py /api/mediaresume positions parent_feedback.py · parent in-app feedback · Leaf parent_feedback.py parent in-app feedback Sharing and media services · social_share_service, media_service, r2_storage_service, parent_app_feedback_service · Leaf Sharing andmedia services social_share_service, media_service,r2_storage_service,parent_app_feedback_service jobs/ (17 cron CLIs) · python -m app.jobs.run_* calls services/*_job.py · Branch jobs/ (17 cron CLIs) python -m app.jobs.run_*calls services/*_job.py Push jobs (7) · streak, inactivity nudge, inactive catch-up, leaderboard rank, login activity, weekly recap, Tataji prompt · Leaf Push jobs (7) streak, inactivity nudge,inactive catch-up,leaderboard rank, loginactivity, weekly recap,Tataji prompt Email and trial jobs (4) · first-session follow-up, lapsed kid, renewal reminder, trial lifecycle · Leaf Email and trial jobs(4) first-session follow-up,lapsed kid, renewalreminder, trial lifecycle Billing and retention jobs (4) · payment reconciliation, invoice retention, account deletion retention, trial usage prune · Leaf Billing andretention jobs (4) payment reconciliation,invoice retention, accountdeletion retention, trialusage prune Maintenance jobs (2) · analytics id backfill, curated prompt cache warm · Leaf Maintenance jobs (2) analytics id backfill,curated prompt cache warm Shared data and templates · contracts, catalogs, caches, email HTML · Branch Shared data andtemplates contracts, catalogs,caches, email HTML schemas/ · models.py bodies, ApiResponse, chrag, avatar and swamiji contracts · Leaf schemas/ models.py bodies,ApiResponse, chrag, avatarand swamiji contracts constants/ · response codes and messages, notification and email catalogs · Leaf constants/ response codes andmessages, notificationand email catalogs cache/ · TTL caches: app_config, learnings catalog, story catalog · Leaf cache/ TTL caches:app_config, learningscatalog, story catalog email_templates/ · EML-* bodies, layouts, partials, assets · Leaf email_templates/ EML-* bodies, layouts,partials, assets 61 3 4 41 4 2 7 5 2 6 3 4 4 4 Expand all