A sophisticated AI companion with real-time streaming, long-term memory, personality modes, and a premium glassmorphic UI. Built with React, Node.js, Prisma/PostgreSQL, and advanced AI features.
- Server-Sent Events (SSE) for token-by-token streaming
- < 500ms first token latency
- Optimistic UI updates with smooth animations
- Graceful error handling and reconnection
- Pinecone vector database for memory storage
- OpenAI embeddings (1536-dim vectors)
- Automatic memory storage for every message
- Top-3 relevant memories retrieved per query
- Contextual AI responses that remember past conversations
- π Deep & Reflective: Introspective, philosophical
- π€ Supportive Friend: Warm, encouraging, validating
- β¨ Creative & Poetic: Metaphorical, artistic
- Persistent personality preferences per user
- Automatic sentiment analysis of every message
- Emotional Resonance Map - GitHub-style heatmap of your emotional journey
- Mood Calendar - Weekly view with color-coded daily moods
- Mood Distribution - Visual breakdown of emotional patterns
- Trend graphs showing emotional patterns over time
- Profile Settings: Customizable display name and settings
- Sidebar Integration: Quick access to profile, mood, and settings
- Persistent Stats: View your journey statistics
- Living Organism Design - Aurora backgrounds with breathing animations
- Dark/Light Mode with seamless transitions
- Glassmorphism design with backdrop blur
- Google Fonts (Playfair Display, Inter)
- Smooth 60fps animations with Framer Motion
- Interactive Personality Selector Modal
- Create, rename, and delete conversations
- Inline editing for chat titles
- Message feedback (thumbs up/down)
- Training data export for fine-tuning
- React 18 with Hooks & Context
- Tailwind CSS for styling
- Framer Motion for animations
- Recharts for data visualization
- Lucide React for icons
- date-fns for date manipulation
- Node.js with Express
- Prisma ORM with PostgreSQL (Neon)
- JWT authentication
- Server-Sent Events (SSE) for streaming
- Sentiment library for mood analysis
- Groq API for LLM responses (Llama 3.3 70B)
- OpenAI API for embeddings
- Pinecone for vector storage
- RAG architecture for memory
- Node.js 18+
- PostgreSQL database (Neon recommended)
- Groq API key
- OpenAI API key (for embeddings)
- Pinecone account (free tier)
- Clone the repository
git clone https://github.com/Aryan-B-Parikh/SoulSync.git
cd SoulSync- Install dependencies
# Install all dependencies (root, backend, frontend)
npm install
cd backend && npm install
cd ../frontend && npm install
cd ..- Set up environment variables
Create backend/.env:
# Database (PostgreSQL via Neon)
DATABASE_URL=postgresql://user:password@host/database?sslmode=require
# AI Services
GROQ_API_KEY=your_groq_api_key
OPENAI_API_KEY=your_openai_api_key
EMBEDDING_MODEL=text-embedding-3-small
# Vector Database (Pinecone)
PINECONE_API_KEY=your_pinecone_api_key
PINECONE_INDEX_NAME=soulsync-memories
# Authentication
JWT_SECRET=your_super_secret_jwt_key_min_32_chars
# Server
NODE_ENV=development
PORT=5001Create frontend/.env:
REACT_APP_API_URL=/api- Set up Database
cd backend
npx prisma generate
npx prisma db push- Set up Pinecone
- Sign up at pinecone.io
- Create an index:
- Name:
soulsync-memories - Dimension:
1536 - Metric:
cosine
- Name:
- Run the application
# From root directory
npm run devThe app will be available at:
- Frontend:
http://localhost:5173 - Backend:
http://localhost:5001
POST /api/auth/register- Register new userPOST /api/auth/login- Login userGET /api/auth/me- Get current user
GET /api/chats- Get all chatsPOST /api/chats- Create new chatGET /api/chats/:id- Get chat with messagesPATCH /api/chats/:id- Rename chatDELETE /api/chats/:id- Delete chatPOST /api/chats/:id/messages/stream- Stream AI response (SSE)
GET /api/memory/stats- Get memory statisticsGET /api/memory/search?query=...- Search memoriesGET /api/memory/recent- Get recent memoriesDELETE /api/memory/all- Delete all memories (privacy)
GET /api/mood/summary- Get mood analyticsGET /api/mood/history- Get mood historyGET /api/mood/calendar/:year/:month- Get calendar mood dataGET /api/mood/heatmap- Get heatmap data
GET /api/user/personality- Get personality preferencePUT /api/user/personality- Update personalityGET /api/user/profile- Get user profilePUT /api/user/profile- Update profile
SoulSync/
βββ frontend/ # React frontend
β βββ src/
β β βββ components/ # UI components
β β β βββ chat/ # Chat components
β β β βββ mood/ # Mood dashboard components
β β β βββ ...
β β βββ context/ # React context (Auth, Chat, Theme)
β β βββ pages/ # Page components
β β βββ config/ # Configuration
β βββ package.json
βββ backend/ # Express backend
β βββ config/ # Database & app config
β βββ controllers/ # Request handlers
β βββ middleware/ # Express middleware
β βββ routes/ # API routes
β βββ services/ # Business logic
β β βββ sentiment/ # Sentiment analysis
β βββ ml/ # Machine Learning
β β βββ models/ # Trained ML models
β β βββ training/ # Training datasets
β β βββ scripts/ # Training scripts
β βββ prisma/ # Database schema
β β βββ schema.prisma
β βββ tests/ # Tests
β β βββ unit/ # Unit tests
β β βββ integration/ # Integration tests
β βββ docs/ # Backend documentation
βββ tests/ # Integration tests
βββ docs/ # Project documentation
βββ package.json # Root package.json
Frontend (React)
β
ChatPage β sendStreamingMessage()
β
Backend (Express)
β
streaming.controller.js
β
1. Save user message to PostgreSQL (Prisma)
2. Analyze sentiment
3. Generate embedding β OpenAI
4. Store in Pinecone (vectorService.js)
5. Retrieve top-3 memories (cosine similarity)
6. Inject memories into system prompt
7. Stream AI response (Groq API)
8. Save assistant message
β
Frontend receives SSE stream
β
MessageBubble displays with animations
- Groq: Free tier with rate limits
- OpenAI Embeddings: ~$0.10 per 1M tokens
- Pinecone: 100,000 vectors (~200 users)
- Neon PostgreSQL: Free tier (500MB storage)
- 10 users, 100 messages each: ~$0.05/month
- 100 users, 500 messages each: ~$2/month
# Unit tests
cd backend
node tests/unit/sentiment.test.js
# Data pipeline audit (check training data health)
npm run audit-data
# Security isolation test (cross-tenant memory leak check)
npm run test:security
# RAG stress test (memory poisoning resistance)
npm run test:rag
# Load test (Vercel timeout simulation)
npm run load-test
β οΈ Live tests (test:security,test:rag,load-test) require the backend running:npm run backend:dev
After chatting and rating messages, run:
node scripts/audit-training-data.jsSuccess criteria:
Total messages> 0Missing context_used= 0Upvoted (rating=1)> 0
- Send message, verify streaming works
- Change personality mode, verify AI tone changes
- Test memory recall ("My favorite color is purple" β ask later)
- Verify mood dashboard updates with new messages
- Test dark/light mode toggle
- Test chat rename and delete
- Click π on a message β verify
rating=1in DB via audit script
β
Production RAG System - Real vector database with Pinecone
β
Streaming Architecture - SSE with async generators
β
PostgreSQL + Prisma - Modern ORM with type safety
β
Sentiment Analysis - 93.3% accuracy + LLM hybrid second opinion
β
Premium UI - Living organism design with aurora effects
β
Dark Mode - Full theme system with smooth transitions
β
Full-Stack Implementation - Backend + Frontend + Database
β
Privacy-First Design - User isolation, PII scrubbing, secure memory management
β
Data Flywheel - Self-improving architecture: logs β filter β fine-tune
Privacy-First Design β SoulSync is built with user privacy as a core principle.
- User Isolation: All memories and conversations are strictly scoped to your account. No user can access another user's data.
- No Third-Party Tracking: SoulSync does not use analytics trackers or sell user data.
- Data Deletion: Users can delete all their memories and conversations at any time via the app.
- AI Model Improvement: Anonymized conversation data may be used to improve the quality of SoulSync's AI models. Before any processing, all personal identifiers (email addresses, phone numbers, URLs) are automatically scrubbed and replaced with placeholder tokens. Raw conversation data is never shared with third parties for this purpose.
- Feedback is Optional: Thumbs up/down ratings are entirely optional and only used to identify high-quality training examples.
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - feel free to use this project for learning or portfolio purposes.
- Groq for fast LLM inference
- OpenAI for embeddings API
- Pinecone for vector database
- Neon for serverless PostgreSQL
- Framer Motion for animations
Aryan B Parikh
- GitHub: @Aryan-B-Parikh
- Project: SoulSync
Built with React, Node.js, PostgreSQL, Prisma, Groq, OpenAI, and Pinecone