A real time chat application done with tauri and react with a firebase backend
Executables for windows and linux is available here \ Executable for MacOS will be coming soon...
cd "Chat-App/Fiddle Chat App"
npm install
npm run tauri dev
To set up firebase, navigate to firebase setup and follow the instructions.
Once you have created a new project, add your Firebase project configuration into an .env
file. The .env
file must reside at the root of the application, which is this directory
The contents that you must place in the .env
file are as follows:
VITE_APIKEY=<Your firebase api key goes here and remove the angle brackets>
VITE_AUTHDOMAIN=<Your firebase auth domain goes here and remove the angle brackets>
VITE_PROJECTID=<Your firebase project id goes here and remove the angle brackets>
VITE_STORAGEBUCKET=<Your firebase storage bucket goes here and remove the angle brackets>
VITE_MESSAGINGSENDERID=<Your firebase messaging sender id goes here and remove the angle brackets>
VITE_APPID=<Your firebase app id goes here and remove the angle brackets>
VITE_MEASUREMENTID=<Your firebase measurement id goes here and remove the angle brackets>
VITE_GOOGLECLIENTID=<Your firebase google client id goes here and remove the angle brackets>
VITE_GITHUBCLIENTID=<This can be left empty as github login does not yet work fully>
Now add support for google, github and email and password authentication. According to firebase docs, the instructions for that are as follows:
**Enable Google as a sign-in method in the Firebase console:**
**In the Firebase console, open the Auth section.**
**On the Sign in method tab, enable the Google sign-in method and click Save**
The process for adding other sign-in methods is pretty much the same.
To set up a database, follow the instructions here: setting up a database
create a collections in the database and name it "users" and add a document. It can be empty document; it is more so as a placeholder and you can delete it once your database has been populated with other users.
Create a storage for your database. This allows users to store their profile pictures. The instructions for that are here: creating a storage
(Optional) You can add rules to restrict access to your database and make it more secure otherwise firebase will continuously send you emails about this. Just know if you don't add rules, anyone can access your database. The rules I used for my database are as follows:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.auth != null && get(/databases/$(database)/documents/users/$(request.auth.uid)).data.AccountActive == true
}
}
}
more information about rules in your database: https://firebase.google.com/docs/firestore/security/get-started
<div className="theme-selector">
<motion.div
className={themeCol === "light-yellow-col" ? "colour-circle selected-colour-circle" : "colour-circle"}
id="light-yellow-col"
whileHover={{scale: 1.03}}
whileTap={{scale: 0.97}}
onClick={() => changeThemeColours("light-yellow-col", "lyellow")}>
</motion.div>
<h3>Light yellow theme</h3>
</div>
#light-yellow-col{background: #f8e962;}
[data-theme='dgreen']
. If is light, copy [data-theme='lgreen']
.[data-theme='dgreen']
with the name of your colour, eg [data-theme='lyellow']
. Make sure this matches otherwise the colours won't reflect when you change the theme.This branch is done with tauri. The old version which is done with electron is accessible here: https://github.com/waveyboym/Chat-App/tree/read-only-old-version. The old version will no longer receive updates and/or fixes. I'm just putting it up in case anyone might want to have access to it.