A modern, real-time chat application built with React Native and Firebase, featuring seamless communication and social connectivity.
- Real-time Messaging: Instant messaging with live updates using Firebase Firestore
- Email Authentication: Secure user registration and login with email/password
- Email Verification: First-time users must verify their email before accessing the app
- Unique Username System: Each user gets a unique username for easy discovery
- User Discovery: Search and find other users by their unique username in explore tab
- Friend Invitations: Send and receive friend requests for one-on-one communication
- Stories Feature: Share 24-hour temporary image stories visible to your friends
- Profile Management: Comprehensive user profiles with bio, location, and profile images
- Read Receipts: Track message delivery and read status
- Real-time Chat Previews: Live updates of latest messages and timestamps
- Typing Indicators: See when friends are typing
- Online Status: Track user's last seen and online presence
- Story Interactions: Like friends' stories
- Profile Customization: Update bio, location (city/state), and profile pictures
- Friend Management: Organized friend lists and invitation system
- Secure authentication with Firebase Auth
- Email verification for enhanced security
- Private messaging between connected users only
- Controlled friend connections through invitation system
- User blocking functionality
- Data validation and error handling
- Frontend: React Native with Expo Router
- Backend: Firebase
- Database: Cloud Firestore (NoSQL)
- Authentication: Firebase Auth (Email/Password)
- Real-time Updates: Firestore real-time listeners
- Development: Expo CLI
- State Management: React Context API (AuthContext)
- Navigation: Expo Router with tab-based navigation
- Node.js (v14 or higher)
- npm or yarn
- Expo CLI (
npm install -g @expo/cli) - Firebase project setup
-
Clone the repository
git clone https://github.com/Priyansh7999/Chat-Application-React-Native.git cd Chat-Application-React-Native -
Install dependencies
npm install # or yarn install -
Firebase Configuration
- Create a Firebase project at Firebase Console
- Enable Authentication (Email/Password provider)
- Enable Firestore Database
- Create a
firebaseConfig.jsfile in your project root:
import { initializeApp } from 'firebase/app'; import { getAuth } from 'firebase/auth'; import { getFirestore } from 'firebase/firestore'; const firebaseConfig = { apiKey: "your-api-key", authDomain: "your-auth-domain", projectId: "your-project-id", storageBucket: "your-storage-bucket", messagingSenderId: "your-messaging-sender-id", appId: "your-app-id" }; const app = initializeApp(firebaseConfig); export const auth = getAuth(app); export const db = getFirestore(app);
-
Start the development server
npx expo start
-
Run on device/simulator
- Install Expo Go app on your mobile device
- Scan the QR code from the terminal
- Or press 'i' for iOS simulator, 'a' for Android emulator
users/
βββ {userId}/
β βββ uid: string
β βββ email: string
β βββ name: string
β βββ username: string (unique)
β βββ phone: string
β βββ bio: string
β βββ location: object
β β βββ city: string
β β βββ state: string
β βββ profileImage: string (URL)
β βββ emailVerified: boolean
β βββ createdAt: string (ISO)
β βββ lastSeen: string (ISO)
β βββ isOnline: boolean
β βββ friends: array
β βββ invitesSend: array
β βββ invitesReceived: array
β βββ blockedUsers: array
chats/
βββ {chatId}/
β βββ participants: array [userId1, userId2]
β βββ createdAt: timestamp
β βββ lastMessage: object
β β βββ text: string
β β βββ senderId: string
β β βββ createdAt: timestamp
β β βββ imageUrl: string (optional)
β β βββ readBy: array
β βββ lastUpdated: timestamp
β βββ messagesCount: number
β βββ typingStatus: object
β βββ {userId1}: boolean
β βββ {userId2}: boolean
chats/{chatId}/messages/
βββ {messageId}/
β βββ senderId: string
β βββ text: string
β βββ imageUrl: string (optional)
β βββ createdAt: timestamp
β βββ readBy: array
stories/
βββ {storyId}/
β βββ userId: string
β βββ username: string
β βββ image: string (base64 or URL)
β βββ profileImage: string
β βββ createdAt: timestamp
β βββ expireAt: date (24 hours from creation)
β βββ likes: array (optional)
// Firestore Security Rules
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Users can read/write their own data and read others' basic info
match /users/{userId} {
allow read: if request.auth != null;
allow write: if request.auth != null && request.auth.uid == userId;
}
// Chat documents readable by participants
match /chats/{chatId} {
allow read, write: if request.auth != null &&
request.auth.uid in resource.data.participants;
}
// Messages readable by chat participants
match /chats/{chatId}/messages/{messageId} {
allow read, write: if request.auth != null;
}
// Stories readable by authenticated users (friends only logic in app)
match /stories/{storyId} {
allow read: if request.auth != null;
allow write: if request.auth != null &&
request.auth.uid == resource.data.userId;
}
}
}chatter/
βββ app/
β βββ (tabs)/ # HOME SCREENS TAB NAVIGATION
β β βββ Chats.jsx # Chat previews screen
β β βββ explore.jsx # User search & discovery
β β βββ profile.jsx # User profile management
β βββ (others)/ # SCREENS for chat between users and profile of other users
β β βββ friendprofile.jsx # Friend's profile view
β β βββ notfriendprofile.jsx # Non-friend user profile
β β βββ ChatsBetweenFriends.jsx # One-to-one chat screen
β βββ _layout.jsx # App layout configuration
β βββ layout.jsx # Main app layout
β βββ index.jsx # Onboarding screen
β βββ signup.jsx # User registration
β βββ signin.jsx # User login
βββ components/
β βββ [Reusable UI Components]
βββ context/
β βββ AuthContext.jsx # Authentication & Firebase logic
βββ assets/
βββ firebaseConfig.js
βββ app.json
βββ package.json
- Register: Sign up using your email and password
- Verify Email: Check your email and click the verification link
- Complete Profile: Set your unique username, bio, and location details
- Explore Users: Use the explore tab to search for other users by username
- Send Friend Requests: Send invites to connect with other users
- Start Chatting: Begin real-time conversations with accepted friends
- Share Stories: Post images as stories visible to friends for 24 hours
- View Stories: Browse through friends' stories and like them
- Real-time Chat: Messages appear instantly with read receipts
- User Search: Find users by their unique username in the explore tab
- Friend Management: Manage friend requests through invites system
- Story Sharing: Share moments that automatically expire after 24 hours
- Profile Customization: Update bio, location, and profile image
- Online Status: See when friends were last active
Authentication Flow:
- Email/Password registration β Email verification β Profile setup β Username selection
Chat Flow:
- Chat previews list β Select friend β Real-time messaging β Read receipts
Social Flow:
- Explore users β Send friend request β Accept invite β Start communication
Stories Flow:
- Capture/Select image β Post story β View friends' stories β Like stories
-
Authentication Flow
- Email/Password registration β Email verification β Profile completion (username, bio, location)
-
Main App Navigation
- Chats Tab: View chat previews β Select conversation β Real-time messaging
- Explore Tab: Search users by username β View profiles β Send friend requests
- Profile Tab: Manage personal profile β Update details β View/manage stories
-
Social Interaction Flow
- Search users β View profile β Send invite β Accept/Decline β Start chatting
- Post story β Friends view stories β Like stories β Auto-expire after 24h
-
Chat Features
- Real-time messaging with read receipts
- Message timestamps and delivery status
- Sorted chat previews by latest activity
# Run tests
npm test
# Run with coverage
npm run test:coverage# Build APK
npx eas build --platform android --profile production --local
# Build AAB for Play Store
npx eas build --platform android --profile production# Build for App Store
npx eas build --platform ios --profile production
# Build for TestFlight
npx eas build --platform ios --profile preview# Build for web deployment
npx expo export --platform webNote: You'll need to set up EAS (Expo Application Services) for production builds. Run npx eas build:configure to set up build profiles.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Priyansh Saxena - Initial work - Priyansh7999
- Firebase for backend services
- Expo team for the amazing development platform
- React Native community for continuous support
If you have any questions or run into issues, please open an issue on GitHub or contact priyanshsaxena7999@gmail.com.
β Star this repo if you find it helpful!
Built with β€οΈ by Priyansh Saxena using React Native Expo and Firebase