You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A comprehensive, full-stack web application designed for group expense management, automated bill parsing, and seamless balance settlement. Built with modern web technologies including Next.js, MongoDB, Recharts, and Tailwind CSS.
🚀 Features
User Authentication: Secure signup/login with BCrypt and JWT. Supports password recovery workflows via Nodemailer.
Group Management: Users can create discrete groups (via unique invite codes) to cleanly manage expenses per household, trip, or event.
Automated Bill Parsing: Upload receipts via ImageKit, which are tracked from "processing" to "completed" states. Line items are automatically converted for expense tracking.
Flexible Expense Splitting: Add transactions with different splitting algorithms (Equal, Exact Amounts, Percentages, or Shares).
Dashboard & Analytics: Visualize expenses with recharts for an interactive, holistic view of your spending, including group-specific treemaps and overviews.
Settlements: Easily settle balances between individuals in a specific group.
💬 AI Expense Assistant (Chatbot): A floating AI chatbot built into the dashboard — context-aware, persistent, and hardened against edge cases.
app/
├── (auth)/ # Login/Signup pages
├── api/
│ ├── chat/
│ │ ├── route.ts # Chat API (auth, domain guard, AI routing)
│ │ └── history/
│ │ └── route.ts # Chat history API (MongoDB persistence)
│ ├── getMyGroups/ # Group listing API
│ ├── getGroupDetails/ # Group details API
│ └── ... # Other API routes
├── dashboard/
│ ├── layout.tsx # Shared layout (Sidebar + Topbar + ChatBot)
│ ├── page.tsx # Main dashboard
│ ├── groups/
│ │ ├── page.tsx # Groups listing
│ │ └── [groupId]/
│ │ └── page.tsx # Group details
│ └── analytics/
│ └── page.tsx # Analytics & charts
├── layout.tsx # Root layout (fonts, theme, ambient glows)
└── page.tsx # Landing page
components/
├── chat/
│ └── ChatBot.tsx # Floating AI chat assistant
├── Sidebar.tsx # Navigation sidebar
├── Topbar.tsx # Top bar with user info
├── dashboard/ # Dashboard-specific components
├── groups/ # Group management components
└── landing/ # Landing page components
lib/
└── ai/
├── domainGuard.ts # Filters off-topic questions
├── projectContext.ts # System prompt with app documentation
├── liveDataContext.ts # Fetches real user/group data for context
├── modelRouter.ts # Multi-model AI routing with fallback
├── groq.ts # Groq API client
├── fallbackResponder.ts # Local keyword-based fallback answers
└── contextManager.ts # Context trimming utilities
models/
├── chatHistorySchema.ts # Chat history MongoDB schema
├── User.ts # User model
├── Group.ts # Group model
└── ... # Other schemas
💬 AI Expense Assistant
The Expense Assistant is a floating chatbot widget rendered inside the dashboard layout. It helps users understand and navigate Splitora's features — groups, expenses, bills, balances, settlements, analytics, and more.
Key Capabilities
Feature
Description
Context-aware
Detects current page (Dashboard/Groups/Analytics) and sends route context to AI
Multi-session
Create, switch, search, and delete named chat sessions
Persistent
Hybrid: localStorage for instant access + MongoDB for cross-session durability
Math & Finance
Handles expense calculations, bill splitting, and balance queries
Resizable
Drag-to-resize from left edge, top edge, or corner (desktop only)
Mobile-responsive
Compact bottom-sheet layout (~65% screen) on < 640px screens; fullsize floating panel on desktop
Theme-aware
Automatically adapts to light/dark mode via Tailwind light: variant classes
Click-outside-to-close
Backdrop overlay dismisses chatbot when clicking outside on both mobile and desktop
Offline-aware
Gracefully handles network disconnections
Architecture
User Message → JWT Auth → Domain Guard → Live Data Context → AI Model Router → Response
↓
Groq (LLaMA 3.3 70B)
↓ fallback
Groq (LLaMA 3.1 8B)
↓ fallback
Local Keyword Matcher
Keyboard Shortcuts
Shortcut
Action
Ctrl + Shift + K
Toggle chatbot
Escape
Close dialog / history / panel
Enter
Send message
Shift + Enter
New line
Configuration
Variable
Description
GROQ_API_KEY
Groq API key (required)
GROQ_MODEL_PRIORITY
Model priority list (default: llama-3.3-70b-versatile,llama-3.1-8b-instant,deepseek-r1-distill-llama-70b)
MONGODB_URI
MongoDB connection (required for chat history)
JWT_SECRET
JWT signing secret (required for auth)
Edge Case Handling
XSS: Full HTML entity escaping before rendering
Timeouts: 30s abort via AbortController
Offline: Visual indicator + disabled input
Corrupted storage: Validation with graceful fallback
Storage quota: Auto-trim to 5 sessions × 20 messages
All AI models fail: Local keyword-based fallback responses
Light mode text selection: Custom ::selection override prevents white-on-white
Verified Test Results
Test Case
Status
Details
Login & Dashboard
✅ Pass
Chatbot FAB visible, no interference with auth flow
Desktop Open/Close
✅ Pass
Floating panel opens; click-outside-to-close works
Chat AI Response
✅ Pass
Sent "How do I add a bill?" → received relevant AI response
Mobile Bottom-Sheet
✅ Pass
Compact bottom-sheet at ~65% viewport height, not fullscreen
Theme Toggle
✅ Pass
Chatbot colors adapt to light/dark mode
Navigation Persistence
✅ Pass
Chat history persists across Dashboard → Groups → Analytics
Light Mode Contrast
✅ Pass
Text readable, selection visible, quick prompts legible
Dark Mode Readability
✅ Pass
Text/icons bright enough for comfortable reading
No Console Errors
✅ Pass
No hydration, syntax, or runtime errors
Files Changed for Chatbot Integration (from main branch)
Added suppressHydrationWarning on <html> and <body>
app/globals.css
MODIFIED
Added chatbot markdown/animation styles with light mode overrides
Note: All modifications to existing files are additive — no existing functionality was removed or broken. The Sidebar/Topbar were moved to the shared layout to enable chatbot persistence across pages.
Built with Next.js 16, React 19, TypeScript, Tailwind CSS 4, Mongoose 8, Framer Motion, and Groq AI.