01 AUG 2024 / #Full Stack Project
The KrafChat App is a feature-rich chat application built with modern web technologies, providing users with a seamless and interactive platform for communication. It is designed to be highly responsive, ensuring a consistent user experience across various devices. This documentation will cover every aspect of the project, from setup to deployment, and provide a deep dive into the core components of the application.
KrafChat App is a full-featured chat application that allows users to engage in real-time conversations, share media, and manage their privacy settings. Built using React for the front-end, Zustand for state management, and Firebase for backend services, the application is both powerful and scalable. The app includes functionality for user authentication, real-time messaging, media uploads, and user blocking, making it suitable for a wide range of use cases.
The project is organized into several key directories and files:
KrafChat-App/
│
├── public/ # Public assets
│ ├── avatar.png # Default avatar image
│ ├── [other static files] # Other static assets (icons, images, etc.)
│
├── src/ # Source code
│ ├── components/ # React components
│ │ ├── chat/ # Chat-related components
│ │ ├── detail/ # User detail and settings components
│ │ ├── list/ # Components for user and chat lists
│ │ └── login/ # Login component
│ │
│ ├── lib/ # Utility libraries and hooks
│ │ ├── chatStore.js # Zustand store for chat state
│ │ ├── firebase.js # Firebase configuration and initialization
│ │ ├── upload.js # Helper function for uploading files
│ │ └── userStore.js # Zustand store for user state
│ │
│ ├── index.css # Global styles
│ ├── main.jsx # Entry point for the React application
│ └── vite.config.js # Vite configuration file
│
├── .env # Environment variables (not committed to Git)
├── .eslintrc.cjs # ESLint configuration for code quality
├── .gitignore # Git ignore file
├── package.json # Project dependencies and scripts
└── README.md # Project documentation
To set up the project locally, follow these steps:
1. Clone the repository:
git clone https://github.com/imtushaarr/KrafChat-App.git &
cd KrafChat-App
command.
2. Install dependencies:
npm install
command.
3. Set up Firebase:
4. Start the development server:
npm run dev
command.
5. The app should now be running on http://localhost:3000.
User authentication is handled by Firebase Authentication. Users can sign up, log in, and manage their session. The Login component handles the UI for these processes, while the Firebase API manages the backend logic.
The core of the application is the chat functionality. Users can start conversations, send text messages, and view chat history. The chat data is stored in Firestore, and the UI is updated in real-time using Firebase’s snapshot listeners.
Users have the ability to block or unblock other users. This is managed via Zustand for state management and Firestore for persistence. The Detail component handles the user interface for blocking and other settings.
The Firebase configuration is essential for connecting your app to Firebase services. This includes setting up Firestore for the database, enabling Firebase Authentication for user management, and configuring Firebase Storage for media uploads.
VITE_FIREBASE_API_KEY=your_api_key
VITE_FIREBASE_AUTH_DOMAIN=your_auth_domain
VITE_FIREBASE_PROJECT_ID=your_project_id
VITE_FIREBASE_STORAGE_BUCKET=your_storage_bucket
VITE_FIREBASE_MESSAGING_SENDER_ID=your_messaging_sender_id
VITE_FIREBASE_APP_ID=your_app_id
Make sure to replace the placeholders with your actual Firebase project details.
Zustand is used for managing the global state of the application, including user data and chat states. It provides a simple and lightweight alternative to more complex state management libraries like Redux.
import { create } from 'zustand';
export const useChatStore = create((set) => ({
chatId: null,
user: null,
isCurrentUserBlocked: false,
isReceiverBlocked: false,
// other state and actions...
}));
This store handles the state of the current chat, including whether the current user or the recipient is blocked.
The application is styled using standard CSS. Each component has its own CSS file, making it easy to manage styles and ensure that the UI is consistent across the app.
The index.css file contains global styles, including font settings, color variables, and default element styles. Component-specific styles are contained within their respective CSS files.
The KrafChat App is a robust, real-time chat application designed with scalability and user experience in mind. By leveraging modern tools like React, Zustand, and Firebase, the app offers a seamless and responsive chat experience. This documentation should provide a comprehensive overview of the project and guide you through the setup, development, and deployment processes.
For any questions, feedback, or support related to the KrafChat App, feel free to reach out: Linkedin
Link : KrafChat App