This is the backend code for the Chat App. It provides the server-side functionality for the chat application.
- User authentication and authorization
- Real-time messaging using WebSockets
- Persistent storage of chat messages
- User management (create, update, delete)
- Chat room management (create, join, leave)
- Node.js
- Express.js
- Socket.io
- MongoDB (or any other database of your choice)
- Clone the repository:
git clone <repository-url>
- Install dependencies:
npm install
- Configure the environment variables: MONGO_URI,JWT_SECRET,ADMIN_SECRET_KEY,NODE_ENV = DEVELOPMENT,CLIENT_URL,CLOUDINARY_CLOUD_NAME,CLOUDINARY_API_KEY,CLOUDINARY_API_SECRET
- Start the server:
npm start
The following environment variables need to be configured:
CLIENT_URL
: The URL on which the client will runMONGO_URI
: The URI for connecting to the MongoDB databaseJWT_SECRET
: The secret key used for JWT authenticationADMIN_SECRET_KEY
: The secret key used for Admin DashboardNODE_ENV
: Set to either 'development', 'production', or 'test' to indicate the current environment. This can be used for configuration changes based on the environment.CLOUDINARY_API_KEY
:Your Cloudinary API keyCLOUDINARY_CLOUD_NAME
:our Cloudinary cloud nameCLOUDINARY_API_SECRET
: Your Cloudinary API secret