How madhan-200/business-strategy-ai works
StratAI takes a business profile through authenticated onboarding, generates and persists a strategy, then presents strategy, growth, and content-calendar views. It also supports manual and scheduled strategy refreshes. The graph includes the documented subscription and PDF-export capabilities. Some UI and authentication links are supported by the SOURCE INDEX rather than excerpts; unsampled internals are not inferred beyond documented capabilities.
Main entry points: App.tsx App coordinator · cronService.ts Scheduled updates · strategyRoutes.ts Strategy routes · apiService.ts API client
Components 23
Web application
- App coordinator
App.tsx - Business onboarding
views/Onboarding.tsx - Growth dashboard
views/Dashboard.tsx - Strategy view
views/StrategyView.tsx - Content calendar
views/CalendarView.tsx - Subscription view
views/Subscription.tsx - PDF export
services/pdfExport.ts - Sign-in and signup
views/Login.tsx - Route protection
components/ProtectedRoute.tsx - API client
services/apiService.ts
Strategy API
- Strategy routes
backend/src/routes/strategyRoutes.ts - Strategy controller
backend/src/controllers/strategyController.ts - Update controller
backend/src/controllers/updateController.ts - Backend startup
backend/src/index.ts
Strategy engine
- AI strategy generation
backend/src/services/aiService.ts - Scheduled updates
backend/src/services/cronService.ts
Identity and data
- Authentication context
contexts/AuthContext.tsx - Firebase client
config/firebase.ts - Strategy persistence
backend/src/services/databaseService.ts - PostgreSQL connection
backend/src/config/database.ts
Other components
- Business owner
- Neon PostgreSQL
- Google Gemini
Connections 29
- Business owner → Business onboarding: enters profile
- Business owner → Sign-in and signup: signs in
README.md - App coordinator → Business onboarding: renders
App.tsx - Business onboarding → App coordinator: submits profile
App.tsx - App coordinator → API client: requests generation
App.tsx - API client → Firebase client: gets auth token
services/apiService.ts - API client → Strategy routes: sends HTTP request
services/apiService.ts - Backend startup → Strategy routes: mounts routes
backend/src/index.ts - Strategy routes → Strategy controller: dispatches strategy requests
backend/src/routes/strategyRoutes.ts - Strategy routes → Update controller: dispatches update requests
backend/src/routes/strategyRoutes.ts - Strategy controller → AI strategy generation: generates strategy
backend/src/controllers/strategyController.ts - Strategy controller → Strategy persistence: saves or retrieves
backend/src/controllers/strategyController.ts - AI strategy generation → Google Gemini: generates content
backend/src/services/aiService.ts - Strategy persistence → PostgreSQL connection: queries database
backend/src/services/databaseService.ts - PostgreSQL connection → Neon PostgreSQL: connects to
README.md - App coordinator → Growth dashboard: renders
App.tsx - App coordinator → Strategy view: renders
App.tsx - App coordinator → Content calendar: renders
App.tsx - App coordinator → Subscription view: renders
App.tsx - Strategy view → PDF export: exports strategy
views/StrategyView.tsx - Sign-in and signup → Authentication context: uses authentication
views/Login.tsx - App coordinator → Route protection: guards application route
App.tsx - Route protection → Authentication context: checks session
components/ProtectedRoute.tsx - Authentication context → Firebase client: uses Firebase auth
contexts/AuthContext.tsx - Backend startup → Scheduled updates: starts scheduler
backend/src/index.ts - Update controller → Scheduled updates: triggers refresh
backend/src/controllers/updateController.ts - Scheduled updates → AI strategy generation: regenerates strategies
backend/src/services/cronService.ts - Scheduled updates → Strategy persistence: saves refreshed strategies
backend/src/services/cronService.ts - Scheduled updates → PostgreSQL connection: selects due businesses
backend/src/services/cronService.ts