https://github.com/priyansh7999/chat-application-react-native
A modern, real-time chat application built with React Native and Firebase, featuring seamless communication and social connectivity.
https://github.com/priyansh7999/chat-application-react-native
chat-application expo firebase react-native
Last synced: 3 months ago
JSON representation
A modern, real-time chat application built with React Native and Firebase, featuring seamless communication and social connectivity.
- Host: GitHub
- URL: https://github.com/priyansh7999/chat-application-react-native
- Owner: Priyansh7999
- Created: 2025-06-17T04:36:08.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-26T06:43:21.000Z (about 1 year ago)
- Last Synced: 2025-06-26T07:32:29.339Z (about 1 year ago)
- Topics: chat-application, expo, firebase, react-native
- Language: JavaScript
- Homepage:
- Size: 3.61 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Chatter ๐ฌ
A modern, real-time chat application built with React Native and Firebase, featuring seamless communication and social connectivity.
## ๐ Features
### Core Functionality
- **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
### Advanced Features
- **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
### Security & Privacy
- 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
## ๐ ๏ธ Tech Stack
- **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
## ๐ฑ Screenshots
## ๐ง Installation & Setup
### Prerequisites
- Node.js (v14 or higher)
- npm or yarn
- Expo CLI (`npm install -g @expo/cli`)
- Firebase project setup
### Installation Steps
1. **Clone the repository**
```bash
git clone https://github.com/Priyansh7999/Chat-Application-React-Native.git
cd Chat-Application-React-Native
```
2. **Install dependencies**
```bash
npm install
# or
yarn install
```
3. **Firebase Configuration**
- Create a Firebase project at [Firebase Console](https://console.firebase.google.com/)
- Enable Authentication (Email/Password provider)
- Enable Firestore Database
- Create a `firebaseConfig.js` file in your project root:
```javascript
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);
```
4. **Start the development server**
```bash
npx expo start
```
5. **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
## ๐ Firebase Setup
### Firestore Database Structure
```
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)
```
### Security Rules
```javascript
// 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;
}
}
}
```
## ๐๏ธ Project Structure
```
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
```
## ๐ฏ Usage
### Getting Started
1. **Register**: Sign up using your email and password
2. **Verify Email**: Check your email and click the verification link
3. **Complete Profile**: Set your unique username, bio, and location details
4. **Explore Users**: Use the explore tab to search for other users by username
5. **Send Friend Requests**: Send invites to connect with other users
6. **Start Chatting**: Begin real-time conversations with accepted friends
7. **Share Stories**: Post images as stories visible to friends for 24 hours
8. **View Stories**: Browse through friends' stories and like them
### Key Features Usage
- **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
### Core Functionality Flow
**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
## ๐ App Flow
1. **Authentication Flow**
- Email/Password registration โ Email verification โ Profile completion (username, bio, location)
2. **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
3. **Social Interaction Flow**
- Search users โ View profile โ Send invite โ Accept/Decline โ Start chatting
- Post story โ Friends view stories โ Like stories โ Auto-expire after 24h
4. **Chat Features**
- Real-time messaging with read receipts
- Message timestamps and delivery status
- Sorted chat previews by latest activity
## ๐งช Testing
```bash
# Run tests
npm test
# Run with coverage
npm run test:coverage
```
## ๐ฆ Building for Production
### Android (APK/AAB)
```bash
# Build APK
npx eas build --platform android --profile production --local
# Build AAB for Play Store
npx eas build --platform android --profile production
```
### iOS (IPA)
```bash
# Build for App Store
npx eas build --platform ios --profile production
# Build for TestFlight
npx eas build --platform ios --profile preview
```
### Web
```bash
# Build for web deployment
npx expo export --platform web
```
**Note**: You'll need to set up EAS (Expo Application Services) for production builds. Run `npx eas build:configure` to set up build profiles.
## ๐ค Contributing
1. Fork the repository
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request
## ๐ License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## ๐ฅ Authors
- **Priyansh Saxena** - *Initial work* - [Priyansh7999](https://github.com/Priyansh7999)
## ๐ Acknowledgments
- Firebase for backend services
- Expo team for the amazing development platform
- React Native community for continuous support
## ๐ Support
If you have any questions or run into issues, please open an issue on GitHub or contact [priyanshsaxena7999@gmail.com](mailto:priyanshsaxena7999@gmail.com).
โญ **Star this repo if you find it helpful!**
*Built with โค๏ธ by Priyansh Saxena using React Native Expo and Firebase*