This is a chat app built with Next.js, Pusher, MongoDB, and Firebase Cloud Storage.
- User Authentication
- Text, image, video, and audio sharing
- Realtime voice chat through WebRTC
- Friend system
- User-created servers
- Direct messages
- Group chats
Check out the live project here.
This project uses MongoDB to store data. To run it locally, you must have an available cluster.
For Google Authentication to work, you must have a project in your Google Cloud Console. To learn how to set up authentication, read this guide
Pusher provides websocket connections separate from the Next.js server. You will need to create an account and retrieve necessary app keys required in the environment variables. Click here to learn more.
To store non-text media, Firebase Cloud Storage is used. To learn how to set up Cloud Storage, read this guide.
In a .env file, add the following variables:
BASE_URL
= The root URL of your dev serverMONGODB_URI
= The URI of the MongoDB cluster you wish to connect toNEXT_PUBLIC_GOOGLE_CLIENT_ID
= The client ID provided by Google's OAuth serviceGOOGLE_CLIENT_SECRET
= The client secret provided by Google's OAuth serviceNEXT_PUBLIC_GOOGLE_REDIRECT_URL
= Must be set to"<base url>/api/auth/callback/google"
- Whatever URL is provided here also must be added as an authorized redirect URL in your Google Cloud Console
PUSHER_APP_ID
= The app ID provided by PusherNEXT_PUBLIC_PUSHER_KEY
= The key provided by PusherPUSHER_SECRET
= The secret provided by PusherNEXT_PUBLIC_PUSHER_CLUSTER
= The cluster provided by Pusher
The following variables are found by going into your Firebase project settings, where they are listed in the firebaseConfig
object.
FIREBASE_API_KEY
= Value ofapiKey
in configFIREBASE_AUTH_DOMAIN
= Value ofauthDomain
in configFIREBASE_PROJECT_ID
= Value ofprojectId
in configFIREBASE_STORAGE_BUCKET
= Value ofstorageBucket
in configFIREBASE_MESSAGING_SENDER_ID
= Value ofmessagingSenderId
in configFIREBASE_APP_ID
= Value ofappId
in configFIREBASE_MEASUREMENT_ID
= Value ofmeasurementId
in config
To run the project, simply start the dev server and access the port on your browser.
npm run dev