Skip to content

adzaa/ExpoChat

Repository files navigation

Simple Expo Chat App

This is a React Native Expo project using Firebase Authentication and Realtime Database to provide a simple chat functionality. Any user who registers in the app can chat with other registered users in real time.


Features

  • User registration and login with Firebase Auth
  • Real-time messaging using Firebase Realtime Database
  • List of registered users
  • Simple chat interface with messages sorted by timestamp
  • Logout functionality

Setup

  1. Clone the repository and install dependencies:
npm install
  1. Create Firebase Configuration:

Create a firebaseConfig.ts file in the root of the project and paste your Firebase config object:

import { initializeApp } from "firebase/app";
import { getDatabase } from "firebase/database";
import { getReactNativePersistence, initializeAuth } from "firebase/auth";
import ReactNativeAsyncStorage from "@react-native-async-storage/async-storage";

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",
  databaseURL: "REALTIME_DB_URL",
};

export const app = initializeApp(firebaseConfig);

export const auth = initializeAuth(app, {
  persistence: getReactNativePersistence(ReactNativeAsyncStorage),
});

export const db = getDatabase(app);
  1. Start the app:
npx expo start
  1. Open in Expo Go, Android emulator, or iOS simulator

  2. Edit files inside the app/ directory


Usage

  1. Register a new user or log in
  2. Select a user from the horizontal user list to start a chat
  3. Messages are sent and received in real-time
  4. Logout using the button in the header
  5. Messages are sorted by timestamp automatically

Reset Project

If you want a fresh project setup:

npm run reset-project

This moves the starter code to app-example and creates a blank app/ directory for development.


Project Structure

  • app/ – Main app directory with screens and routing
  • providers/ – React context providers for Auth and Chat
  • components/ – Reusable UI components
  • firebaseConfig.ts – Firebase setup file

Learn More


Community


Created By

[Abdulah Dzankic]
🌐 Website

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published