Simple Messenger is a self-hosted tool for communication with your friends :D
- Install dependencies
npm install
-
Create a Firebase Project (https://firebase.google.com)
-
Create an Auth Method at
Authentication > Sign-in method > Email/Password
-
Enable first option and
e-mail link
too. -
Create a Realtime Database Project
-
Setup environment variables
- Copy and rename
.env.example
to.env.local
- Replace
.env.local
content with your configuration
REACT_APP_API_KEY=your-web-api-key
REACT_APP_AUTH_DOMAIN=your-app.firebaseapp.com
REACT_APP_DATABASE_URL=https://your-app.firebaseio.com
REACT_APP_PROJECT_ID=your-app
REACT_APP_MESSEAGING_SENDER_ID=your-sender-id
REACT_APP_WEB_PUSH_CERTIFICATES=your-web-push-certificates
REACT_APP_APP_ID=-your-app-id
To discovery your key, at Firebase console go to Settings > Project Settings
.
-
Change your sender id in
firebase-messaging-sw.js
andmanifest.json
. -
Change your Database rule at
Database > rules
to:
{
"rules": {
".read": true,
".write": true
}
}
CAUTION! THIS WILL OPEN YOUR DATABASE! KEEP YOUR KEY SAFE!
Visit https://firebase.google.com/docs/database/security to learn more about security rules.
- Run the project
npm start
-
In the client application (http://localhost:3000) create a user with your e-mail
-
Go to
admin
and install dependencies
cd admin
npm install
-
In
/admin/set-user-admin.js
line 11 set your e-mail. -
Download your credentials at Firebase console
Settings > Service accounts
- or click here. -
Change this file for
simple-messenger-oss-firebase-adminsdk.json
. NEVER COMMIT YOUR CREDENTIAL JSON! -
Run
node set-user-admin.js;
Okay, your user now is admin and can see a list of contacts.
- Go to
functions
and install dependencies
cd functions
npm install
- Deploy functions by running
npm run deploy
And you all set to go, notifications will be sent if browser is in background and messages exchange from user and admin.
Help us to build this: