How yadav0542-dotcom/social-media-analytics-dashboard works
This is a social-media analytics dashboard: users authenticate, connect Instagram or YouTube, sync provider data, and review account, post, and analytics views. The graph preserves the documented dashboard capabilities and the sampled OAuth, authentication, and routing flow. Several controllers, sync services, and frontend views were not excerpted; their internal calls are therefore omitted or shown only as unverified where documentation supports the capability.
Main entry points: App.tsx Web routes · database.ts PostgreSQL data · accountRoutes.ts Account routes · youtubeOAuthService.ts YouTube OAuth and sync
Components 29
Dashboard
- Web routes
frontend/src/App.tsx - Session context
frontend/src/context/AuthContext.tsx - Login page
frontend/src/pages/Login.tsx - Overview
frontend/src/pages/Overview.tsx - Platform view
frontend/src/pages/PlatformView.tsx - Posts view
frontend/src/pages/Posts.tsx - Settings view
frontend/src/pages/Settings.tsx - API client
frontend/src/services/api.ts - Analytics client
frontend/src/services/analytics.ts
API and identity
- Auth routes
backend/src/routes/authRoutes.ts - Account routes
backend/src/routes/accountRoutes.ts - Analytics routes
backend/src/routes/analyticsRoutes.ts - Post routes
backend/src/routes/postRoutes.ts - Auth controller
backend/src/controllers/authController.ts - Auth service
backend/src/services/authService.ts - JWT authorization
backend/src/middleware/auth.ts - JWT utilities
backend/src/utils/jwt.ts
Social integrations
- Instagram OAuth
backend/src/services/instagramOAuthService.ts - Instagram sync
backend/src/services/instagramSyncService.ts - YouTube OAuth and sync
backend/src/services/youtubeOAuthService.ts - YouTube adapter
backend/src/adapters/YouTubeAdapter.ts
Analytics data
- PostgreSQL data
backend/src/config/database.ts - Analytics service
backend/src/services/analyticsService.ts - Post service
backend/src/services/postService.ts - Token encryption
backend/src/utils/tokenEncryption.ts - Sample data seeding
backend/src/services/seedService.ts
Other components
- Dashboard user
- Instagram API
- YouTube API
Connections 37
- Dashboard user → Web routes: opens
- Web routes → Login page: routes to
frontend/src/App.tsx - Web routes → Overview: routes to
frontend/src/App.tsx - Web routes → Platform view: routes to
frontend/src/App.tsx - Web routes → Posts view: routes to
frontend/src/App.tsx - Web routes → Settings view: routes to
frontend/src/App.tsx - Login page → Session context: uses session
frontend/src/context/AuthContext.tsx - Session context → Auth routes: requests auth
- Auth routes → Auth controller: dispatches
backend/src/routes/authRoutes.ts - Auth controller → Auth service: delegates
backend/src/controllers/authController.ts - Auth service → PostgreSQL data: reads and writes
backend/src/services/authService.ts - JWT authorization → JWT utilities: verifies token
backend/src/middleware/auth.ts - Account routes → JWT authorization: protects routes
backend/src/routes/accountRoutes.ts - Analytics routes → JWT authorization: protects routes
backend/src/routes/analyticsRoutes.ts - Post routes → JWT authorization: protects routes
backend/src/routes/postRoutes.ts - Settings view → API client: calls API
frontend/src/pages/Settings.tsx - Settings view → Account routes: connects accounts
- Account routes → Instagram sync: dispatches sync
backend/src/routes/accountRoutes.ts - Account routes → Instagram OAuth: dispatches OAuth
- Account routes → YouTube OAuth and sync: dispatches OAuth and sync
- Instagram OAuth → Instagram API: exchanges tokens
backend/src/services/instagramOAuthService.ts - Instagram OAuth → PostgreSQL data: stores account
backend/src/services/instagramOAuthService.ts - YouTube OAuth and sync → YouTube API: fetches channel data
backend/src/services/youtubeOAuthService.ts - YouTube OAuth and sync → YouTube adapter: normalizes videos
backend/src/services/youtubeOAuthService.ts - YouTube OAuth and sync → PostgreSQL data: stores account and metrics
backend/src/services/youtubeOAuthService.ts - YouTube OAuth and sync → Token encryption: encrypts tokens
backend/src/services/youtubeOAuthService.ts - Instagram OAuth → Token encryption: encrypts token
backend/src/services/instagramOAuthService.ts - Instagram sync → PostgreSQL data: syncs metrics
- Analytics client → Analytics routes: requests analytics
- Analytics routes → Analytics service: dispatches analytics
- Analytics service → PostgreSQL data: reads metrics
- Posts view → Post routes: requests posts
- Post routes → Post service: dispatches posts
- Post service → PostgreSQL data: reads posts
- Overview → Analytics client: loads analytics
- Platform view → Analytics client: loads platform metrics
- Sample data seeding → PostgreSQL data: seeds sample data