This is a perfect example for a MERN stack real-time chat application with authentication & authorization.
Basically, it consists of 2 parts as the follows:
- Real-time chat application using socket.io in node.js(Express)
- JWT Authentication & Authorization stored in HTTP-only cookie
https://mern-auth-chat.onrender.com/
- Create a MongoDB database and obtain your
MongoDB URI
- MongoDB Atlas
git clone [email protected]:fskydev/mern-auth-chat.git
Rename the server/.env.example
file to .env
and add the following
PORT=5000
MONGO_URI=
JWT_SECRET_KEY=
Change the JWT_SECRET to what you want
cd server
npm install
cd socket
npm install
cd client
npm install
# Run API server
cd server
npm run dev
# Run socket server
cd socket
npm run dev
# Run frontend
cd client
npm run dev
cd client/ && npm install && npm run build && cd .. && cd server/ && npm install && npm run start
Happy coding 🔥