A comprehensive mobile application that combines real-time chat functionality with financial management features, built with React Native, Expo, and Node.js.
- Features
- Architecture Overview
- App Flow Diagrams
- Technology Stack
- Project Structure
- Setup Instructions
- API Documentation
- Real-time messaging with WebSocket support
- Group chats for expense sharing
- Direct messaging between users
- Three-dot menu with comprehensive options:
- Mute/unmute notifications
- Block/unblock users
- Archive/unarchive chats
- Clear chat history
- Report users
- Delete conversations
- Typing indicators and read receipts
- Message reactions and mentions
- Expense tracking with categories
- Split bill functionality within chats
- Budget management with alerts
- AI-powered insights and predictions
- Group expense sharing
- Payment tracking and settlement
- JWT-based authentication
- Biometric authentication support
- Secure API communication
- Data encryption and validation
- Modern UI with consistent theming
- Responsive design for all screen sizes
- Offline support with data synchronization
- Push notifications for important updates
The app follows a modern React Native architecture with:
- Frontend: React Native + Expo
- Backend: Node.js + Express.js
- Database: MongoDB
- Real-time: Socket.io
- State Management: Zustand
- Navigation: Expo Router
- Styling: StyleSheet with theming
flowchart TD
A[App Launch] --> B{Authentication Check}
B -->|Not Authenticated| C[Auth Screen]
B -->|Authenticated| D[Main Tab Navigation]
D --> F[Home Tab]
D --> G[Expenses Tab]
D --> H[Chats Tab]
D --> I[Budget Tab]
D --> J[Insights Tab]
D --> K[Profile Tab]
stateDiagram-v2
[*] --> AppLaunch
AppLaunch --> AuthenticationCheck: App starts
AuthenticationCheck --> AuthScreen: Not authenticated
AuthenticationCheck --> MainApp: Authenticated
AuthScreen --> LoginForm: Show login
AuthScreen --> RegisterForm: Show register
LoginForm --> Authenticating: Submit login
RegisterForm --> Authenticating: Submit register
Authenticating --> AuthScreen: Authentication failed
Authenticating --> MainApp: Authentication success
flowchart TD
A[Chats Tab] --> B[Group List]
A --> C[Direct Chat List]
A --> D[Create Group]
A --> E[Join Group]
B --> F[Group Chat Screen]
C --> G[Direct Chat Screen]
F --> H[Send Message]
F --> I[Three Dot Menu]
F --> J[Split Bill]
I --> K[Mute/Unmute]
I --> L[Block/Unblock]
I --> M[Archive/Unarchive]
I --> N[Clear Chat]
I --> O[Report]
I --> P[Delete]
flowchart TD
A[User Input] --> B[Components]
B --> C[Zustand Store]
C --> D[API Services]
D --> E[Backend Server]
E --> F[MongoDB]
E --> G[Socket.io]
G --> H[Real-time Updates]
H --> C
C --> I[AsyncStorage]
I --> J[Persistent Data]
- React Native 0.79.5 - Mobile framework
- Expo SDK 53 - Development platform
- TypeScript - Type safety
- Expo Router - Navigation
- Zustand - State management
- Axios - HTTP client
- Socket.io-client - Real-time communication
- Node.js - Runtime
- Express.js - Web framework
- MongoDB - Database
- Socket.io - Real-time communication
- JWT - Authentication
- Bcrypt - Password hashing
- ESLint - Code linting
- Prettier - Code formatting
- Expo CLI - Development server
react-native-chatbasedfinanceapp/
βββ app/ # Main application code
β βββ _layout.tsx # Root layout
β βββ auth.tsx # Authentication screen
β βββ (tabs)/ # Tab navigation
β β βββ _layout.tsx # Tab layout
β β βββ index.tsx # Home tab
β β βββ expenses.tsx # Expenses tab
β β βββ chats.tsx # Chats tab
β β βββ budget.tsx # Budget tab
β β βββ insights.tsx # Insights tab
β β βββ profile.tsx # Profile tab
β βββ chat/ # Chat screens
β β βββ [userId].tsx # Direct chat
β βββ group-chat/ # Group chat screens
β β βββ [groupId].tsx # Group chat
β βββ components/ # Reusable components
β βββ services/ # API services
β βββ types/ # TypeScript types
β βββ utils/ # Utility functions
βββ backend/ # Backend server
β βββ server.js # Main server file
β βββ models/ # Database models
β βββ routes/ # API routes
β βββ middleware/ # Express middleware
βββ assets/ # Static assets
βββ lib/ # Shared libraries
βββ store/ # Zustand stores
βββ services/ # Shared services
- Node.js 18+
- npm or yarn
- MongoDB
- Expo CLI
- Android Studio (for Android development)
git clone <repository-url>
cd react-native-chatbasedfinanceapp
# Install frontend dependencies
npm install
# Install backend dependencies
cd backend
npm install
cd ..Create .env file in the root directory:
# OpenAI API Key (optional)
EXPO_PUBLIC_OPENAI_API_KEY=your_openai_api_key_here
# Backend API URL
EXPO_PUBLIC_API_URL=http://10.136.43.172:3001/api
# Frontend URL for CORS
EXPO_PUBLIC_FRONTEND_URL=exp://10.136.43.172:8081Create .env file in the backend directory:
MONGODB_URI=mongodb://localhost:27017/chatbasedfinance
JWT_SECRET=your_super_secret_jwt_key_here
FRONTEND_URL=exp://10.136.43.172:8081
NODE_ENV=development
PORT=3001# Make sure MongoDB is running on localhost:27017
mongodcd backend
npm run dev# In the main directory
npm run dev- Android: Press
ain the terminal - iOS: Press
iin the terminal - Web: Press
win the terminal
POST /api/auth/register
POST /api/auth/login
POST /api/auth/logout
GET /api/auth/me
PUT /api/auth/profileGET /api/expenses
POST /api/expenses
PUT /api/expenses/:id
DELETE /api/expenses/:id
GET /api/expenses/statsGET /api/groups
POST /api/groups
GET /api/groups/:id
POST /api/groups/:id/members
POST /api/groups/join/:code
POST /api/groups/:id/invite-codeGET /api/chat/:groupId/messages
POST /api/chat/:groupId/messages
PUT /api/chat/:groupId/messages/read
POST /api/chat/:groupId/messages/:id/reactionsGET /api/budgets
POST /api/budgets
DELETE /api/budgets/:id
GET /api/budgets/alertsThe app uses a modular component architecture:
- Pages: Route-based components
- Components: Reusable UI components
- Services: API communication layer
- Store: Centralized state management
- Utils: Helper functions and utilities
- WebSocket connection using Socket.io
- Message persistence in MongoDB
- Typing indicators and read receipts
- Group and direct messaging
- CRUD operations for expenses
- Category-based organization
- Split bill functionality
- Budget tracking with alerts
- OpenAI API integration
- Spending pattern analysis
- Budget recommendations
- Predictive insights
# Run tests
npm test
# Run linting
npm run lint
# Type checking
npx tsc --noEmitnpm run dev# Android APK
npx expo run:android --variant release
# iOS
npx expo run:ios --configuration Release# Build for app stores
npx expo build:android
npx expo build:ios- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.
This project is based on the original work by roohithbala. Special thanks to the original author for providing the foundation for this application.
If you encounter InternalBytecode.js errors or Metro cache issues:
# Option 1: Use the cache clearing script
.\fix-metro-cache.bat
# Option 2: Manual cache clearing
npx expo start --clear
# Option 3: Complete reset
rmdir /s /q node_modules
rmdir /s /q .expo
npm install
npx expo start --clearIf group settings updates fail with "Invalid settings data":
- Check backend logs for detailed validation errors
- Verify data types - ensure boolean fields are actually booleans
- Check enum values - currency and splitMethod must be valid options
- Restart backend server if validation logic was updated
- "Server error" on split bill creation: Check backend logs for validation failures
- Metro bundler hangs: Clear cache and restart development server
- Authentication issues: Verify JWT token and backend connectivity
- Real-time updates not working: Check Socket.io connection and server logs
- Use
console.logextensively in development to debug API calls - Check browser Network tab for API request/response details
- Use React Native Debugger for component inspection
- Clear all caches when switching between development environments