How nitishsaini-44/synapsesync works
SynapseSync turns Gmail messages into categorized, summarized leads and presents them in a live dashboard. The documented main path is Pub/Sub webhook → queued Celery task → Gmail fetch and parallel email processing → AI classification → PostgreSQL persistence, with optional Discord notification and Socket.IO updates. The graph also preserves manual AI tools, account/OAuth and automation settings, lead management, and analytics. The README documents several pipeline links; source-index references and excerpts support others. Some unsampled route and frontend details are represented at their exact tree paths without asserting unshown internal calls.
Main entry points: app.py Flask application · automation_service.py Automation pipeline · db.py PostgreSQL data · App.jsx React application
Components 32
Ingestion and queue
- Flask application
backend/app.py - Gmail webhook
backend/routes/webhooks.py - Redis queue
- Celery task
backend/tasks.py
Email processing
- Automation pipeline
backend/services/automation_service.py - Gmail service
backend/services/gmail_service.py - Email cleaner
backend/utils/email_cleaner.py - AI engine
backend/services/ai_service.py - PostgreSQL data
backend/database/db.py - Discord notifications
backend/services/discord_service.py
Accounts and integrations
- Authentication
backend/routes/auth.py - Google OAuth
backend/routes/oauth.py - User settings
backend/routes/user.py - Token encryption
backend/utils/encryption.py
Backend capabilities
- Lead management
backend/routes/leads.py - Analytics API
backend/routes/analytics.py - Analytics service
backend/services/analytics_service.py - Manual AI tools
backend/routes/classify.py - Summarization API
backend/routes/summarize.py - Reply generation API
backend/routes/reply.py
Web application
- React application
frontend/src/App.jsx - Session context
frontend/src/components/AuthContext.jsx - HTTP API client
frontend/src/api/client.js - Dashboard
frontend/src/pages/Dashboard.jsx - Live updates
frontend/src/api/socket.js - Lead management UI
frontend/src/pages/LeadManagement.jsx - AI assistant UI
frontend/src/pages/AIAssistant.jsx - Integrations UI
frontend/src/pages/Integrations.jsx - Public landing pages
frontend/src/pages/Landing.jsx
Other components
- Mailbox owner
- Gmail and Pub/Sub
- Discord
Connections 48
- Gmail and Pub/Sub → Gmail webhook: pushes notifications
- Gmail webhook → PostgreSQL data: looks up user
backend/routes/webhooks.py - Gmail webhook → Redis queue: sets cooldown
backend/routes/webhooks.py - Gmail webhook → Celery task: dispatches task
backend/routes/webhooks.py - Celery task → Automation pipeline: runs processing
backend/tasks.py - Automation pipeline → PostgreSQL data: loads and saves leads
backend/services/automation_service.py - Automation pipeline → Gmail service: fetches messages
backend/services/automation_service.py - Automation pipeline → Email cleaner: cleans message
backend/services/automation_service.py - Automation pipeline → AI engine: classifies message
backend/services/automation_service.py - AI engine → Gmail and Pub/Sub: requests AI completion
backend/services/ai_service.py - Automation pipeline → Discord notifications: formats notification
backend/services/automation_service.py - Automation pipeline → Token encryption: decrypts webhook
backend/services/automation_service.py - Discord notifications → Discord: sends embed
- Google OAuth → Gmail service: exchanges OAuth
backend/routes/oauth.py - Google OAuth → Token encryption: protects token
backend/routes/oauth.py - Google OAuth → PostgreSQL data: stores account
backend/routes/oauth.py - User settings → PostgreSQL data: reads and updates settings
backend/routes/user.py - User settings → Gmail service: renews Gmail watch
backend/routes/user.py - User settings → Token encryption: handles credentials
backend/routes/user.py - Authentication → PostgreSQL data: uses user records
backend/routes/auth.py - Lead management → PostgreSQL data: reads leads
backend/routes/leads.py - Analytics API → Analytics service: gets analytics
backend/routes/analytics.py - Analytics service → PostgreSQL data: aggregates data
- Manual AI tools → AI engine: classifies text
backend/routes/classify.py - Manual AI tools → Email cleaner: cleans input
backend/routes/classify.py - Summarization API → AI engine: summarizes text
backend/routes/summarize.py - Summarization API → Email cleaner: cleans input
backend/routes/summarize.py - Reply generation API → AI engine: generates reply
backend/routes/reply.py - Flask application → Gmail webhook: registers routes
backend/app.py - Flask application → Authentication: registers routes
backend/app.py - Flask application → Google OAuth: registers routes
backend/app.py - Flask application → User settings: registers routes
backend/app.py - Flask application → Lead management: registers routes
backend/app.py - Flask application → Analytics API: registers routes
backend/app.py - Flask application → Manual AI tools: registers routes
backend/app.py - Flask application → Summarization API: registers routes
backend/app.py - Flask application → Reply generation API: registers routes
backend/app.py - React application → Session context: provides session
frontend/src/App.jsx - React application → Dashboard: routes to
frontend/src/App.jsx - React application → Lead management UI: routes to
frontend/src/App.jsx - React application → AI assistant UI: routes to
frontend/src/App.jsx - React application → Integrations UI: routes to
frontend/src/App.jsx - React application → Public landing pages: routes to
frontend/src/App.jsx - Session context → HTTP API client: sets auth header
frontend/src/components/AuthContext.jsx - Dashboard → HTTP API client: requests data
frontend/src/pages/Dashboard.jsx - Dashboard → Live updates: receives live events
frontend/src/pages/Dashboard.jsx - Dashboard → PostgreSQL data: shows persisted leads
- AI assistant UI → HTTP API client: calls AI tools
frontend/src/pages/AIAssistant.jsx